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

Document class constructor property parameters initialization order. #3030

Open
thomas-w-grant opened this issue Feb 15, 2024 · 1 comment
Open

Comments

@thomas-w-grant
Copy link

The current handbook describes very well the order of initialization for base class vs derived class. But I failed to find any documentation on when are contructor property parameters initialized. I believe they are initialized before class field initializers. This was critical info that I lacked and had to dig deeper to find it.

Please add this information to the paragraph that describes constructor property parameters. https://www.typescriptlang.org/docs/handbook/2/classes.html#parameter-properties

@richvdh
Copy link

richvdh commented Jun 21, 2024

I believe they are initialized before class field initializers

It actually looks like this might have changed, as of target: es2022. When I set that option, regular properties are initialised before property parameters; related I think to microsoft/TypeScript#45995

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

2 participants