Target ES2016
When a constructor parameter property name collides with a type used in a class field arrow function parameter, OXC incorrectly renames the property (e.g. Foo → _Foo) only in the constructor, but does not update its usages elsewhere in the class.
This leads to broken runtime behavior.
🔁 Minimal Reproduction
import type { Foo } from './types';
class A {
constructor(private Foo: any) {}
method = (x: Foo) => x;
myMethod() {
console.log(this.Foo);
}
}
❌ Transpiled Output
import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
class A {
constructor(_Foo) {
this._Foo = _Foo;
_defineProperty(this, "method", (x) => x);
}
myMethod() {
console.log(this.Foo); // ❌ still refers to Foo, not _Foo
}
}
💥 Problem
• Constructor parameter Foo is renamed to _Foo
• Property becomes this._Foo
• But usages like this.Foo are not updated
⚠️ This is critical because it
• Produces invalid runtime code
• Silent bug (no compile error, breaks at runtime)
Reproducible Playground link
Target ES2016
When a constructor parameter property name collides with a type used in a class field arrow function parameter, OXC incorrectly renames the property (e.g.
Foo→_Foo) only in the constructor, but does not update its usages elsewhere in the class.This leads to broken runtime behavior.
🔁 Minimal Reproduction
❌ Transpiled Output
💥 Problem
• Constructor parameter
Foois renamed to_Foo• Property becomes
this._Foo• But usages like
this.Fooare not updated• Produces invalid runtime code
• Silent bug (no compile error, breaks at runtime)
Reproducible Playground link