diff --git a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts index e5a067018dac9..233a5e4b32fc6 100644 --- a/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts +++ b/compiler/packages/babel-plugin-react-compiler/src/HIR/BuildHIR.ts @@ -1332,6 +1332,7 @@ function lowerStatement( return; } case "TypeAlias": + case "TSInterfaceDeclaration": case "TSTypeAliasDeclaration": { // We do not preserve type annotations/syntax through transformation return; @@ -1358,7 +1359,6 @@ function lowerStatement( case "TSEnumDeclaration": case "TSExportAssignment": case "TSImportEqualsDeclaration": - case "TSInterfaceDeclaration": case "TSModuleDeclaration": case "TSNamespaceExportDeclaration": case "WithStatement": { diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.expect.md b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.expect.md new file mode 100644 index 0000000000000..b4d8a4155c3b3 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.expect.md @@ -0,0 +1,35 @@ + +## Input + +```javascript +function Foo() { + type X = number; + interface Bar { + baz: number; + } + return 0; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Foo, + params: [], +}; + +``` + +## Code + +```javascript +function Foo() { + return 0; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Foo, + params: [], +}; + +``` + +### Eval output +(kind: ok) 0 \ No newline at end of file diff --git a/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.ts b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.ts new file mode 100644 index 0000000000000..4330642bcf7a6 --- /dev/null +++ b/compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/ignore-inner-interface-types.ts @@ -0,0 +1,12 @@ +function Foo() { + type X = number; + interface Bar { + baz: number; + } + return 0; +} + +export const FIXTURE_ENTRYPOINT = { + fn: Foo, + params: [], +};