Skip to content

Commit 3ff5b2f

Browse files
committed
Merge branch 'main' into feat/es2025-target
2 parents e86a117 + 95e3aaa commit 3ff5b2f

File tree

27,908 files changed

+501675
-171968
lines changed

Some content is hidden

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

27,908 files changed

+501675
-171968
lines changed

scripts/dtsBundler.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function getDeclarationStatement(node) {
7373
return undefined;
7474
}
7575

76-
const program = ts.createProgram([entrypoint], { target: ts.ScriptTarget.ES5 });
76+
const program = ts.createProgram([entrypoint], { target: ts.ScriptTarget.ES2015 });
7777

7878
const typeChecker = program.getTypeChecker();
7979

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45619,7 +45619,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4561945619
return undefined;
4562045620
}
4562145621

45622-
const uplevelIteration = languageVersion >= ScriptTarget.ES2015;
45622+
const iterableExists = getGlobalIterableType(/*reportErrors*/ false) !== emptyGenericType;
45623+
const uplevelIteration = languageVersion >= ScriptTarget.ES2015 && iterableExists;
4562345624
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
4562445625
const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & IterationUse.PossiblyOutOfBounds);
4562545626

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,12 +586,12 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = {
586586
affectsModuleResolution: true,
587587
affectsEmit: true,
588588
affectsBuildInfo: true,
589-
deprecatedKeys: new Set(["es3"]),
589+
deprecatedKeys: new Set(["es3", "es5"]),
590590
paramType: Diagnostics.VERSION,
591591
showInSimplifiedHelpView: true,
592592
category: Diagnostics.Language_and_Environment,
593593
description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
594-
defaultValueDescription: ScriptTarget.ES5,
594+
defaultValueDescription: ScriptTarget.LatestStandard,
595595
};
596596

597597
/** @internal */

src/compiler/factory/nodeFactory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6052,7 +6052,7 @@ export function createNodeFactory(flags: NodeFactoryFlags, baseFactory: BaseNode
60526052
node.path = "" as Path;
60536053
node.resolvedPath = "" as Path;
60546054
node.originalFileName = "";
6055-
node.languageVersion = ScriptTarget.ES5;
6055+
node.languageVersion = ScriptTarget.LatestStandard;
60566056
node.languageVariant = 0;
60576057
node.scriptKind = 0;
60586058
node.isDeclarationFile = false;

src/compiler/program.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4526,6 +4526,9 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
45264526
});
45274527

45284528
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
4529+
if (options.target === ScriptTarget.ES5) {
4530+
createDeprecatedDiagnostic("target", "ES5");
4531+
}
45294532
if (options.moduleResolution === ModuleResolutionKind.Node10) {
45304533
createDeprecatedDiagnostic("moduleResolution", "node10", /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
45314534
}

src/compiler/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7659,6 +7659,7 @@ export const enum ScriptKind {
76597659
export const enum ScriptTarget {
76607660
/** @deprecated */
76617661
ES3 = 0,
7662+
/** @deprecated */
76627663
ES5 = 1,
76637664
ES2015 = 2,
76647665
ES2016 = 3,
@@ -7674,6 +7675,7 @@ export const enum ScriptTarget {
76747675
ESNext = 99,
76757676
JSON = 100,
76767677
Latest = ESNext,
7678+
LatestStandard = ES2024,
76777679
}
76787680

76797681
export const enum LanguageVariant {

src/compiler/utilities.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9025,15 +9025,10 @@ const _computedOptions = createComputedCompilerOptions({
90259025
},
90269026
},
90279027
target: {
9028-
dependencies: ["module"],
9028+
dependencies: [],
90299029
computeValue: compilerOptions => {
90309030
const target = compilerOptions.target === ScriptTarget.ES3 ? undefined : compilerOptions.target;
9031-
return target ??
9032-
((compilerOptions.module === ModuleKind.Node16 && ScriptTarget.ES2022) ||
9033-
(compilerOptions.module === ModuleKind.Node18 && ScriptTarget.ES2022) ||
9034-
(compilerOptions.module === ModuleKind.Node20 && ScriptTarget.ES2023) ||
9035-
(compilerOptions.module === ModuleKind.NodeNext && ScriptTarget.ESNext) ||
9036-
ScriptTarget.ES5);
9031+
return target ?? ScriptTarget.LatestStandard;
90379032
},
90389033
},
90399034
module: {

src/harness/evaluatorImpl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export function evaluateTypeScript(source: string | { files: vfs.FileSet; rootFi
4141
module: ts.ModuleKind.CommonJS,
4242
strict: false,
4343
lib: ["lib.esnext.d.ts", "lib.dom.d.ts"],
44+
ignoreDeprecations: "6.0",
4445
...options,
4546
};
4647
const host = new fakes.CompilerHost(fs, compilerOptions);

src/server/protocol.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,6 +3288,7 @@ export const enum NewLineKind {
32883288
export const enum ScriptTarget {
32893289
/** @deprecated */
32903290
ES3 = "es3",
3291+
/** @deprecated */
32913292
ES5 = "es5",
32923293
ES6 = "es6",
32933294
ES2015 = "es2015",
@@ -3304,6 +3305,7 @@ export const enum ScriptTarget {
33043305
ESNext = "esnext",
33053306
JSON = "json",
33063307
Latest = ESNext,
3308+
LatestStandard = ES2024,
33073309
}
33083310

33093311
{

src/services/preProcess.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515

1616
export function preProcessFile(sourceText: string, readImportFiles = true, detectJavaScriptImports = false): PreProcessedFileInfo {
1717
const pragmaContext: PragmaContext = {
18-
languageVersion: ScriptTarget.ES5, // controls whether the token scanner considers unicode identifiers or not - shouldn't matter, since we're only using it for trivia
18+
languageVersion: ScriptTarget.LatestStandard, // controls whether the token scanner considers unicode identifiers or not - shouldn't matter, since we're only using it for trivia
1919
pragmas: undefined,
2020
checkJsDirective: undefined,
2121
referencedFiles: [],

0 commit comments

Comments
 (0)