镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

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

Merged
Orta Therox (orta) merged 2 commits into
v2from
note_use_define_change
Aug 31, 2021
Merged

Orta Therox (orta) merged 2 commits into
v2from
note_use_define_change

Conversation

@orta

Copy link
Copy Markdown
Contributor


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.

Copy link
Copy Markdown

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.

Copy link
Copy Markdown

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
Copy Markdown
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

github-actions Bot commented Aug 31, 2021 •

Copy link
Copy Markdown
Contributor
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 Therox (orta) merged commit d4f5ee8 into v2 Aug 31, 2021
@jakebailey
Jake Bailey (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