-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Adds a note in the 4.3 release notes for the useDefineForClassFields default change #2008
Conversation
|
||
In ES2020 the class fields feature was added into JavaScript with behavior which differed from how TypeScript had implemented it. In preparation for this, in TypeScript 3.7, a flag was added ([`useDefineForClassFields`](https://www.typescriptlang.org/tsconfig#useDefineForClassFields)) to migrate to emitted JavaScript to match the JavaScript standard behavior. | ||
|
||
Now that the feature is in JavaScript, we are switching to the JavaScript behavior for any projects targeting `es2020` and above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this also include that useDefineForClassFields
is mutually exclusive with experimentalDecorators
? It's not apparent from this description that setting both to true
will cause emitted JS to include decorator boilerplate function and property definitions, but that extra code will do nothing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the documentation at https://www.typescriptlang.org/tsconfig#useDefineForClassFields specifies es2022
and above, but this states es2020
and above, which is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, good point - it is es2022 but that's not an option in TS yet.
I'm not sure this is the point to cover how decorators works with useDefineForClassFields
Got false positives?Make changes to the global settings spellcheck.json in /microsoft/TypeScript-Website. Make changes to this repo's settings in spellcheck.json. Typos for TypeScript 4.3.md
|
Re: microsoft/TypeScript#45653