When compiling with the typescript compiler (tsc
), how class fields are transformed depends on the value of useDefineForClassFields
, but the tsup
is currently ignoring this setting.
This causes problems with field decorators.
Original typescript code:
export class Foo {
@customDecorator()
public readonly value!: string;
}
Result of tsc
with useDefineForClassFields = false
class Foo {
}
Result of tsc
with useDefineForClassFields = true
class Foo {
constructor() {
Object.defineProperty(this, "value", {
enumerable: true,
configurable: true,
writable: true,
value: void 0
});
}
}
Result of tsup
regardless of useDefineForClassFields
value
var Foo = class {
constructor() {
__publicField(this, "value");
}
}
The issue here is that the __publicField()
logic which is being added, prevents processing of field decorators.
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too