remove 'EnumDeclaration' as a type expected to throw error in module generators

Summary:
Handling of `EnumDeclaration` was introduced in D38967241 (745f3ee8c5) so it is no longer a type expected to fail generators.

Changelog: [Internal] remove 'EnumDeclaration' as a type expected to throw error in module generators

Reviewed By: cipolleschi

Differential Revision: D42917947

fbshipit-source-id: 16fcb915ccd42c613ca4d30b815d6365681f5fa1
This commit is contained in:
Vitali Zaidman 2023-02-03 03:03:41 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 209d019055
Коммит 53c9786b71
3 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -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));
}
}
@ -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));
}
}
@ -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));
}
}

Просмотреть файл

@ -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}"`,
);
@ -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}"`,
);
@ -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}"`,
);

Просмотреть файл

@ -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}`,
);
@ -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}`,
);