mangleProps doesn't mangle TypeScript parameter property class field declaration
Author: pavel-zhukovCreated Aug 28, 2026Updated Aug 28, 2026
When using a TypeScript parameter property together with mangleProps, esbuild 0.28.2 can rename the property access generated for the parameter property without renaming the corresponding class field declaration.
This results in two different property names being used for what should be the same property.
Is this expected behavior, or should the generated class field declaration participate in property mangling together with the corresponding property access?
Reproduction
Input
class MyClass {
constructor(public foo: null) {}
}
new MyClass(null);Building
{
mangleProps: /^/
}Output
class MyClass {
constructor(foo) {
this.a = foo;
}
foo;
}
new MyClass(null);The foo parameter property is represented as a class field. However, this.foo is mangled to this.a, while the corresponding class field declaration remains foo. The generated code effectively contains two different properties, a and foo.
Source: evanw/esbuild