typescript 5.7.0-dev.20240820 → 5.7.0-dev.20240822
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cs/diagnosticMessages.generated.json +6 -0
- package/lib/de/diagnosticMessages.generated.json +6 -0
- package/lib/es/diagnosticMessages.generated.json +6 -0
- package/lib/fr/diagnosticMessages.generated.json +6 -0
- package/lib/it/diagnosticMessages.generated.json +6 -0
- package/lib/ja/diagnosticMessages.generated.json +6 -0
- package/lib/ko/diagnosticMessages.generated.json +6 -0
- package/lib/pl/diagnosticMessages.generated.json +6 -0
- package/lib/pt-br/diagnosticMessages.generated.json +6 -0
- package/lib/ru/diagnosticMessages.generated.json +6 -0
- package/lib/tr/diagnosticMessages.generated.json +6 -0
- package/lib/tsc.js +108 -16
- package/lib/typescript.js +167 -118
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +6 -0
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.7";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240822`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -17134,6 +17134,9 @@ function accessKind(node) {
|
|
|
17134
17134
|
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
|
|
17135
17135
|
case 209 /* ArrayLiteralExpression */:
|
|
17136
17136
|
return accessKind(parent);
|
|
17137
|
+
case 249 /* ForInStatement */:
|
|
17138
|
+
case 250 /* ForOfStatement */:
|
|
17139
|
+
return node === parent.initializer ? 1 /* Write */ : 0 /* Read */;
|
|
17137
17140
|
default:
|
|
17138
17141
|
return 0 /* Read */;
|
|
17139
17142
|
}
|
|
@@ -19522,6 +19525,75 @@ function isSideEffectImport(node) {
|
|
|
19522
19525
|
const ancestor = findAncestor(node, isImportDeclaration);
|
|
19523
19526
|
return !!ancestor && !ancestor.importClause;
|
|
19524
19527
|
}
|
|
19528
|
+
var unprefixedNodeCoreModulesList = [
|
|
19529
|
+
"assert",
|
|
19530
|
+
"assert/strict",
|
|
19531
|
+
"async_hooks",
|
|
19532
|
+
"buffer",
|
|
19533
|
+
"child_process",
|
|
19534
|
+
"cluster",
|
|
19535
|
+
"console",
|
|
19536
|
+
"constants",
|
|
19537
|
+
"crypto",
|
|
19538
|
+
"dgram",
|
|
19539
|
+
"diagnostics_channel",
|
|
19540
|
+
"dns",
|
|
19541
|
+
"dns/promises",
|
|
19542
|
+
"domain",
|
|
19543
|
+
"events",
|
|
19544
|
+
"fs",
|
|
19545
|
+
"fs/promises",
|
|
19546
|
+
"http",
|
|
19547
|
+
"http2",
|
|
19548
|
+
"https",
|
|
19549
|
+
"inspector",
|
|
19550
|
+
"inspector/promises",
|
|
19551
|
+
"module",
|
|
19552
|
+
"net",
|
|
19553
|
+
"os",
|
|
19554
|
+
"path",
|
|
19555
|
+
"path/posix",
|
|
19556
|
+
"path/win32",
|
|
19557
|
+
"perf_hooks",
|
|
19558
|
+
"process",
|
|
19559
|
+
"punycode",
|
|
19560
|
+
"querystring",
|
|
19561
|
+
"readline",
|
|
19562
|
+
"readline/promises",
|
|
19563
|
+
"repl",
|
|
19564
|
+
"stream",
|
|
19565
|
+
"stream/consumers",
|
|
19566
|
+
"stream/promises",
|
|
19567
|
+
"stream/web",
|
|
19568
|
+
"string_decoder",
|
|
19569
|
+
"sys",
|
|
19570
|
+
"test/mock_loader",
|
|
19571
|
+
"timers",
|
|
19572
|
+
"timers/promises",
|
|
19573
|
+
"tls",
|
|
19574
|
+
"trace_events",
|
|
19575
|
+
"tty",
|
|
19576
|
+
"url",
|
|
19577
|
+
"util",
|
|
19578
|
+
"util/types",
|
|
19579
|
+
"v8",
|
|
19580
|
+
"vm",
|
|
19581
|
+
"wasi",
|
|
19582
|
+
"worker_threads",
|
|
19583
|
+
"zlib"
|
|
19584
|
+
];
|
|
19585
|
+
var unprefixedNodeCoreModules = new Set(unprefixedNodeCoreModulesList);
|
|
19586
|
+
var exclusivelyPrefixedNodeCoreModules = /* @__PURE__ */ new Set([
|
|
19587
|
+
"node:sea",
|
|
19588
|
+
"node:sqlite",
|
|
19589
|
+
"node:test",
|
|
19590
|
+
"node:test/reporters"
|
|
19591
|
+
]);
|
|
19592
|
+
var nodeCoreModules = /* @__PURE__ */ new Set([
|
|
19593
|
+
...unprefixedNodeCoreModulesList,
|
|
19594
|
+
...unprefixedNodeCoreModulesList.map((name) => `node:${name}`),
|
|
19595
|
+
...exclusivelyPrefixedNodeCoreModules
|
|
19596
|
+
]);
|
|
19525
19597
|
|
|
19526
19598
|
// src/compiler/factory/baseNodeFactory.ts
|
|
19527
19599
|
function createBaseNodeFactory() {
|
|
@@ -69774,6 +69846,12 @@ function createTypeChecker(host) {
|
|
|
69774
69846
|
function getControlFlowContainer(node) {
|
|
69775
69847
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 307 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
69776
69848
|
}
|
|
69849
|
+
function isSymbolAssignedDefinitely(symbol) {
|
|
69850
|
+
if (symbol.lastAssignmentPos !== void 0) {
|
|
69851
|
+
return symbol.lastAssignmentPos < 0;
|
|
69852
|
+
}
|
|
69853
|
+
return isSymbolAssigned(symbol) && symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
|
|
69854
|
+
}
|
|
69777
69855
|
function isSymbolAssigned(symbol) {
|
|
69778
69856
|
return !isPastLastAssignment(
|
|
69779
69857
|
symbol,
|
|
@@ -69793,7 +69871,7 @@ function createTypeChecker(host) {
|
|
|
69793
69871
|
markNodeAssignments(parent);
|
|
69794
69872
|
}
|
|
69795
69873
|
}
|
|
69796
|
-
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
69874
|
+
return !symbol.lastAssignmentPos || location && Math.abs(symbol.lastAssignmentPos) < location.pos;
|
|
69797
69875
|
}
|
|
69798
69876
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
69799
69877
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -69814,12 +69892,19 @@ function createTypeChecker(host) {
|
|
|
69814
69892
|
function markNodeAssignments(node) {
|
|
69815
69893
|
switch (node.kind) {
|
|
69816
69894
|
case 80 /* Identifier */:
|
|
69817
|
-
|
|
69895
|
+
const assigmentTarget = getAssignmentTargetKind(node);
|
|
69896
|
+
if (assigmentTarget !== 0 /* None */) {
|
|
69818
69897
|
const symbol = getResolvedSymbol(node);
|
|
69819
|
-
|
|
69820
|
-
|
|
69821
|
-
|
|
69822
|
-
|
|
69898
|
+
const hasDefiniteAssignment = assigmentTarget === 1 /* Definite */ || symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
|
|
69899
|
+
if (isParameterOrMutableLocalVariable(symbol)) {
|
|
69900
|
+
if (symbol.lastAssignmentPos === void 0 || Math.abs(symbol.lastAssignmentPos) !== Number.MAX_VALUE) {
|
|
69901
|
+
const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
|
|
69902
|
+
const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
69903
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
|
|
69904
|
+
}
|
|
69905
|
+
if (hasDefiniteAssignment && symbol.lastAssignmentPos > 0) {
|
|
69906
|
+
symbol.lastAssignmentPos *= -1;
|
|
69907
|
+
}
|
|
69823
69908
|
}
|
|
69824
69909
|
}
|
|
69825
69910
|
return;
|
|
@@ -69836,7 +69921,8 @@ function createTypeChecker(host) {
|
|
|
69836
69921
|
true
|
|
69837
69922
|
);
|
|
69838
69923
|
if (symbol && isParameterOrMutableLocalVariable(symbol)) {
|
|
69839
|
-
symbol.lastAssignmentPos
|
|
69924
|
+
const sign = symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0 ? -1 : 1;
|
|
69925
|
+
symbol.lastAssignmentPos = sign * Number.MAX_VALUE;
|
|
69840
69926
|
}
|
|
69841
69927
|
}
|
|
69842
69928
|
return;
|
|
@@ -70420,6 +70506,7 @@ function createTypeChecker(host) {
|
|
|
70420
70506
|
}
|
|
70421
70507
|
const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70422
70508
|
let declaration = localOrExportSymbol.valueDeclaration;
|
|
70509
|
+
const immediateDeclaration = declaration;
|
|
70423
70510
|
if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent) => parent === declaration.parent)) {
|
|
70424
70511
|
return nonInferrableAnyType;
|
|
70425
70512
|
}
|
|
@@ -70465,7 +70552,8 @@ function createTypeChecker(host) {
|
|
|
70465
70552
|
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
70466
70553
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
70467
70554
|
}
|
|
70468
|
-
const
|
|
70555
|
+
const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol);
|
|
70556
|
+
const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
|
|
70469
70557
|
const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type);
|
|
70470
70558
|
const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer);
|
|
70471
70559
|
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
|
|
@@ -91469,7 +91557,7 @@ function transformTypeScript(context) {
|
|
|
91469
91557
|
let currentNamespaceContainerName;
|
|
91470
91558
|
let currentLexicalScope;
|
|
91471
91559
|
let currentScopeFirstDeclarationsOfName;
|
|
91472
|
-
let enabledSubstitutions
|
|
91560
|
+
let enabledSubstitutions = 0 /* None */;
|
|
91473
91561
|
let applicableSubstitutions;
|
|
91474
91562
|
return transformSourceFileOrBundle;
|
|
91475
91563
|
function transformSourceFileOrBundle(node) {
|
|
@@ -93277,7 +93365,7 @@ function transformClassFields(context) {
|
|
|
93277
93365
|
const previousOnEmitNode = context.onEmitNode;
|
|
93278
93366
|
context.onEmitNode = onEmitNode;
|
|
93279
93367
|
let shouldTransformPrivateStaticElementsInFile = false;
|
|
93280
|
-
let enabledSubstitutions
|
|
93368
|
+
let enabledSubstitutions = 0 /* None */;
|
|
93281
93369
|
let classAliases;
|
|
93282
93370
|
let pendingExpressions;
|
|
93283
93371
|
let pendingStatements;
|
|
@@ -98206,7 +98294,7 @@ function transformES2017(context) {
|
|
|
98206
98294
|
const resolver = context.getEmitResolver();
|
|
98207
98295
|
const compilerOptions = context.getCompilerOptions();
|
|
98208
98296
|
const languageVersion = getEmitScriptTarget(compilerOptions);
|
|
98209
|
-
let enabledSubstitutions
|
|
98297
|
+
let enabledSubstitutions = 0 /* None */;
|
|
98210
98298
|
let enclosingSuperContainerFlags = 0;
|
|
98211
98299
|
let enclosingFunctionParameterNames;
|
|
98212
98300
|
let capturedSuperProperties;
|
|
@@ -99081,7 +99169,7 @@ function transformES2018(context) {
|
|
|
99081
99169
|
const previousOnSubstituteNode = context.onSubstituteNode;
|
|
99082
99170
|
context.onSubstituteNode = onSubstituteNode;
|
|
99083
99171
|
let exportedVariableStatement = false;
|
|
99084
|
-
let enabledSubstitutions
|
|
99172
|
+
let enabledSubstitutions = 0 /* None */;
|
|
99085
99173
|
let enclosingFunctionFlags;
|
|
99086
99174
|
let parametersWithPrecedingObjectRestOrSpread;
|
|
99087
99175
|
let enclosingSuperContainerFlags = 0;
|
|
@@ -102216,7 +102304,7 @@ function transformES2015(context) {
|
|
|
102216
102304
|
);
|
|
102217
102305
|
}
|
|
102218
102306
|
let convertedLoopState;
|
|
102219
|
-
let enabledSubstitutions
|
|
102307
|
+
let enabledSubstitutions = 0 /* None */;
|
|
102220
102308
|
return chainBundle(context, transformSourceFile);
|
|
102221
102309
|
function transformSourceFile(node) {
|
|
102222
102310
|
if (node.isDeclarationFile) {
|
|
@@ -120041,7 +120129,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120041
120129
|
const packageIdToSourceFile = /* @__PURE__ */ new Map();
|
|
120042
120130
|
let sourceFileToPackageName = /* @__PURE__ */ new Map();
|
|
120043
120131
|
let redirectTargetsMap = createMultiMap();
|
|
120044
|
-
let usesUriStyleNodeCoreModules
|
|
120132
|
+
let usesUriStyleNodeCoreModules;
|
|
120045
120133
|
const filesByName = /* @__PURE__ */ new Map();
|
|
120046
120134
|
let missingFileNames = /* @__PURE__ */ new Map();
|
|
120047
120135
|
const filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? /* @__PURE__ */ new Map() : void 0;
|
|
@@ -121463,7 +121551,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121463
121551
|
);
|
|
121464
121552
|
imports = append(imports, moduleNameExpr);
|
|
121465
121553
|
if (!usesUriStyleNodeCoreModules && currentNodeModulesDepth === 0 && !file.isDeclarationFile) {
|
|
121466
|
-
|
|
121554
|
+
if (startsWith(moduleNameExpr.text, "node:") && !exclusivelyPrefixedNodeCoreModules.has(moduleNameExpr.text)) {
|
|
121555
|
+
usesUriStyleNodeCoreModules = true;
|
|
121556
|
+
} else if (usesUriStyleNodeCoreModules === void 0 && unprefixedNodeCoreModules.has(moduleNameExpr.text)) {
|
|
121557
|
+
usesUriStyleNodeCoreModules = false;
|
|
121558
|
+
}
|
|
121467
121559
|
}
|
|
121468
121560
|
}
|
|
121469
121561
|
} else if (isModuleDeclaration(node)) {
|