Skip to content

Commit

Permalink
remove EnumDeclaration as expected type to throw error in module gene…
Browse files Browse the repository at this point in the history
…rators

Differential Revision: D42917947

fbshipit-source-id: d4d53d0136d805f3f0bba816bce2a9154bd400f1
  • Loading branch information
Vitali Zaidman authored and facebook-github-bot committed Feb 1, 2023
1 parent 1fb511f commit 1f5976c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function translateFunctionParamToJavaType(
imports.add('com.facebook.react.bridge.Callback');
return wrapNullable('Callback');
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(createErrorMessage(realTypeAnnotation.type));
}
}
Expand Down Expand Up @@ -272,7 +272,7 @@ function translateFunctionReturnTypeToJavaType(
imports.add('com.facebook.react.bridge.WritableArray');
return wrapNullable('WritableArray');
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(createErrorMessage(realTypeAnnotation.type));
}
}
Expand Down Expand Up @@ -346,7 +346,7 @@ function getFalsyReturnStatementFromReturnType(
case 'ArrayTypeAnnotation':
return 'return null;';
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(createErrorMessage(realTypeAnnotation.type));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ function translateReturnTypeToKind(
case 'ArrayTypeAnnotation':
return 'ArrayKind';
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(
`Unknown prop type for returning value, found: ${realTypeAnnotation.type}"`,
);
Expand Down Expand Up @@ -272,7 +272,7 @@ function translateParamTypeToJniType(
case 'FunctionTypeAnnotation':
return 'Lcom/facebook/react/bridge/Callback;';
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(
`Unknown prop type for method arg, found: ${realTypeAnnotation.type}"`,
);
Expand Down Expand Up @@ -348,7 +348,7 @@ function translateReturnTypeToJniType(
case 'ArrayTypeAnnotation':
return 'Lcom/facebook/react/bridge/WritableArray;';
default:
(realTypeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(realTypeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(
`Unknown prop type for method return type, found: ${realTypeAnnotation.type}"`,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function getReturnObjCType(
case 'GenericObjectTypeAnnotation':
return wrapIntoNullableIfNeeded('NSDictionary *');
default:
(typeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(typeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(
`Unsupported return type for ${methodName}. Found: ${typeAnnotation.type}`,
);
Expand Down Expand Up @@ -439,7 +439,7 @@ function getReturnJSType(
);
}
default:
(typeAnnotation.type: 'EnumDeclaration' | 'MixedTypeAnnotation');
(typeAnnotation.type: 'MixedTypeAnnotation');
throw new Error(
`Unsupported return type for ${methodName}. Found: ${typeAnnotation.type}`,
);
Expand Down

0 comments on commit 1f5976c

Please sign in to comment.