diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js index b23a68ef556..6242d5b402e 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/__test_fixtures__/failures.js @@ -159,54 +159,6 @@ export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); `; -const NATIVE_MODULE_NULLABLE_BOOLEAN = ` -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import type {TurboModule} from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; - -export interface Spec extends TurboModule { - +getSth(a : ?boolean) => void -} - -export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); - -`; - -const NATIVE_MODULE_NULLABLE_NUMBER = ` -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import type {TurboModule} from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; - -export interface Spec extends TurboModule { - +getSth(a : ?number) => void -} - -export default TurboModuleRegistry.getEnforcing('SampleTurboModule'); - -`; - const TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT = ` /** * Copyright (c) Facebook, Inc. and its affiliates. @@ -260,8 +212,6 @@ module.exports = { NATIVE_MODULES_WITH_PROMISE_WITHOUT_TYPE, NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM, NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT, - NATIVE_MODULE_NULLABLE_BOOLEAN, - NATIVE_MODULE_NULLABLE_NUMBER, TWO_NATIVE_MODULES_EXPORTED_WITH_DEFAULT, NATIVE_MODULES_WITH_NOT_EXISTING_TYPE_AS_PARAM, NATIVE_MODULES_WITH_NOT_EXISTING_TYPE_AS_RETURN, diff --git a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-test.js.snap b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-test.js.snap index 6696de03398..07dc009fc4c 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-test.js.snap +++ b/packages/react-native-codegen/src/parsers/flow/modules/__tests__/__snapshots__/module-parser-test.js.snap @@ -1,9 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULE_NULLABLE_BOOLEAN 1`] = `"Booleans and numbers cannot be nullable for param \\"a in method \\"getSth\\"."`; - -exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULE_NULLABLE_NUMBER 1`] = `"Booleans and numbers cannot be nullable for param \\"a in method \\"getSth\\"."`; - exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT 1`] = `"Unsupported return type for getString: expected to find annotation for type of array contents"`; exports[`RN Codegen Flow Parser Fails with error message NATIVE_MODULES_WITH_ARRAY_WITH_NO_TYPE_FOR_CONTENT_AS_PARAM 1`] = `"Unsupported type for getString, param: \\"arg\\": expected to find annotation for type of array contents"`; diff --git a/packages/react-native-codegen/src/parsers/flow/modules/methods.js b/packages/react-native-codegen/src/parsers/flow/modules/methods.js index a544d210e4d..d96692ed197 100644 --- a/packages/react-native-codegen/src/parsers/flow/modules/methods.js +++ b/packages/react-native-codegen/src/parsers/flow/modules/methods.js @@ -201,12 +201,6 @@ function getTypeAnnotationForParam( }; case 'NumberTypeAnnotation': case 'BooleanTypeAnnotation': - if (nullable) { - throw new Error( - `Booleans and numbers cannot be nullable for param "${paramName} in method "${name}".`, - ); - } - // eslint-disable no-fallthrough case 'StringTypeAnnotation': return { nullable,