diff --git a/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js b/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js index 31449e97abe..946b622ea87 100644 --- a/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js +++ b/packages/babel-plugin-codegen/__test_fixtures__/fixtures.js @@ -103,72 +103,8 @@ export default (codegenNativeComponent('Module', { }): NativeType); `; -const SAMPLE_TURBO_MODULE_SINGLE_DEFAULT_EXPORT = ` -// @flow - -import type {RootTag, TurboModule} from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; - -export interface Spec extends TurboModule { - // Exported methods. - +getConstants: () => {| - const1: boolean, - const2: number, - const3: string, - |}; - +voidFunc: () => void; - +getBool: (arg: boolean) => boolean; - +getNumber: (arg: number) => number; - +getString: (arg: string) => string; - +getArray: (arg: Array) => Array; - +getObject: (arg: Object) => Object; - +getRootTag: (arg: RootTag) => RootTag; - +getValue: (x: number, y: string, z: Object) => Object; - +getValueWithCallback: (callback: (value: string) => void) => void; - +getValueWithPromise: (error: boolean) => Promise; -} - -export default (TurboModuleRegistry.getEnforcing( - 'SampleTurboModule', -): Spec); -`; - -const SAMPLE_TURBO_MODULE_VARIABLE_ASSIGNMENT = ` -// @flow - -import type {RootTag, TurboModule} from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; - -export interface Spec extends TurboModule { - // Exported methods. - +getConstants: () => {| - const1: boolean, - const2: number, - const3: string, - |}; - +voidFunc: () => void; - +getBool: (arg: boolean) => boolean; - +getNumber: (arg: number) => number; - +getString: (arg: string) => string; - +getArray: (arg: Array) => Array; - +getObject: (arg: Object) => Object; - +getRootTag: (arg: RootTag) => RootTag; - +getValue: (x: number, y: string, z: Object) => Object; - +getValueWithCallback: (callback: (value: string) => void) => void; - +getValueWithPromise: (error: boolean) => Promise; -} - -const module = TurboModuleRegistry.getEnforcing( - 'SampleTurboModule', -); - -export default (module: Spec); -`; - module.exports = { 'NotANativeComponent.js': NOT_A_NATIVE_COMPONENT, 'FullNativeComponent.js': FULL_NATIVE_COMPONENT, 'FullTypedNativeComponent.js': FULL_NATIVE_COMPONENT_WITH_TYPE_EXPORT, - 'NativeSampleTurboModule0.js': SAMPLE_TURBO_MODULE_SINGLE_DEFAULT_EXPORT, - 'NativeSampleTurboModule1.js': SAMPLE_TURBO_MODULE_VARIABLE_ASSIGNMENT, }; diff --git a/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap b/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap index 1da53e5bc14..7018db249d9 100644 --- a/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap +++ b/packages/babel-plugin-codegen/__tests__/__snapshots__/index-test.js.snap @@ -124,57 +124,6 @@ export const Commands = { };" `; -exports[`Babel plugin inline view configs can inline config for NativeSampleTurboModule0.js 1`] = ` -"// @flow -import type { RootTag, TurboModule } from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; -export interface Spec extends TurboModule { - // Exported methods. - +getConstants: () => {| - const1: boolean, - const2: number, - const3: string, - |}, - +voidFunc: () => void, - +getBool: (arg: boolean) => boolean, - +getNumber: (arg: number) => number, - +getString: (arg: string) => string, - +getArray: (arg: Array) => Array, - +getObject: (arg: Object) => Object, - +getRootTag: (arg: RootTag) => RootTag, - +getValue: (x: number, y: string, z: Object) => Object, - +getValueWithCallback: (callback: (value: string) => void) => void, - +getValueWithPromise: (error: boolean) => Promise, -} -export default (TurboModuleRegistry.getEnforcing('SampleTurboModule'): Spec);" -`; - -exports[`Babel plugin inline view configs can inline config for NativeSampleTurboModule1.js 1`] = ` -"// @flow -import type { RootTag, TurboModule } from '../RCTExport'; -import * as TurboModuleRegistry from '../TurboModuleRegistry'; -export interface Spec extends TurboModule { - // Exported methods. - +getConstants: () => {| - const1: boolean, - const2: number, - const3: string, - |}, - +voidFunc: () => void, - +getBool: (arg: boolean) => boolean, - +getNumber: (arg: number) => number, - +getString: (arg: string) => string, - +getArray: (arg: Array) => Array, - +getObject: (arg: Object) => Object, - +getRootTag: (arg: RootTag) => RootTag, - +getValue: (x: number, y: string, z: Object) => Object, - +getValueWithCallback: (callback: (value: string) => void) => void, - +getValueWithPromise: (error: boolean) => Promise, -} -const module = TurboModuleRegistry.getEnforcing('SampleTurboModule'); -export default (module: Spec);" -`; - exports[`Babel plugin inline view configs can inline config for NotANativeComponent.js 1`] = ` "const requireNativeComponent = require('requireNativeComponent');