-
-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Description
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.
IvanLi-CN, steveluscher and Romakita
Metadata
Metadata
Assignees
Labels
No labels