Skip to content

Commit edd40b2

Browse files
authored
Merge branch 'main' into fix/enum-computed-keys
2 parents 415baaa + e018d8c commit edd40b2

File tree

2,343 files changed

+36576
-34081
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,343 files changed

+36576
-34081
lines changed

src/compiler/checker.ts

Lines changed: 459 additions & 22 deletions
Large diffs are not rendered by default.

src/compiler/commandLineParser.ts

Lines changed: 38 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.float16", "lib.es2025.float16.d.ts"],
249+
["esnext.iterator", "lib.es2025.iterator.d.ts"],
250+
["esnext.promise", "lib.es2025.promise.d.ts"],
251+
// ESNext By-feature options
252+
["esnext.array", "lib.esnext.array.d.ts"],
253+
["esnext.collection", "lib.esnext.collection.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,
@@ -961,6 +973,16 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
961973
description: Diagnostics.Built_in_iterators_are_instantiated_with_a_TReturn_type_of_undefined_instead_of_any,
962974
defaultValueDescription: Diagnostics.true_unless_strict_is_false,
963975
},
976+
{
977+
name: "stableTypeOrdering",
978+
type: "boolean",
979+
affectsSemanticDiagnostics: true,
980+
affectsBuildInfo: true,
981+
showInHelp: false,
982+
category: Diagnostics.Type_Checking,
983+
description: Diagnostics.Ensure_types_are_ordered_stably_and_deterministically_across_compilations,
984+
defaultValueDescription: false,
985+
},
964986
{
965987
name: "noImplicitThis",
966988
type: "boolean",

src/compiler/core.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,7 +1209,7 @@ export function binarySearchKey<T, U>(array: readonly T[], key: U, keySelector:
12091209
while (low <= high) {
12101210
const middle = low + ((high - low) >> 1);
12111211
const midKey = keySelector(array[middle], middle);
1212-
switch (keyComparer(midKey, key)) {
1212+
switch (Math.sign(keyComparer(midKey, key))) {
12131213
case Comparison.LessThan:
12141214
low = middle + 1;
12151215
break;
@@ -1967,9 +1967,11 @@ export function equateStringsCaseSensitive(a: string, b: string): boolean {
19671967
return equateValues(a, b);
19681968
}
19691969

1970-
function compareComparableValues(a: string | undefined, b: string | undefined): Comparison;
1971-
function compareComparableValues(a: number | undefined, b: number | undefined): Comparison;
1972-
function compareComparableValues(a: string | number | undefined, b: string | number | undefined) {
1970+
/** @internal */
1971+
export function compareComparableValues(a: string | undefined, b: string | undefined): Comparison;
1972+
/** @internal */
1973+
export function compareComparableValues(a: number | undefined, b: number | undefined): Comparison;
1974+
export function compareComparableValues(a: string | number | undefined, b: string | number | undefined) {
19731975
return a === b ? Comparison.EqualTo :
19741976
a === undefined ? Comparison.LessThan :
19751977
b === undefined ? Comparison.GreaterThan :

src/compiler/diagnosticMessages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6589,6 +6589,10 @@
65896589
"category": "Message",
65906590
"code": 6808
65916591
},
6592+
"Ensure types are ordered stably and deterministically across compilations.": {
6593+
"category": "Message",
6594+
"code": 6809
6595+
},
65926596

65936597
"one of:": {
65946598
"category": "Message",

src/compiler/executeCommandLine.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,11 @@ function shouldBePretty(sys: System, options: CompilerOptions | BuildOptions) {
174174
}
175175

176176
function getOptionsForHelp(commandLine: ParsedCommandLine) {
177+
const helpOptions = filter(optionDeclarations.concat(tscBuildOption), option => option.showInHelp !== false);
177178
// Sort our options by their names, (e.g. "--noImplicitAny" comes before "--watch")
178179
return !!commandLine.options.all ?
179-
toSorted(optionDeclarations.concat(tscBuildOption), (a, b) => compareStringsCaseInsensitive(a.name, b.name)) :
180-
filter(optionDeclarations.concat(tscBuildOption), v => !!v.showInSimplifiedHelpView);
180+
toSorted(helpOptions, (a, b) => compareStringsCaseInsensitive(a.name, b.name)) :
181+
filter(helpOptions, v => !!v.showInSimplifiedHelpView);
181182
}
182183

183184
function printVersion(sys: System) {
@@ -512,16 +513,16 @@ function printEasyHelp(sys: System, simpleOptions: readonly CommandLineOption[])
512513
function printAllHelp(sys: System, compilerOptions: readonly CommandLineOption[], buildOptions: readonly CommandLineOption[], watchOptions: readonly CommandLineOption[]) {
513514
let output: string[] = [...getHeader(sys, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
514515
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.ALL_COMPILER_OPTIONS), compilerOptions, /*subCategory*/ true, /*beforeOptionsDescription*/ undefined, formatMessage(Diagnostics.You_can_learn_about_all_of_the_compiler_options_at_0, "https://aka.ms/tsc"))];
515-
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.WATCH_OPTIONS), watchOptions, /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))];
516-
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, option => option !== tscBuildOption), /*subCategory*/ false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
516+
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.WATCH_OPTIONS), filter(watchOptions, option => option.showInHelp !== false), /*subCategory*/ false, getDiagnosticText(Diagnostics.Including_watch_w_will_start_watching_the_current_project_for_the_file_changes_Once_set_you_can_config_watch_mode_with_Colon))];
517+
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, option => option !== tscBuildOption && option.showInHelp !== false), /*subCategory*/ false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
517518
for (const line of output) {
518519
sys.write(line);
519520
}
520521
}
521522

522523
function printBuildHelp(sys: System, buildOptions: readonly CommandLineOption[]) {
523524
let output: string[] = [...getHeader(sys, `${getDiagnosticText(Diagnostics.tsc_Colon_The_TypeScript_Compiler)} - ${getDiagnosticText(Diagnostics.Version_0, version)}`)];
524-
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, option => option !== tscBuildOption), /*subCategory*/ false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
525+
output = [...output, ...generateSectionOptionsOutput(sys, getDiagnosticText(Diagnostics.BUILD_OPTIONS), filter(buildOptions, option => option !== tscBuildOption && option.showInHelp !== false), /*subCategory*/ false, formatMessage(Diagnostics.Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_trigger_building_composite_projects_which_you_can_learn_more_about_at_0, "https://aka.ms/tsc-composite-builds"))];
525526
for (const line of output) {
526527
sys.write(line);
527528
}

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 {

0 commit comments

Comments
 (0)