Skip to content

Commit 46c6b0c

Browse files
committed
merge w/ main
2 parents 5dc64a2 + 022800b commit 46c6b0c

19,965 files changed

Lines changed: 233970 additions & 124330 deletions

File tree

Some content is hidden

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

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ jobs:
211211
node-version: 'lts/*'
212212
- run: npm ci
213213

214-
- uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
214+
- uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
215215
with:
216216
path: ~/.cache/dprint
217217
key: ${{ runner.os }}-dprint-${{ hashFiles('package-lock.json', '.dprint.jsonc') }}

.github/workflows/codeql.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
# Initializes the CodeQL tools for scanning.
4848
- name: Initialize CodeQL
49-
uses: github/codeql-action/init@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
49+
uses: github/codeql-action/init@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
5050
with:
5151
config-file: ./.github/codeql/codeql-configuration.yml
5252
# Override language selection by uncommenting this and choosing your languages
@@ -56,7 +56,7 @@ jobs:
5656
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5757
# If this step fails, then you should remove it and run the build manually (see below).
5858
- name: Autobuild
59-
uses: github/codeql-action/autobuild@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
59+
uses: github/codeql-action/autobuild@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
6060

6161
# ℹ️ Command-line programs to run using the OS shell.
6262
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -70,4 +70,4 @@ jobs:
7070
# make release
7171

7272
- name: Perform CodeQL Analysis
73-
uses: github/codeql-action/analyze@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
73+
uses: github/codeql-action/analyze@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0

.github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ jobs:
5555

5656
# Upload the results to GitHub's code scanning dashboard.
5757
- name: 'Upload to code-scanning'
58-
uses: github/codeql-action/upload-sarif@19b2f06db2b6f5108140aeb04014ef02b648f789 # v4.31.11
58+
uses: github/codeql-action/upload-sarif@b20883b0cd1f46c72ae0ba6d1090936928f9fa30 # v4.32.0
5959
with:
6060
sarif_file: results.sarif

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/binder.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ import {
8282
FunctionExpression,
8383
FunctionLikeDeclaration,
8484
GetAccessorDeclaration,
85+
getAlwaysStrict,
8586
getAssignedExpandoInitializer,
8687
getAssignmentDeclarationKind,
8788
getAssignmentDeclarationPropertyAccessKind,
@@ -108,7 +109,6 @@ import {
108109
getSourceFileOfNode,
109110
getSourceTextOfNodeFromSourceFile,
110111
getSpanOfTokenAtPosition,
111-
getStrictOptionValue,
112112
getSymbolNameForPrivateIdentifier,
113113
getTextOfIdentifierOrLiteral,
114114
getThisContainer,
@@ -488,6 +488,7 @@ export const enum ContainerFlags {
488488
HasLocals = 1 << 5,
489489
IsInterface = 1 << 6,
490490
IsObjectLiteralOrClassExpressionMethodOrAccessor = 1 << 7,
491+
PropagatesThisKeyword = 1 << 8,
491492
}
492493

493494
/** @internal */
@@ -617,7 +618,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
617618
}
618619

619620
function bindInStrictMode(file: SourceFile, opts: CompilerOptions): boolean {
620-
if (getStrictOptionValue(opts, "alwaysStrict") && !file.isDeclarationFile) {
621+
if (getAlwaysStrict(opts) && !file.isDeclarationFile) {
621622
// bind in strict mode source files with alwaysStrict option
622623
return true;
623624
}
@@ -1055,7 +1056,7 @@ function createBinder(): (file: SourceFile, options: CompilerOptions) => void {
10551056
currentExceptionTarget = saveExceptionTarget;
10561057
activeLabelList = saveActiveLabelList;
10571058
hasExplicitReturn = saveHasExplicitReturn;
1058-
seenThisKeyword = node.kind === SyntaxKind.ArrowFunction ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
1059+
seenThisKeyword = containerFlags & ContainerFlags.PropagatesThisKeyword ? saveSeenThisKeyword || seenThisKeyword : saveSeenThisKeyword;
10591060
}
10601061
else if (containerFlags & ContainerFlags.IsInterface) {
10611062
const saveSeenThisKeyword = seenThisKeyword;
@@ -3845,23 +3846,26 @@ export function getContainerFlags(node: Node): ContainerFlags {
38453846
case SyntaxKind.FunctionDeclaration:
38463847
case SyntaxKind.ClassStaticBlockDeclaration:
38473848
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;
3849+
38483850
case SyntaxKind.MethodSignature:
38493851
case SyntaxKind.CallSignature:
38503852
case SyntaxKind.JSDocSignature:
38513853
case SyntaxKind.JSDocFunctionType:
38523854
case SyntaxKind.FunctionType:
38533855
case SyntaxKind.ConstructSignature:
38543856
case SyntaxKind.ConstructorType:
3855-
return ContainerFlags.IsContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike;
3857+
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike | ContainerFlags.PropagatesThisKeyword;
38563858

38573859
case SyntaxKind.JSDocImportTag:
38583860
// treat as a container to prevent using an enclosing effective host, ensuring import bindings are scoped correctly
3859-
return ContainerFlags.IsContainer | ContainerFlags.HasLocals;
3861+
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.PropagatesThisKeyword;
38603862

38613863
case SyntaxKind.FunctionExpression:
3862-
case SyntaxKind.ArrowFunction:
38633864
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike | ContainerFlags.IsFunctionExpression;
38643865

3866+
case SyntaxKind.ArrowFunction:
3867+
return ContainerFlags.IsContainer | ContainerFlags.IsControlFlowContainer | ContainerFlags.HasLocals | ContainerFlags.IsFunctionLike | ContainerFlags.IsFunctionExpression | ContainerFlags.PropagatesThisKeyword;
3868+
38653869
case SyntaxKind.ModuleBlock:
38663870
return ContainerFlags.IsControlFlowContainer;
38673871

src/compiler/checker.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6776,7 +6776,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
67766776
return parentName;
67776777
}
67786778
const memberName = symbolName(type.symbol);
6779-
if (isIdentifierText(memberName, ScriptTarget.ES5)) {
6779+
if (isIdentifierText(memberName, ScriptTarget.ESNext)) {
67806780
return appendReferenceToType(
67816781
parentName as TypeReferenceNode | ImportTypeNode,
67826782
factory.createTypeReferenceNode(memberName, /*typeArguments*/ undefined),
@@ -45637,7 +45637,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4563745637
return undefined;
4563845638
}
4563945639

45640-
const uplevelIteration = languageVersion >= ScriptTarget.ES2015;
45640+
const iterableExists = getGlobalIterableType(/*reportErrors*/ false) !== emptyGenericType;
45641+
const uplevelIteration = languageVersion >= ScriptTarget.ES2015 && iterableExists;
4564145642
const downlevelIteration = !uplevelIteration && compilerOptions.downlevelIteration;
4564245643
const possibleOutOfBounds = compilerOptions.noUncheckedIndexedAccess && !!(use & IterationUse.PossiblyOutOfBounds);
4564345644

@@ -46789,7 +46790,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4678946790
*/
4679046791
function checkClassNameCollisionWithObject(name: Identifier): void {
4679146792
if (
46792-
languageVersion >= ScriptTarget.ES5 && name.escapedText === "Object"
46793+
name.escapedText === "Object"
4679346794
&& host.getEmitModuleFormatOfFile(getSourceFileOfNode(name)) < ModuleKind.ES2015
4679446795
) {
4679546796
error(name, Diagnostics.Class_name_cannot_be_Object_when_targeting_ES5_and_above_with_module_0, ModuleKind[moduleKind]); // https://github.com/Microsoft/TypeScript/issues/17494
@@ -48569,6 +48570,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4856948570
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
4857048571
}
4857148572

48573+
if (!isImportAttributes && compilerOptions.ignoreDeprecations !== "6.0") {
48574+
grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
48575+
}
48576+
4857248577
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === ModuleKind.CommonJS) {
4857348578
return grammarErrorOnNode(
4857448579
node,

src/compiler/commandLineParser.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,12 @@ export const targetOptionDeclaration: CommandLineOptionOfCustomType = {
579579
affectsModuleResolution: true,
580580
affectsEmit: true,
581581
affectsBuildInfo: true,
582-
deprecatedKeys: new Set(["es3"]),
582+
deprecatedKeys: new Set(["es3", "es5"]),
583583
paramType: Diagnostics.VERSION,
584584
showInSimplifiedHelpView: true,
585585
category: Diagnostics.Language_and_Environment,
586586
description: Diagnostics.Set_the_JavaScript_language_version_for_emitted_JavaScript_and_include_compatible_library_declarations,
587-
defaultValueDescription: ScriptTarget.ES5,
587+
defaultValueDescription: ScriptTarget.LatestStandard,
588588
};
589589

590590
/** @internal */
@@ -899,7 +899,7 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
899899
showInSimplifiedHelpView: true,
900900
category: Diagnostics.Type_Checking,
901901
description: Diagnostics.Enable_all_strict_type_checking_options,
902-
defaultValueDescription: false,
902+
defaultValueDescription: true,
903903
},
904904
{
905905
name: "noImplicitAny",
@@ -987,10 +987,9 @@ const commandOptionsWithoutBuild: CommandLineOption[] = [
987987
affectsSourceFile: true,
988988
affectsEmit: true,
989989
affectsBuildInfo: true,
990-
strictFlag: true,
991990
category: Diagnostics.Type_Checking,
992991
description: Diagnostics.Ensure_use_strict_is_always_emitted,
993-
defaultValueDescription: Diagnostics.false_unless_strict_is_set,
992+
defaultValueDescription: true,
994993
},
995994

996995
// Additional Checks

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2625,7 +2625,7 @@ export function createPrinter(printerOptions: PrinterOptions = {}, handlers: Pri
26252625
}
26262626

26272627
const preferNewLine = node.multiLine ? ListFormat.PreferNewLine : ListFormat.None;
2628-
const allowTrailingComma = currentSourceFile && currentSourceFile.languageVersion >= ScriptTarget.ES5 && !isJsonSourceFile(currentSourceFile) ? ListFormat.AllowTrailingComma : ListFormat.None;
2628+
const allowTrailingComma = currentSourceFile && !isJsonSourceFile(currentSourceFile) ? ListFormat.AllowTrailingComma : ListFormat.None;
26292629
emitList(node, node.properties, ListFormat.ObjectLiteralExpressionProperties | allowTrailingComma | preferNewLine);
26302630

26312631
if (indentedFlag) {

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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4526,6 +4526,12 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
45264526
});
45274527

45284528
checkDeprecations("6.0", "7.0", createDiagnostic, createDeprecatedDiagnostic => {
4529+
if (options.alwaysStrict === false) {
4530+
createDeprecatedDiagnostic("alwaysStrict", "false", /*useInstead*/ undefined, /*related*/ undefined);
4531+
}
4532+
if (options.target === ScriptTarget.ES5) {
4533+
createDeprecatedDiagnostic("target", "ES5");
4534+
}
45294535
if (options.moduleResolution === ModuleResolutionKind.Node10) {
45304536
createDeprecatedDiagnostic("moduleResolution", "node10", /*useInstead*/ undefined, Diagnostics.Visit_https_Colon_Slash_Slashaka_ms_Slashts6_for_migration_information);
45314537
}

0 commit comments

Comments
 (0)