From 8a1d3c9faa6ceced2fe52197d160c84c1a589dd7 Mon Sep 17 00:00:00 2001 From: Orta Date: Tue, 31 Aug 2021 15:54:49 +0100 Subject: [PATCH 1/2] Adds a note in the 4.3 release notes for the useDefineForClassFields default change --- .../documentation/copy/en/release-notes/TypeScript 4.3.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/documentation/copy/en/release-notes/TypeScript 4.3.md b/packages/documentation/copy/en/release-notes/TypeScript 4.3.md index 24420d565118..89617992cae7 100644 --- a/packages/documentation/copy/en/release-notes/TypeScript 4.3.md +++ b/packages/documentation/copy/en/release-notes/TypeScript 4.3.md @@ -774,6 +774,12 @@ This is discussed [in some detail here](https://github.com/microsoft/TypeScript- https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/991 +### `useDefineForClassFields` now defaults to true on `es2020` and above + +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. + ### Errors on Always-Truthy Promise Checks Under `strictNullChecks`, using a `Promise` that always appears to be defined within a condition check is now considered an error. From ede3cf406220de5eb33424e8dded336dc5f1765b Mon Sep 17 00:00:00 2001 From: Orta Date: Tue, 31 Aug 2021 17:03:55 +0100 Subject: [PATCH 2/2] Fixes the year --- .../documentation/copy/en/release-notes/TypeScript 4.3.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/documentation/copy/en/release-notes/TypeScript 4.3.md b/packages/documentation/copy/en/release-notes/TypeScript 4.3.md index 89617992cae7..f56658cc00ba 100644 --- a/packages/documentation/copy/en/release-notes/TypeScript 4.3.md +++ b/packages/documentation/copy/en/release-notes/TypeScript 4.3.md @@ -774,11 +774,11 @@ This is discussed [in some detail here](https://github.com/microsoft/TypeScript- https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/991 -### `useDefineForClassFields` now defaults to true on `es2020` and above +### `useDefineForClassFields` now defaults to true on `esnext` and eventually on `es2022` -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. +In 2021 the class fields feature was added into the JavaScript specification 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. +Now that the feature is in JavaScript we are changing the default to `true` for ES2022 and above, including ESNext. ### Errors on Always-Truthy Promise Checks