diff --git a/crates/oxc_transformer/src/typescript/annotations.rs b/crates/oxc_transformer/src/typescript/annotations.rs index bc27245ddce78..fd37980f5fa9e 100644 --- a/crates/oxc_transformer/src/typescript/annotations.rs +++ b/crates/oxc_transformer/src/typescript/annotations.rs @@ -87,7 +87,7 @@ impl<'a> TypeScriptAnnotations<'a> { ident.reference_id.get().is_some_and(|id| { ctx.symbols().references[id].symbol_id().is_some_and( |symbol_id| { - ctx.symbols().get_flag(symbol_id).is_type() + !ctx.symbols().get_flag(symbol_id).is_value() }, ) }) diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/input.ts b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/input.ts similarity index 56% rename from tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/input.ts rename to tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/input.ts index 59cafb2987a48..65b1e6efb0b52 100644 --- a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/input.ts +++ b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/input.ts @@ -8,4 +8,10 @@ namespace Name { export const Q = 0; } -export { Im, Ok, Foo, Bar, Func, Baz, Baq, Name }; \ No newline at end of file +export { Im, Ok, Foo, Bar, Func, Baz, Baq, Name }; + +type T = number; +function T(): T { + return 123; +} +export { T } \ No newline at end of file diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/output.ts b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/output.ts similarity index 81% rename from tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/output.ts rename to tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/output.ts index 3439410750831..6e60c70871b10 100644 --- a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/class-export/output.ts +++ b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/export-elimination/output.ts @@ -6,4 +6,10 @@ let Name; (function(_Name) { const Q = _Name.Q = 0; })(Name || (Name = {})); + export { Im, Ok, Foo, Bar, Func, Name }; + +function T() { + return 123; +} +export { T } \ No newline at end of file