Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
37 changes: 22 additions & 15 deletions src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ const jsxOptionMap = new Map(Object.entries({
export const inverseJsxOptionMap: Map<string, string> = new Map(mapIterator(jsxOptionMap.entries(), ([key, value]: [string, JsxEmit]) => ["" + value, key] as const));

// NOTE: The order here is important to default lib ordering as entries will have the same
// order in the generated program (see `getDefaultLibPriority` in program.ts). This
// order in the generated program (see `getDefaultLibFilePriority` in program.ts). This
// order also affects overload resolution when a type declared in one lib is
// augmented in another lib.
// NOTE: We must reevaluate the target for upcoming features when each successive TC39 edition is ratified in
Expand All @@ -163,6 +163,7 @@ const libEntries: [string, string][] = [
["es2022", "lib.es2022.d.ts"],
["es2023", "lib.es2023.d.ts"],
["es2024", "lib.es2024.d.ts"],
["es2025", "lib.es2025.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
Expand All @@ -173,7 +174,7 @@ const libEntries: [string, string][] = [
["webworker.iterable", "lib.webworker.iterable.d.ts"],
["webworker.asynciterable", "lib.webworker.asynciterable.d.ts"],
["scripthost", "lib.scripthost.d.ts"],
// ES2015 Or ESNext By-feature options
// ES2015 and later By-feature options
["es2015.core", "lib.es2015.core.d.ts"],
["es2015.collection", "lib.es2015.collection.d.ts"],
["es2015.generator", "lib.es2015.generator.d.ts"],
Expand Down Expand Up @@ -230,27 +231,33 @@ const libEntries: [string, string][] = [
["es2024.regexp", "lib.es2024.regexp.d.ts"],
["es2024.sharedmemory", "lib.es2024.sharedmemory.d.ts"],
["es2024.string", "lib.es2024.string.d.ts"],
["esnext.array", "lib.es2023.array.d.ts"],
["esnext.collection", "lib.esnext.collection.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["es2025.collection", "lib.es2025.collection.d.ts"],
["es2025.float16", "lib.es2025.float16.d.ts"],
["es2025.intl", "lib.es2025.intl.d.ts"],
["es2025.iterator", "lib.es2025.iterator.d.ts"],
["es2025.promise", "lib.es2025.promise.d.ts"],
["es2025.regexp", "lib.es2025.regexp.d.ts"],
// Fallback for backward compatibility
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
["esnext.intl", "lib.esnext.intl.d.ts"],
["esnext.disposable", "lib.esnext.disposable.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.bigint", "lib.es2020.bigint.d.ts"],
["esnext.string", "lib.es2022.string.d.ts"],
["esnext.promise", "lib.es2024.promise.d.ts"],
["esnext.weakref", "lib.es2021.weakref.d.ts"],
["esnext.decorators", "lib.esnext.decorators.d.ts"],
["esnext.object", "lib.es2024.object.d.ts"],
["esnext.array", "lib.esnext.array.d.ts"],
["esnext.regexp", "lib.es2024.regexp.d.ts"],
["esnext.string", "lib.es2024.string.d.ts"],
["esnext.iterator", "lib.esnext.iterator.d.ts"],
["esnext.promise", "lib.esnext.promise.d.ts"],
["esnext.float16", "lib.esnext.float16.d.ts"],
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
["esnext.collection", "lib.es2025.collection.d.ts"],
["esnext.float16", "lib.es2025.float16.d.ts"],
["esnext.iterator", "lib.es2025.iterator.d.ts"],
["esnext.promise", "lib.es2025.promise.d.ts"],
// ESNext By-feature options
["esnext.array", "lib.esnext.array.d.ts"],
["esnext.decorators", "lib.esnext.decorators.d.ts"],
["esnext.disposable", "lib.esnext.disposable.d.ts"],
["esnext.error", "lib.esnext.error.d.ts"],
["esnext.intl", "lib.esnext.intl.d.ts"],
["esnext.sharedmemory", "lib.esnext.sharedmemory.d.ts"],
["esnext.typedarrays", "lib.esnext.typedarrays.d.ts"],
Comment on lines +253 to +259
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are none of these applicable to ES2025?

Copy link
Contributor Author

@petamoriken petamoriken Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.

ref: https://github.com/tc39/proposals/blob/main/finished-proposals.md

// Decorators
["decorators", "lib.decorators.d.ts"],
["decorators.legacy", "lib.decorators.legacy.d.ts"],
];
Expand Down
3 changes: 2 additions & 1 deletion src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7672,10 +7672,11 @@ export const enum ScriptTarget {
ES2022 = 9,
ES2023 = 10,
ES2024 = 11,
ES2025 = 12,
ESNext = 99,
JSON = 100,
Latest = ESNext,
LatestStandard = ES2024,
LatestStandard = ES2025,
}

export const enum LanguageVariant {
Expand Down
42 changes: 38 additions & 4 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,11 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
"unicodeSets",
],
})),
RegExpConstructor: new Map(Object.entries({
es2025: [
"escape",
],
})),
Reflect: new Map(Object.entries({
es2015: [
"apply",
Expand Down Expand Up @@ -1565,7 +1570,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
"fround",
"cbrt",
],
esnext: [
es2025: [
"f16round",
],
})),
Expand All @@ -1587,7 +1592,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
"keys",
"values",
],
esnext: [
es2025: [
"union",
"intersection",
"difference",
Expand All @@ -1613,6 +1618,9 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
es2024: [
"withResolvers",
],
es2025: [
"try",
],
})),
Symbol: new Map(Object.entries({
es2015: [
Expand Down Expand Up @@ -1714,6 +1722,21 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
es2018: [
"PluralRules",
],
es2020: [
"RelativeTimeFormat",
"Locale",
"DisplayNames",
],
es2021: [
"ListFormat",
"DateTimeFormat",
],
es2022: [
"Segmenter",
],
es2025: [
"DurationFormat",
],
})),
NumberFormat: new Map(Object.entries({
es2018: [
Expand All @@ -1737,7 +1760,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
"getBigInt64",
"getBigUint64",
],
esnext: [
es2025: [
"setFloat16",
"getFloat16",
],
Expand Down Expand Up @@ -1850,7 +1873,7 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
],
})),
Float16Array: new Map(Object.entries({
esnext: emptyArray,
es2025: emptyArray,
})),
Float32Array: new Map(Object.entries({
es2022: [
Expand Down Expand Up @@ -1911,12 +1934,23 @@ export const getScriptTargetFeatures: () => ScriptTargetFeatures = /* @__PURE__
"cause",
],
})),
ErrorConstructor: new Map(Object.entries({
esnext: [
"isError",
],
})),
Uint8ArrayConstructor: new Map(Object.entries({
esnext: [
"fromBase64",
"fromHex",
],
})),
DisposableStack: new Map(Object.entries({
esnext: emptyArray,
})),
AsyncDisposableStack: new Map(Object.entries({
esnext: emptyArray,
})),
}))
);

Expand Down
1 change: 1 addition & 0 deletions src/compiler/utilitiesPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,7 @@ export function sortAndDeduplicateDiagnostics<T extends Diagnostic>(diagnostics:
// compiler/utilitiesPublic.ts, and the contents of each lib/esnext.*.d.ts file.
export const targetToLibMap: Map<ScriptTarget, string> = new Map([
[ScriptTarget.ESNext, "lib.esnext.full.d.ts"],
[ScriptTarget.ES2025, "lib.es2025.full.d.ts"],
[ScriptTarget.ES2024, "lib.es2024.full.d.ts"],
[ScriptTarget.ES2023, "lib.es2023.full.d.ts"],
[ScriptTarget.ES2022, "lib.es2022.full.d.ts"],
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions src/lib/es2025.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/// <reference lib="es2024" />
/// <reference lib="es2025.collection" />
/// <reference lib="es2025.float16" />
/// <reference lib="es2025.intl" />
/// <reference lib="es2025.iterator" />
/// <reference lib="es2025.promise" />
/// <reference lib="es2025.regexp" />
File renamed without changes.
6 changes: 6 additions & 0 deletions src/lib/es2025.full.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference lib="es2025" />
/// <reference lib="dom" />
/// <reference lib="webworker.importscripts" />
/// <reference lib="scripthost" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not strictly required anymore (for any of the libs), but not a problem in this PR; can be cleaned up later.

185 changes: 185 additions & 0 deletions src/lib/es2025.intl.d.ts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My main concern with this file is the defined unions they don't entirely match the pattern of inlining things like in existing intl or the original es5 types.

Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
declare namespace Intl {
type DurationTimeFormatLocaleMatcher = "lookup" | "best fit";
/**
* Value of the `unit` property in duration objects
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration).
*/
type DurationTimeFormatUnit =
Comment on lines +2 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do these start with DurationTimeFormat, but the others are DurationFormat?

| "years"
| "months"
| "weeks"
| "days"
| "hours"
| "minutes"
| "seconds"
| "milliseconds"
| "microseconds"
| "nanoseconds";

/**
* The style of the formatted duration.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#style).
*/
type DurationFormatStyle = "long" | "short" | "narrow" | "digital";

type DurationFormatUnitSingular =
| "year"
| "quarter"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "quarter" real?

| "month"
| "week"
| "day"
| "hour"
| "minute"
| "second";

/**
* An object representing the relative time format in parts
* that can be used for custom locale-aware formatting.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts#examples).
*/
type DurationFormatPart =
| {
type: "literal";
value: string;
}
| {
type: Exclude<NumberFormatPartTypes, "literal">;
value: string;
unit: DurationFormatUnitSingular;
};

type DurationFormatOption =
| "long"
| "short"
| "narrow"
| "numeric"
| "2-digit";

type DurationFormatDisplayOption = "always" | "auto";

/**
* Number of how many fractional second digits to display in the output.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat#fractionaldigits).
*/
type fractionalDigitsOption = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inline this type; it shouldn't be lowercase anyway.


interface ResolvedDurationFormatOptions {
locale?: UnicodeBCP47LocaleIdentifier;
numberingSystem?: DateTimeFormatOptions["numberingSystem"];
style?: DurationFormatStyle;
years?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
yearsDisplay?: DurationFormatDisplayOption;
months?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
monthsDisplay?: DurationFormatDisplayOption;
weeks?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
weeksDisplay?: DurationFormatDisplayOption;
days?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
daysDisplay?: DurationFormatDisplayOption;
hours?: DurationFormatOptions;
hoursDisplay?: DurationFormatDisplayOption;
minutes?: DurationFormatOptions;
minutesDisplay?: DurationFormatDisplayOption;
seconds?: DurationFormatOptions;
secondsDisplay?: DurationFormatDisplayOption;
milliseconds?: DurationFormatOptions;
millisecondsDisplay?: DurationFormatDisplayOption;
microseconds?: DurationFormatOptions;
microsecondsDisplay?: DurationFormatDisplayOption;
nanoseconds?: DurationFormatOptions;
nanosecondsDisplay?: DurationFormatDisplayOption;
fractionalDigits?: fractionalDigitsOption;
Comment on lines +71 to +94
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options don't appear to be resolved; I think they should omit the ?.

}

interface DurationFormatOptions {
localeMatcher?: DurationTimeFormatLocaleMatcher;
numberingSystem?: DateTimeFormatOptions["numberingSystem"];
style?: DurationFormatStyle;
years?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
yearsDisplay?: DurationFormatDisplayOption;
months?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
monthsDisplay?: DurationFormatDisplayOption;
weeks?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
weeksDisplay?: DurationFormatDisplayOption;
days?: Exclude<DurationFormatOption, "numeric" | "2-digit">;
daysDisplay?: DurationFormatDisplayOption;
hours?: DurationFormatOption;
hoursDisplay?: DurationFormatDisplayOption;
minutes?: DurationFormatOption;
minutesDisplay?: DurationFormatDisplayOption;
seconds?: DurationFormatOption;
secondsDisplay?: DurationFormatDisplayOption;
milliseconds?: DurationFormatOption;
millisecondsDisplay?: DurationFormatDisplayOption;
microseconds?: DurationFormatOption;
microsecondsDisplay?: DurationFormatDisplayOption;
nanoseconds?: DurationFormatOption;
nanosecondsDisplay?: DurationFormatDisplayOption;
fractionalDigits?: fractionalDigitsOption;
}

/**
* The duration object to be formatted
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format#duration).
*/
type DurationType = Partial<Record<DurationTimeFormatUnit, number>>;

interface DurationFormat {
/**
* @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/format).
*/
format(duration: DurationType): string;
/**
* @param duration The duration object to be formatted. It should include some or all of the following properties: months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, nanoseconds.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/formatToParts).
*/
formatToParts(duration: DurationType): DurationFormatPart[];
/**
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/resolvedOptions).
*/
resolvedOptions(): ResolvedDurationFormatOptions;
}

const DurationFormat: {
prototype: DurationFormat;

/**
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object for setting up a duration format.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/DurationFormat).
*/
new (
locales?: LocalesArgument,
options?: DurationFormatOptions,
): DurationFormat;

/**
* Returns an array containing those of the provided locales that are supported in display names without having to fall back to the runtime's default locale.
*
* @param locales A string with a BCP 47 language tag, or an array of such strings.
* For the general form and interpretation of the `locales` argument, see the [Intl](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl#locale_identification_and_negotiation)
* page.
*
* @param options An object with a locale matcher.
*
* @returns An array of strings representing a subset of the given locale tags that are supported in display names without having to fall back to the runtime's default locale.
*
* [MDN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Intl/DurationFormat/supportedLocalesOf).
*/
supportedLocalesOf(
locales?: LocalesArgument,
options?: { localeMatcher?: DurationTimeFormatLocaleMatcher; },
): UnicodeBCP47LocaleIdentifier[];
};
}
File renamed without changes.
File renamed without changes.
Loading
Loading