Skip to content

empty attributes on ts models with target equal or above ES2022  #377

@cyjake

Description

@cyjake
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.

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions