diff --git a/crates/oxc_transformer/src/lib.rs b/crates/oxc_transformer/src/lib.rs index 502b1cea4f4bd..4d3f76901ac55 100644 --- a/crates/oxc_transformer/src/lib.rs +++ b/crates/oxc_transformer/src/lib.rs @@ -262,6 +262,14 @@ impl<'a> Traverse<'a> for Transformer<'a> { self.x0_typescript.transform_property_definition(def); } + fn enter_accessor_property( + &mut self, + node: &mut AccessorProperty<'a>, + _ctx: &mut TraverseCtx<'a>, + ) { + self.x0_typescript.transform_accessor_property(node); + } + fn enter_statements(&mut self, stmts: &mut Vec<'a, Statement<'a>>, ctx: &mut TraverseCtx<'a>) { self.x0_typescript.transform_statements(stmts); self.x1_react.transform_statements(stmts, ctx); diff --git a/crates/oxc_transformer/src/typescript/annotations.rs b/crates/oxc_transformer/src/typescript/annotations.rs index e7019fe8792e2..c81f43046d7d3 100644 --- a/crates/oxc_transformer/src/typescript/annotations.rs +++ b/crates/oxc_transformer/src/typescript/annotations.rs @@ -353,6 +353,12 @@ impl<'a> TypeScriptAnnotations<'a> { def.type_annotation = None; } + pub fn transform_accessor_property(&mut self, def: &mut AccessorProperty<'a>) { + def.accessibility = None; + def.definite = false; + def.type_annotation = None; + } + pub fn transform_statements(&mut self, stmts: &mut ArenaVec<'a, Statement<'a>>) { // Remove declare declaration stmts.retain( diff --git a/crates/oxc_transformer/src/typescript/mod.rs b/crates/oxc_transformer/src/typescript/mod.rs index 07fed261a7806..e32f594696f7a 100644 --- a/crates/oxc_transformer/src/typescript/mod.rs +++ b/crates/oxc_transformer/src/typescript/mod.rs @@ -147,6 +147,10 @@ impl<'a> TypeScript<'a> { self.annotations.transform_property_definition(def); } + pub fn transform_accessor_property(&mut self, def: &mut AccessorProperty<'a>) { + self.annotations.transform_accessor_property(def); + } + pub fn transform_statements(&mut self, stmts: &mut Vec<'a, Statement<'a>>) { self.annotations.transform_statements(stmts); } diff --git a/tasks/coverage/semantic_misc.snap b/tasks/coverage/semantic_misc.snap index fe0696455d5b8..ff5993806cf65 100644 --- a/tasks/coverage/semantic_misc.snap +++ b/tasks/coverage/semantic_misc.snap @@ -163,9 +163,6 @@ tasks/coverage/misc/pass/oxc-5177.ts semantic error: Bindings mismatch: after transform: ScopeId(0): ["Bang", "Foo"] rebuilt : ScopeId(0): ["Bang"] -Unresolved references mismatch: -after transform: [] -rebuilt : ["Foo"] tasks/coverage/misc/pass/swc-7187.ts semantic error: Bindings mismatch: diff --git a/tasks/transform_conformance/babel.snap.md b/tasks/transform_conformance/babel.snap.md index 4ce3ff99116a9..84883e790e6e8 100644 --- a/tasks/transform_conformance/babel.snap.md +++ b/tasks/transform_conformance/babel.snap.md @@ -1979,7 +1979,6 @@ failed to resolve query: failed to parse the rest of input: ...'' * class/accessor-allowDeclareFields-false/input.ts - x Output mismatch x TS(18010): An accessibility modifier cannot be used with a private | identifier. ,-[tasks/coverage/babel/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-false/input.ts:8:3] @@ -1991,7 +1990,6 @@ failed to resolve query: failed to parse the rest of input: ...'' * class/accessor-allowDeclareFields-true/input.ts - x Output mismatch x TS(18010): An accessibility modifier cannot be used with a private | identifier. ,-[tasks/coverage/babel/packages/babel-plugin-transform-typescript/test/fixtures/class/accessor-allowDeclareFields-true/input.ts:8:3]