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

Adds a note in the 4.3 release notes for the useDefineForClassFields default change #2008

Merged
merged 2 commits into from
Aug 31, 2021

Conversation

orta
Copy link
Contributor

@orta orta commented Aug 31, 2021


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.

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.

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?

Copy link
Contributor Author

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

@github-actions
Copy link
Contributor

github-actions bot commented Aug 31, 2021

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

Line Typo
77 the above example, our set accessor takes a broader set of types
77 and numbers), but our get accessor always guarantees it will be
112 e (e.g. the type on the get accessor above).
268 ft/TypeScript/pull/39669) by [Wenlu Wang](https://github.com/King
424 loomberg - written by [Titian Cernicova-Dragomir](https://github.com/dragomirt
424 ithub.com/dragomirtitian)and [Kubilay Kahveci](https://github.com/m
424 m/dragomirtitian)and [Kubilay Kahveci](https://github.com/mkubilayk
541 Ew, errors!
590 ## Always-Truthy Promise Checks
592 cking whether a Promise is "truthy" in a conditional will trigge
637 /TypeScript/pull/37797) from [Wenlu Wang](https://github.com/micr
672 k was spear-headed by [Tobias Koppers](https://github.com/sokra) in
677 - 14.9MB to 1MB
694 Script/pull/42960) by [Tobias Koppers](https://github.com/sokra), w
762 y it out with imports to CSS, SVGs, PNGs, font files, Vue files,
771 ease, we leveraged [Mozilla's browser-compat-data](https://github.com/mdn/brows
783 ### Errors on Always-Truthy Promise Checks
802 ### Union Enums Cannot Be Compared to Arbitra
805 In those cases, an enum can recall each value that it
855 vely, you can re-declare your enum to have a non-trivial initial
855 gnable and comparable to that enum. This may be useful if the in
855 eful if the intent is for the enum to specify a few well-known v

Generated by 🚫 dangerJS against ede3cf4

@orta orta enabled auto-merge August 31, 2021 16:06
@orta orta merged commit d4f5ee8 into v2 Aug 31, 2021
@jakebailey jakebailey deleted the note_use_define_change branch May 17, 2024 21:59
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

Successfully merging this pull request may close these issues.

2 participants