Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/oxc_transformer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions crates/oxc_transformer/src/typescript/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 4 additions & 0 deletions crates/oxc_transformer/src/typescript/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 0 additions & 3 deletions tasks/coverage/semantic_misc.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions tasks/transform_conformance/babel.snap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down