-
Notifications
You must be signed in to change notification settings - Fork 23
Open
0 / 10 of 1 issue completedOpen
0 / 10 of 1 issue completed
Copy link
Description
class Template extends Bone {
@Column()
id: number;
@Column()
createdAt: Date;
}
the model above might be instantiated like an empty object when compiled with tsconfig that has target
set to ES2022 or above:
Collection (30) [
Template {}, ...
]
this is because public class fields will be initialized with [[Define]] rather than [[Set]] when the target is ES2022 or above. ts projects with this config will have to change the https://www.typescriptlang.org/tsconfig#useDefineForClassFields property to false.
- https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier
- useDefineForClassFields defaults to true when target is es2022, breaks decorators. microsoft/TypeScript#48814
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Public_class_fields#description
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels