Repository navigation
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.
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.
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.
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