Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update TypeScript config to enable useDefineForClassFields #7474

Open
GytisCepk opened this issue Dec 10, 2024 · 0 comments
Open

Update TypeScript config to enable useDefineForClassFields #7474

GytisCepk opened this issue Dec 10, 2024 · 0 comments

Comments

@GytisCepk
Copy link
Contributor

useDefineForClassFields changes behavior of how class properties are initialized (TypeScript documentation). TypeScript recommends enabling it as it makes TypeScript code closer to ECMA runtime behavior

This breaks following:

  • All classes derived from Entity:
    Because of how properties are initialized in Entity class, all classes which extend Entity and initialize it's properties via Entity constructor (super(props, iModel)) will not have those properties initialized (they will be set to undefined). TS playground of suggested fix
  • A few tests in @itwin/core-bentley:
    With useDefineForClassFields enabled properties not initialized during class construction are created and set to undefined while currently those properties are absent. This breaks some of the deepEqual asserts.
  • RPC interface / implementation registration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant