diff --git a/crates/oxc_transformer/src/typescript/annotations.rs b/crates/oxc_transformer/src/typescript/annotations.rs index 9d5e08036ef59..395c2c66d91a5 100644 --- a/crates/oxc_transformer/src/typescript/annotations.rs +++ b/crates/oxc_transformer/src/typescript/annotations.rs @@ -83,7 +83,10 @@ impl<'a> TypeScriptAnnotations<'a> { }); !decl.specifiers.is_empty() - || matches!(&decl.declaration, Some(decl) if !decl.is_typescript_syntax()) + || decl + .declaration + .as_ref() + .is_some_and(|decl| !decl.is_typescript_syntax()) } } Statement::ExportAllDeclaration(decl) => !decl.export_kind.is_type(), @@ -170,7 +173,6 @@ impl<'a> TypeScriptAnnotations<'a> { class.super_type_parameters = None; class.implements = None; class.r#abstract = false; - class.declare = false; } pub fn transform_class_body(&mut self, body: &mut ClassBody<'a>) { diff --git a/tasks/transform_conformance/oxc.snap.md b/tasks/transform_conformance/oxc.snap.md index a0c1631a48db7..4445a5f29aa64 100644 --- a/tasks/transform_conformance/oxc.snap.md +++ b/tasks/transform_conformance/oxc.snap.md @@ -1,6 +1,6 @@ commit: 12619ffe -Passed: 5/5 +Passed: 6/6 # All Passed: * babel-plugin-transform-typescript diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/input.ts b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/input.ts new file mode 100644 index 0000000000000..3ef5553b39053 --- /dev/null +++ b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/input.ts @@ -0,0 +1,7 @@ +declare const ReactiveMarkerSymbol: unique symbol + +export declare class ReactiveMarker { + private [ReactiveMarkerSymbol]?: void +} + +export declare const A = 1 \ No newline at end of file diff --git a/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/output.js b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/output.js new file mode 100644 index 0000000000000..8cec2e9ced0d3 --- /dev/null +++ b/tasks/transform_conformance/tests/babel-plugin-transform-typescript/test/fixtures/elimination-declare/output.js @@ -0,0 +1 @@ +export {}; \ No newline at end of file