Skip to content

Commit ee09569

Browse files
petamorikenlionel-rowedeveloper-bandijakebailey
authored
Introduce ES2025 target & Add missing ScriptTargetFeatures (#63046)
Co-authored-by: lionel-rowe <lionel.rowe@gmail.com> Co-authored-by: 김상두 <puki4416@gmail.com> Co-authored-by: Jake Bailey <5341706+jakebailey@users.noreply.github.com>
1 parent d67f0af commit ee09569

File tree

2,272 files changed

+34182
-33590
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,272 files changed

+34182
-33590
lines changed

src/compiler/commandLineParser.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ const jsxOptionMap = new Map(Object.entries({
141141
export const inverseJsxOptionMap: Map<string, string> = new Map(mapIterator(jsxOptionMap.entries(), ([key, value]: [string, JsxEmit]) => ["" + value, key] as const));
142142

143143
// NOTE: The order here is important to default lib ordering as entries will have the same
144-
// order in the generated program (see `getDefaultLibPriority` in program.ts). This
144+
// order in the generated program (see `getDefaultLibFilePriority` in program.ts). This
145145
// order also affects overload resolution when a type declared in one lib is
146146
// augmented in another lib.
147147
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
148148
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
149-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
149+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
150150
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
151151
const libEntries: [string, string][] = [
152152
// JavaScript only
@@ -163,6 +163,7 @@ const libEntries: [string, string][] = [
163163
["es2022", "lib.es2022.d.ts"],
164164
["es2023", "lib.es2023.d.ts"],
165165
["es2024", "lib.es2024.d.ts"],
166+
["es2025", "lib.es2025.d.ts"],
166167
["esnext", "lib.esnext.d.ts"],
167168
// Host only
168169
["dom", "lib.dom.d.ts"],
@@ -173,7 +174,7 @@ const libEntries: [string, string][] = [
173174
["webworker.iterable", "lib.webworker.iterable.d.ts"],
174175
["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
175176
["scripthost", "lib.scripthost.d.ts"],
176-
// ES2015 Or ESNext By-feature options
177+
// ES2015 and later By-feature options
177178
["es2015.core", "lib.es2015.core.d.ts"],
178179
["es2015.collection", "lib.es2015.collection.d.ts"],
179180
["es2015.generator", "lib.es2015.generator.d.ts"],
@@ -230,27 +231,33 @@ const libEntries: [string, string][] = [
230231
["es2024.regexp", "lib.es2024.regexp.d.ts"],
231232
["es2024.sharedmemory", "lib.es2024.sharedmemory.d.ts"],
232233
["es2024.string", "lib.es2024.string.d.ts"],
233-
["esnext.array", "lib.es2023.array.d.ts"],
234-
["esnext.collection", "lib.esnext.collection.d.ts"],
235-
["esnext.symbol", "lib.es2019.symbol.d.ts"],
234+
["es2025.collection", "lib.es2025.collection.d.ts"],
235+
["es2025.float16", "lib.es2025.float16.d.ts"],
236+
["es2025.intl", "lib.es2025.intl.d.ts"],
237+
["es2025.iterator", "lib.es2025.iterator.d.ts"],
238+
["es2025.promise", "lib.es2025.promise.d.ts"],
239+
["es2025.regexp", "lib.es2025.regexp.d.ts"],
240+
// Fallback for backward compatibility
236241
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
237-
["esnext.intl", "lib.esnext.intl.d.ts"],
238-
["esnext.disposable", "lib.esnext.disposable.d.ts"],
242+
["esnext.symbol", "lib.es2019.symbol.d.ts"],
239243
["esnext.bigint", "lib.es2020.bigint.d.ts"],
240-
["esnext.string", "lib.es2022.string.d.ts"],
241-
["esnext.promise", "lib.es2024.promise.d.ts"],
242244
["esnext.weakref", "lib.es2021.weakref.d.ts"],
243-
["esnext.decorators", "lib.esnext.decorators.d.ts"],
244245
["esnext.object", "lib.es2024.object.d.ts"],
245-
["esnext.array", "lib.esnext.array.d.ts"],
246246
["esnext.regexp", "lib.es2024.regexp.d.ts"],
247247
["esnext.string", "lib.es2024.string.d.ts"],
248-
["esnext.iterator", "lib.esnext.iterator.d.ts"],
249-
["esnext.promise", "lib.esnext.promise.d.ts"],
250-
["esnext.float16", "lib.esnext.float16.d.ts"],
251-
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
248+
["esnext.collection", "lib.es2025.collection.d.ts"],
249+
["esnext.float16", "lib.es2025.float16.d.ts"],
250+
["esnext.iterator", "lib.es2025.iterator.d.ts"],
251+
["esnext.promise", "lib.es2025.promise.d.ts"],
252+
// ESNext By-feature options
253+
["esnext.array", "lib.esnext.array.d.ts"],
254+
["esnext.decorators", "lib.esnext.decorators.d.ts"],
255+
["esnext.disposable", "lib.esnext.disposable.d.ts"],
252256
["esnext.error", "lib.esnext.error.d.ts"],
257+
["esnext.intl", "lib.esnext.intl.d.ts"],
253258
["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"],
259+
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
260+
// Decorators
254261
["decorators", "lib.decorators.d.ts"],
255262
["decorators.legacy", "lib.decorators.legacy.d.ts"],
256263
];
@@ -555,6 +562,10 @@ export const commonOptionsWithBuild: CommandLineOption[] = [
555562
},
556563
];
557564

565+
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
566+
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
567+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
568+
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
558569
/** @internal */
559570
export const targetOptionDeclaration: CommandLineOptionOfCustomType = {
560571
name: "target",
@@ -573,6 +584,7 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = {
573584
es2022: ScriptTarget.ES2022,
574585
es2023: ScriptTarget.ES2023,
575586
es2024: ScriptTarget.ES2024,
587+
es2025: ScriptTarget.ES2025,
576588
esnext: ScriptTarget.ESNext,
577589
})),
578590
affectsSourceFile: true,

src/compiler/transformers/esnext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const enum UsingKind {
7171
export function transformESNext(context: TransformationContext): (x: SourceFile | Bundle) => SourceFile | Bundle {
7272
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
7373
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
74-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
74+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
7575
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
7676

7777
const {

src/compiler/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7655,7 +7655,7 @@ export const enum ScriptKind {
76557655

76567656
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
76577657
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
7658-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
7658+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
76597659
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
76607660
export const enum ScriptTarget {
76617661
/** @deprecated */
@@ -7672,10 +7672,11 @@ export const enum ScriptTarget {
76727672
ES2022 = 9,
76737673
ES2023 = 10,
76747674
ES2024 = 11,
7675+
ES2025 = 12,
76757676
ESNext = 99,
76767677
JSON = 100,
76777678
Latest = ESNext,
7678-
LatestStandard = ES2024,
7679+
LatestStandard = ES2025,
76797680
}
76807681

76817682
export const enum LanguageVariant {
@@ -8461,7 +8462,7 @@ export type LanugageFeatures =
84618462
// Upcoming Features
84628463
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
84638464
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
8464-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
8465+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
84658466
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
84668467
| "UsingAndAwaitUsing" // `using x = y`, `await using x = y`
84678468
| "ClassAndClassElementDecorators" // `@dec class C {}`, `class C { @dec m() {} }`

src/compiler/utilities.ts

Lines changed: 39 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,7 +1378,7 @@ export type ScriptTargetFeatures = ReadonlyMap<string, ReadonlyMap<string, strin
13781378

13791379
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
13801380
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
1381-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
1381+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
13821382
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
13831383
/** @internal */
13841384
export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__ */ memoize((): ScriptTargetFeatures =>
@@ -1486,6 +1486,11 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
14861486
"unicodeSets",
14871487
],
14881488
})),
1489+
RegExpConstructor: new Map(Object.entries({
1490+
es2025: [
1491+
"escape",
1492+
],
1493+
})),
14891494
Reflect: new Map(Object.entries({
14901495
es2015: [
14911496
"apply",
@@ -1565,7 +1570,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
15651570
"fround",
15661571
"cbrt",
15671572
],
1568-
esnext: [
1573+
es2025: [
15691574
"f16round",
15701575
],
15711576
})),
@@ -1587,7 +1592,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
15871592
"keys",
15881593
"values",
15891594
],
1590-
esnext: [
1595+
es2025: [
15911596
"union",
15921597
"intersection",
15931598
"difference",
@@ -1613,6 +1618,9 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
16131618
es2024: [
16141619
"withResolvers",
16151620
],
1621+
es2025: [
1622+
"try",
1623+
],
16161624
})),
16171625
Symbol: new Map(Object.entries({
16181626
es2015: [
@@ -1714,6 +1722,21 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
17141722
es2018: [
17151723
"PluralRules",
17161724
],
1725+
es2020: [
1726+
"RelativeTimeFormat",
1727+
"Locale",
1728+
"DisplayNames",
1729+
],
1730+
es2021: [
1731+
"ListFormat",
1732+
"DateTimeFormat",
1733+
],
1734+
es2022: [
1735+
"Segmenter",
1736+
],
1737+
es2025: [
1738+
"DurationFormat",
1739+
],
17171740
})),
17181741
NumberFormat: new Map(Object.entries({
17191742
es2018: [
@@ -1737,7 +1760,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
17371760
"getBigInt64",
17381761
"getBigUint64",
17391762
],
1740-
esnext: [
1763+
es2025: [
17411764
"setFloat16",
17421765
"getFloat16",
17431766
],
@@ -1850,7 +1873,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
18501873
],
18511874
})),
18521875
Float16Array: new Map(Object.entries({
1853-
esnext: emptyArray,
1876+
es2025: emptyArray,
18541877
})),
18551878
Float32Array: new Map(Object.entries({
18561879
es2022: [
@@ -1911,12 +1934,23 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
19111934
"cause",
19121935
],
19131936
})),
1937+
ErrorConstructor: new Map(Object.entries({
1938+
esnext: [
1939+
"isError",
1940+
],
1941+
})),
19141942
Uint8ArrayConstructor: new Map(Object.entries({
19151943
esnext: [
19161944
"fromBase64",
19171945
"fromHex",
19181946
],
19191947
})),
1948+
DisposableStack: new Map(Object.entries({
1949+
esnext: emptyArray,
1950+
})),
1951+
AsyncDisposableStack: new Map(Object.entries({
1952+
esnext: emptyArray,
1953+
})),
19201954
}))
19211955
);
19221956

src/compiler/utilitiesPublic.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,11 @@ export function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics:
307307
/** @internal */
308308
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
309309
// June of each year. This includes changes to `LanguageFeatureMinimumTarget`, `ScriptTarget`,
310-
// `ScriptTargetFeatures` transformers/esnext.ts, compiler/commandLineParser.ts,
310+
// `ScriptTargetFeatures`, `CommandLineOptionOfCustomType`, transformers/esnext.ts, compiler/commandLineParser.ts,
311311
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
312312
export const targetToLibMap: Map<ScriptTarget, string> = new Map([
313313
[ScriptTarget.ESNext, "lib.esnext.full.d.ts"],
314+
[ScriptTarget.ES2025, "lib.es2025.full.d.ts"],
314315
[ScriptTarget.ES2024, "lib.es2024.full.d.ts"],
315316
[ScriptTarget.ES2023, "lib.es2023.full.d.ts"],
316317
[ScriptTarget.ES2022, "lib.es2022.full.d.ts"],
@@ -327,6 +328,7 @@ export function getDefaultLibFileName(options: CompilerOptions): string {
327328
const target = getEmitScriptTarget(options);
328329
switch (target) {
329330
case ScriptTarget.ESNext:
331+
case ScriptTarget.ES2025:
330332
case ScriptTarget.ES2024:
331333
case ScriptTarget.ES2023:
332334
case ScriptTarget.ES2022:

src/lib/es2025.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
/// <reference lib="es2024" />
2+
/// <reference lib="es2025.collection" />
3+
/// <reference lib="es2025.float16" />
4+
/// <reference lib="es2025.intl" />
5+
/// <reference lib="es2025.iterator" />
6+
/// <reference lib="es2025.promise" />
7+
/// <reference lib="es2025.regexp" />

src/lib/es2025.full.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
/// <reference lib="es2025" />
2+
/// <reference lib="dom" />
3+
/// <reference lib="webworker.importscripts" />
4+
/// <reference lib="scripthost" />
5+
/// <reference lib="dom.iterable" />
6+
/// <reference lib="dom.asynciterable" />

0 commit comments

Comments
 (0)