typescript 5.4.0-dev.20240108 → 5.4.0-dev.20240109
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/tsc.js +81 -20
- package/lib/tsserver.js +81 -23
- package/lib/typescript.js +81 -22
- package/lib/typingsInstaller.js +2 -2
- package/package.json +3 -3
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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240109`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -16070,7 +16070,7 @@ function Symbol4(flags, name) {
|
|
|
16070
16070
|
this.exportSymbol = void 0;
|
|
16071
16071
|
this.constEnumOnlyModule = void 0;
|
|
16072
16072
|
this.isReferenced = void 0;
|
|
16073
|
-
this.
|
|
16073
|
+
this.lastAssignmentPos = void 0;
|
|
16074
16074
|
this.links = void 0;
|
|
16075
16075
|
}
|
|
16076
16076
|
function Type3(checker, flags) {
|
|
@@ -17495,10 +17495,6 @@ function isInfinityOrNaNString(name) {
|
|
|
17495
17495
|
function isCatchClauseVariableDeclaration(node) {
|
|
17496
17496
|
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
17497
17497
|
}
|
|
17498
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
17499
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
17500
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
17501
|
-
}
|
|
17502
17498
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
17503
17499
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
17504
17500
|
}
|
|
@@ -66178,7 +66174,7 @@ function createTypeChecker(host) {
|
|
|
66178
66174
|
case 80 /* Identifier */:
|
|
66179
66175
|
if (!isThisInTypeQuery(node)) {
|
|
66180
66176
|
const symbol = getResolvedSymbol(node);
|
|
66181
|
-
return isConstantVariable(symbol) ||
|
|
66177
|
+
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
|
66182
66178
|
}
|
|
66183
66179
|
break;
|
|
66184
66180
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -66187,7 +66183,7 @@ function createTypeChecker(host) {
|
|
|
66187
66183
|
case 206 /* ObjectBindingPattern */:
|
|
66188
66184
|
case 207 /* ArrayBindingPattern */:
|
|
66189
66185
|
const rootDeclaration = getRootDeclaration(node.parent);
|
|
66190
|
-
return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
66186
|
+
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
66191
66187
|
}
|
|
66192
66188
|
return false;
|
|
66193
66189
|
}
|
|
@@ -67268,10 +67264,17 @@ function createTypeChecker(host) {
|
|
|
67268
67264
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
67269
67265
|
}
|
|
67270
67266
|
function isSymbolAssigned(symbol) {
|
|
67271
|
-
|
|
67267
|
+
return !isPastLastAssignment(
|
|
67268
|
+
symbol,
|
|
67269
|
+
/*location*/
|
|
67270
|
+
void 0
|
|
67271
|
+
);
|
|
67272
|
+
}
|
|
67273
|
+
function isPastLastAssignment(symbol, location) {
|
|
67274
|
+
const parent = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
67275
|
+
if (!parent) {
|
|
67272
67276
|
return false;
|
|
67273
67277
|
}
|
|
67274
|
-
const parent = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
67275
67278
|
const links = getNodeLinks(parent);
|
|
67276
67279
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
67277
67280
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -67279,7 +67282,7 @@ function createTypeChecker(host) {
|
|
|
67279
67282
|
markNodeAssignments(parent);
|
|
67280
67283
|
}
|
|
67281
67284
|
}
|
|
67282
|
-
return symbol.
|
|
67285
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
67283
67286
|
}
|
|
67284
67287
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
67285
67288
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -67292,23 +67295,81 @@ function createTypeChecker(host) {
|
|
|
67292
67295
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
67293
67296
|
}
|
|
67294
67297
|
function hasParentWithAssignmentsMarked(node) {
|
|
67295
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
67298
|
+
return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
67299
|
+
}
|
|
67300
|
+
function isFunctionOrSourceFile(node) {
|
|
67301
|
+
return isFunctionLikeDeclaration(node) || isSourceFile(node);
|
|
67296
67302
|
}
|
|
67297
67303
|
function markNodeAssignments(node) {
|
|
67298
|
-
|
|
67299
|
-
|
|
67300
|
-
|
|
67301
|
-
|
|
67302
|
-
symbol.
|
|
67304
|
+
switch (node.kind) {
|
|
67305
|
+
case 80 /* Identifier */:
|
|
67306
|
+
if (isAssignmentTarget(node)) {
|
|
67307
|
+
const symbol = getResolvedSymbol(node);
|
|
67308
|
+
if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
67309
|
+
const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
|
|
67310
|
+
const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
67311
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
|
|
67312
|
+
}
|
|
67303
67313
|
}
|
|
67314
|
+
return;
|
|
67315
|
+
case 281 /* ExportSpecifier */:
|
|
67316
|
+
const exportDeclaration = node.parent.parent;
|
|
67317
|
+
if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
|
|
67318
|
+
const symbol = resolveEntityName(
|
|
67319
|
+
node.propertyName || node.name,
|
|
67320
|
+
111551 /* Value */,
|
|
67321
|
+
/*ignoreErrors*/
|
|
67322
|
+
true,
|
|
67323
|
+
/*dontResolveAlias*/
|
|
67324
|
+
true
|
|
67325
|
+
);
|
|
67326
|
+
if (symbol && isParameterOrMutableLocalVariable(symbol)) {
|
|
67327
|
+
symbol.lastAssignmentPos = Number.MAX_VALUE;
|
|
67328
|
+
}
|
|
67329
|
+
}
|
|
67330
|
+
return;
|
|
67331
|
+
case 264 /* InterfaceDeclaration */:
|
|
67332
|
+
case 265 /* TypeAliasDeclaration */:
|
|
67333
|
+
case 266 /* EnumDeclaration */:
|
|
67334
|
+
return;
|
|
67335
|
+
}
|
|
67336
|
+
if (isTypeNode(node)) {
|
|
67337
|
+
return;
|
|
67338
|
+
}
|
|
67339
|
+
forEachChild(node, markNodeAssignments);
|
|
67340
|
+
}
|
|
67341
|
+
function extendAssignmentPosition(node, declaration) {
|
|
67342
|
+
let pos = node.pos;
|
|
67343
|
+
while (node && node.pos > declaration.pos) {
|
|
67344
|
+
switch (node.kind) {
|
|
67345
|
+
case 243 /* VariableStatement */:
|
|
67346
|
+
case 244 /* ExpressionStatement */:
|
|
67347
|
+
case 245 /* IfStatement */:
|
|
67348
|
+
case 246 /* DoStatement */:
|
|
67349
|
+
case 247 /* WhileStatement */:
|
|
67350
|
+
case 248 /* ForStatement */:
|
|
67351
|
+
case 249 /* ForInStatement */:
|
|
67352
|
+
case 250 /* ForOfStatement */:
|
|
67353
|
+
case 254 /* WithStatement */:
|
|
67354
|
+
case 255 /* SwitchStatement */:
|
|
67355
|
+
case 258 /* TryStatement */:
|
|
67356
|
+
case 263 /* ClassDeclaration */:
|
|
67357
|
+
pos = node.end;
|
|
67304
67358
|
}
|
|
67305
|
-
|
|
67306
|
-
forEachChild(node, markNodeAssignments);
|
|
67359
|
+
node = node.parent;
|
|
67307
67360
|
}
|
|
67361
|
+
return pos;
|
|
67308
67362
|
}
|
|
67309
67363
|
function isConstantVariable(symbol) {
|
|
67310
67364
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
67311
67365
|
}
|
|
67366
|
+
function isParameterOrMutableLocalVariable(symbol) {
|
|
67367
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
67368
|
+
return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
|
|
67369
|
+
}
|
|
67370
|
+
function isMutableLocalVariableDeclaration(declaration) {
|
|
67371
|
+
return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
|
|
67372
|
+
}
|
|
67312
67373
|
function parameterInitializerContainsUndefined(declaration) {
|
|
67313
67374
|
const links = getNodeLinks(declaration);
|
|
67314
67375
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -67557,7 +67618,7 @@ function createTypeChecker(host) {
|
|
|
67557
67618
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
67558
67619
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
67559
67620
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
67560
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
67621
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
67561
67622
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
67562
67623
|
}
|
|
67563
67624
|
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || 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 */;
|
package/lib/tsserver.js
CHANGED
|
@@ -1655,7 +1655,6 @@ __export(server_exports, {
|
|
|
1655
1655
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
1656
1656
|
isParameter: () => isParameter,
|
|
1657
1657
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
1658
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
1659
1658
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
1660
1659
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
1661
1660
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -2341,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2341
2340
|
|
|
2342
2341
|
// src/compiler/corePublic.ts
|
|
2343
2342
|
var versionMajorMinor = "5.4";
|
|
2344
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-dev.20240109`;
|
|
2345
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2346
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2347
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20241,7 +20240,7 @@ function Symbol4(flags, name) {
|
|
|
20241
20240
|
this.exportSymbol = void 0;
|
|
20242
20241
|
this.constEnumOnlyModule = void 0;
|
|
20243
20242
|
this.isReferenced = void 0;
|
|
20244
|
-
this.
|
|
20243
|
+
this.lastAssignmentPos = void 0;
|
|
20245
20244
|
this.links = void 0;
|
|
20246
20245
|
}
|
|
20247
20246
|
function Type3(checker, flags) {
|
|
@@ -21716,10 +21715,6 @@ function isInfinityOrNaNString(name) {
|
|
|
21716
21715
|
function isCatchClauseVariableDeclaration(node) {
|
|
21717
21716
|
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
21718
21717
|
}
|
|
21719
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
21720
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
21721
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
21722
|
-
}
|
|
21723
21718
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
21724
21719
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
21725
21720
|
}
|
|
@@ -70917,7 +70912,7 @@ function createTypeChecker(host) {
|
|
|
70917
70912
|
case 80 /* Identifier */:
|
|
70918
70913
|
if (!isThisInTypeQuery(node)) {
|
|
70919
70914
|
const symbol = getResolvedSymbol(node);
|
|
70920
|
-
return isConstantVariable(symbol) ||
|
|
70915
|
+
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
|
70921
70916
|
}
|
|
70922
70917
|
break;
|
|
70923
70918
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -70926,7 +70921,7 @@ function createTypeChecker(host) {
|
|
|
70926
70921
|
case 206 /* ObjectBindingPattern */:
|
|
70927
70922
|
case 207 /* ArrayBindingPattern */:
|
|
70928
70923
|
const rootDeclaration = getRootDeclaration(node.parent);
|
|
70929
|
-
return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
70924
|
+
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
70930
70925
|
}
|
|
70931
70926
|
return false;
|
|
70932
70927
|
}
|
|
@@ -72007,10 +72002,17 @@ function createTypeChecker(host) {
|
|
|
72007
72002
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
72008
72003
|
}
|
|
72009
72004
|
function isSymbolAssigned(symbol) {
|
|
72010
|
-
|
|
72005
|
+
return !isPastLastAssignment(
|
|
72006
|
+
symbol,
|
|
72007
|
+
/*location*/
|
|
72008
|
+
void 0
|
|
72009
|
+
);
|
|
72010
|
+
}
|
|
72011
|
+
function isPastLastAssignment(symbol, location) {
|
|
72012
|
+
const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
72013
|
+
if (!parent2) {
|
|
72011
72014
|
return false;
|
|
72012
72015
|
}
|
|
72013
|
-
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
72014
72016
|
const links = getNodeLinks(parent2);
|
|
72015
72017
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
72016
72018
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -72018,7 +72020,7 @@ function createTypeChecker(host) {
|
|
|
72018
72020
|
markNodeAssignments(parent2);
|
|
72019
72021
|
}
|
|
72020
72022
|
}
|
|
72021
|
-
return symbol.
|
|
72023
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
72022
72024
|
}
|
|
72023
72025
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
72024
72026
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -72031,23 +72033,81 @@ function createTypeChecker(host) {
|
|
|
72031
72033
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
72032
72034
|
}
|
|
72033
72035
|
function hasParentWithAssignmentsMarked(node) {
|
|
72034
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
72036
|
+
return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
72037
|
+
}
|
|
72038
|
+
function isFunctionOrSourceFile(node) {
|
|
72039
|
+
return isFunctionLikeDeclaration(node) || isSourceFile(node);
|
|
72035
72040
|
}
|
|
72036
72041
|
function markNodeAssignments(node) {
|
|
72037
|
-
|
|
72038
|
-
|
|
72039
|
-
|
|
72040
|
-
|
|
72041
|
-
symbol.
|
|
72042
|
+
switch (node.kind) {
|
|
72043
|
+
case 80 /* Identifier */:
|
|
72044
|
+
if (isAssignmentTarget(node)) {
|
|
72045
|
+
const symbol = getResolvedSymbol(node);
|
|
72046
|
+
if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
72047
|
+
const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
|
|
72048
|
+
const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
72049
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
|
|
72050
|
+
}
|
|
72042
72051
|
}
|
|
72052
|
+
return;
|
|
72053
|
+
case 281 /* ExportSpecifier */:
|
|
72054
|
+
const exportDeclaration = node.parent.parent;
|
|
72055
|
+
if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
|
|
72056
|
+
const symbol = resolveEntityName(
|
|
72057
|
+
node.propertyName || node.name,
|
|
72058
|
+
111551 /* Value */,
|
|
72059
|
+
/*ignoreErrors*/
|
|
72060
|
+
true,
|
|
72061
|
+
/*dontResolveAlias*/
|
|
72062
|
+
true
|
|
72063
|
+
);
|
|
72064
|
+
if (symbol && isParameterOrMutableLocalVariable(symbol)) {
|
|
72065
|
+
symbol.lastAssignmentPos = Number.MAX_VALUE;
|
|
72066
|
+
}
|
|
72067
|
+
}
|
|
72068
|
+
return;
|
|
72069
|
+
case 264 /* InterfaceDeclaration */:
|
|
72070
|
+
case 265 /* TypeAliasDeclaration */:
|
|
72071
|
+
case 266 /* EnumDeclaration */:
|
|
72072
|
+
return;
|
|
72073
|
+
}
|
|
72074
|
+
if (isTypeNode(node)) {
|
|
72075
|
+
return;
|
|
72076
|
+
}
|
|
72077
|
+
forEachChild(node, markNodeAssignments);
|
|
72078
|
+
}
|
|
72079
|
+
function extendAssignmentPosition(node, declaration) {
|
|
72080
|
+
let pos = node.pos;
|
|
72081
|
+
while (node && node.pos > declaration.pos) {
|
|
72082
|
+
switch (node.kind) {
|
|
72083
|
+
case 243 /* VariableStatement */:
|
|
72084
|
+
case 244 /* ExpressionStatement */:
|
|
72085
|
+
case 245 /* IfStatement */:
|
|
72086
|
+
case 246 /* DoStatement */:
|
|
72087
|
+
case 247 /* WhileStatement */:
|
|
72088
|
+
case 248 /* ForStatement */:
|
|
72089
|
+
case 249 /* ForInStatement */:
|
|
72090
|
+
case 250 /* ForOfStatement */:
|
|
72091
|
+
case 254 /* WithStatement */:
|
|
72092
|
+
case 255 /* SwitchStatement */:
|
|
72093
|
+
case 258 /* TryStatement */:
|
|
72094
|
+
case 263 /* ClassDeclaration */:
|
|
72095
|
+
pos = node.end;
|
|
72043
72096
|
}
|
|
72044
|
-
|
|
72045
|
-
forEachChild(node, markNodeAssignments);
|
|
72097
|
+
node = node.parent;
|
|
72046
72098
|
}
|
|
72099
|
+
return pos;
|
|
72047
72100
|
}
|
|
72048
72101
|
function isConstantVariable(symbol) {
|
|
72049
72102
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
72050
72103
|
}
|
|
72104
|
+
function isParameterOrMutableLocalVariable(symbol) {
|
|
72105
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
72106
|
+
return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
|
|
72107
|
+
}
|
|
72108
|
+
function isMutableLocalVariableDeclaration(declaration) {
|
|
72109
|
+
return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
|
|
72110
|
+
}
|
|
72051
72111
|
function parameterInitializerContainsUndefined(declaration) {
|
|
72052
72112
|
const links = getNodeLinks(declaration);
|
|
72053
72113
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -72296,7 +72356,7 @@ function createTypeChecker(host) {
|
|
|
72296
72356
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
72297
72357
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
72298
72358
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
72299
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
72359
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
72300
72360
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
72301
72361
|
}
|
|
72302
72362
|
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || 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 */;
|
|
@@ -175484,7 +175544,6 @@ __export(ts_exports2, {
|
|
|
175484
175544
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
175485
175545
|
isParameter: () => isParameter,
|
|
175486
175546
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
175487
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
175488
175547
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
175489
175548
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
175490
175549
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -190285,7 +190344,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
190285
190344
|
isPackedArrayLiteral,
|
|
190286
190345
|
isParameter,
|
|
190287
190346
|
isParameterDeclaration,
|
|
190288
|
-
isParameterOrCatchClauseVariable,
|
|
190289
190347
|
isParameterPropertyDeclaration,
|
|
190290
190348
|
isParameterPropertyModifier,
|
|
190291
190349
|
isParenthesizedExpression,
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20240109`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17529,7 +17529,7 @@ ${lanes.join("\n")}
|
|
|
17529
17529
|
this.exportSymbol = void 0;
|
|
17530
17530
|
this.constEnumOnlyModule = void 0;
|
|
17531
17531
|
this.isReferenced = void 0;
|
|
17532
|
-
this.
|
|
17532
|
+
this.lastAssignmentPos = void 0;
|
|
17533
17533
|
this.links = void 0;
|
|
17534
17534
|
}
|
|
17535
17535
|
function Type3(checker, flags) {
|
|
@@ -18711,10 +18711,6 @@ ${lanes.join("\n")}
|
|
|
18711
18711
|
function isCatchClauseVariableDeclaration(node) {
|
|
18712
18712
|
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
18713
18713
|
}
|
|
18714
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
18715
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
18716
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
18717
|
-
}
|
|
18718
18714
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
18719
18715
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
18720
18716
|
}
|
|
@@ -68671,7 +68667,7 @@ ${lanes.join("\n")}
|
|
|
68671
68667
|
case 80 /* Identifier */:
|
|
68672
68668
|
if (!isThisInTypeQuery(node)) {
|
|
68673
68669
|
const symbol = getResolvedSymbol(node);
|
|
68674
|
-
return isConstantVariable(symbol) ||
|
|
68670
|
+
return isConstantVariable(symbol) || isParameterOrMutableLocalVariable(symbol) && !isSymbolAssigned(symbol);
|
|
68675
68671
|
}
|
|
68676
68672
|
break;
|
|
68677
68673
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -68680,7 +68676,7 @@ ${lanes.join("\n")}
|
|
|
68680
68676
|
case 206 /* ObjectBindingPattern */:
|
|
68681
68677
|
case 207 /* ArrayBindingPattern */:
|
|
68682
68678
|
const rootDeclaration = getRootDeclaration(node.parent);
|
|
68683
|
-
return isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
68679
|
+
return isParameter(rootDeclaration) || isCatchClauseVariableDeclaration(rootDeclaration) ? !isSomeSymbolAssigned(rootDeclaration) : isVariableDeclaration(rootDeclaration) && isVarConstLike(rootDeclaration);
|
|
68684
68680
|
}
|
|
68685
68681
|
return false;
|
|
68686
68682
|
}
|
|
@@ -69761,10 +69757,17 @@ ${lanes.join("\n")}
|
|
|
69761
69757
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
69762
69758
|
}
|
|
69763
69759
|
function isSymbolAssigned(symbol) {
|
|
69764
|
-
|
|
69760
|
+
return !isPastLastAssignment(
|
|
69761
|
+
symbol,
|
|
69762
|
+
/*location*/
|
|
69763
|
+
void 0
|
|
69764
|
+
);
|
|
69765
|
+
}
|
|
69766
|
+
function isPastLastAssignment(symbol, location) {
|
|
69767
|
+
const parent2 = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
69768
|
+
if (!parent2) {
|
|
69765
69769
|
return false;
|
|
69766
69770
|
}
|
|
69767
|
-
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
69768
69771
|
const links = getNodeLinks(parent2);
|
|
69769
69772
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
69770
69773
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -69772,7 +69775,7 @@ ${lanes.join("\n")}
|
|
|
69772
69775
|
markNodeAssignments(parent2);
|
|
69773
69776
|
}
|
|
69774
69777
|
}
|
|
69775
|
-
return symbol.
|
|
69778
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
69776
69779
|
}
|
|
69777
69780
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
69778
69781
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -69785,23 +69788,81 @@ ${lanes.join("\n")}
|
|
|
69785
69788
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
69786
69789
|
}
|
|
69787
69790
|
function hasParentWithAssignmentsMarked(node) {
|
|
69788
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
69791
|
+
return !!findAncestor(node.parent, (node2) => isFunctionOrSourceFile(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
69792
|
+
}
|
|
69793
|
+
function isFunctionOrSourceFile(node) {
|
|
69794
|
+
return isFunctionLikeDeclaration(node) || isSourceFile(node);
|
|
69789
69795
|
}
|
|
69790
69796
|
function markNodeAssignments(node) {
|
|
69791
|
-
|
|
69792
|
-
|
|
69793
|
-
|
|
69794
|
-
|
|
69795
|
-
symbol.
|
|
69797
|
+
switch (node.kind) {
|
|
69798
|
+
case 80 /* Identifier */:
|
|
69799
|
+
if (isAssignmentTarget(node)) {
|
|
69800
|
+
const symbol = getResolvedSymbol(node);
|
|
69801
|
+
if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
69802
|
+
const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
|
|
69803
|
+
const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
|
|
69804
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
|
|
69805
|
+
}
|
|
69796
69806
|
}
|
|
69807
|
+
return;
|
|
69808
|
+
case 281 /* ExportSpecifier */:
|
|
69809
|
+
const exportDeclaration = node.parent.parent;
|
|
69810
|
+
if (!node.isTypeOnly && !exportDeclaration.isTypeOnly && !exportDeclaration.moduleSpecifier) {
|
|
69811
|
+
const symbol = resolveEntityName(
|
|
69812
|
+
node.propertyName || node.name,
|
|
69813
|
+
111551 /* Value */,
|
|
69814
|
+
/*ignoreErrors*/
|
|
69815
|
+
true,
|
|
69816
|
+
/*dontResolveAlias*/
|
|
69817
|
+
true
|
|
69818
|
+
);
|
|
69819
|
+
if (symbol && isParameterOrMutableLocalVariable(symbol)) {
|
|
69820
|
+
symbol.lastAssignmentPos = Number.MAX_VALUE;
|
|
69821
|
+
}
|
|
69822
|
+
}
|
|
69823
|
+
return;
|
|
69824
|
+
case 264 /* InterfaceDeclaration */:
|
|
69825
|
+
case 265 /* TypeAliasDeclaration */:
|
|
69826
|
+
case 266 /* EnumDeclaration */:
|
|
69827
|
+
return;
|
|
69828
|
+
}
|
|
69829
|
+
if (isTypeNode(node)) {
|
|
69830
|
+
return;
|
|
69831
|
+
}
|
|
69832
|
+
forEachChild(node, markNodeAssignments);
|
|
69833
|
+
}
|
|
69834
|
+
function extendAssignmentPosition(node, declaration) {
|
|
69835
|
+
let pos = node.pos;
|
|
69836
|
+
while (node && node.pos > declaration.pos) {
|
|
69837
|
+
switch (node.kind) {
|
|
69838
|
+
case 243 /* VariableStatement */:
|
|
69839
|
+
case 244 /* ExpressionStatement */:
|
|
69840
|
+
case 245 /* IfStatement */:
|
|
69841
|
+
case 246 /* DoStatement */:
|
|
69842
|
+
case 247 /* WhileStatement */:
|
|
69843
|
+
case 248 /* ForStatement */:
|
|
69844
|
+
case 249 /* ForInStatement */:
|
|
69845
|
+
case 250 /* ForOfStatement */:
|
|
69846
|
+
case 254 /* WithStatement */:
|
|
69847
|
+
case 255 /* SwitchStatement */:
|
|
69848
|
+
case 258 /* TryStatement */:
|
|
69849
|
+
case 263 /* ClassDeclaration */:
|
|
69850
|
+
pos = node.end;
|
|
69797
69851
|
}
|
|
69798
|
-
|
|
69799
|
-
forEachChild(node, markNodeAssignments);
|
|
69852
|
+
node = node.parent;
|
|
69800
69853
|
}
|
|
69854
|
+
return pos;
|
|
69801
69855
|
}
|
|
69802
69856
|
function isConstantVariable(symbol) {
|
|
69803
69857
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
69804
69858
|
}
|
|
69859
|
+
function isParameterOrMutableLocalVariable(symbol) {
|
|
69860
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
69861
|
+
return !!declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (isCatchClause(declaration.parent) || isMutableLocalVariableDeclaration(declaration)));
|
|
69862
|
+
}
|
|
69863
|
+
function isMutableLocalVariableDeclaration(declaration) {
|
|
69864
|
+
return !!(declaration.parent.flags & 1 /* Let */) && !(getCombinedModifierFlags(declaration) & 32 /* Export */ || declaration.parent.parent.kind === 243 /* VariableStatement */ && isGlobalSourceFile(declaration.parent.parent.parent));
|
|
69865
|
+
}
|
|
69805
69866
|
function parameterInitializerContainsUndefined(declaration) {
|
|
69806
69867
|
const links = getNodeLinks(declaration);
|
|
69807
69868
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -70050,7 +70111,7 @@ ${lanes.join("\n")}
|
|
|
70050
70111
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
70051
70112
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
70052
70113
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
70053
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
70114
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
70054
70115
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
70055
70116
|
}
|
|
70056
70117
|
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || 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 */;
|
|
@@ -187033,7 +187094,6 @@ ${e.message}`;
|
|
|
187033
187094
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
187034
187095
|
isParameter: () => isParameter,
|
|
187035
187096
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
187036
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
187037
187097
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
187038
187098
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
187039
187099
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -189455,7 +189515,6 @@ ${e.message}`;
|
|
|
189455
189515
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
189456
189516
|
isParameter: () => isParameter,
|
|
189457
189517
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
189458
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
189459
189518
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
189460
189519
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
189461
189520
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20240109`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -11129,7 +11129,7 @@ function Symbol4(flags, name) {
|
|
|
11129
11129
|
this.exportSymbol = void 0;
|
|
11130
11130
|
this.constEnumOnlyModule = void 0;
|
|
11131
11131
|
this.isReferenced = void 0;
|
|
11132
|
-
this.
|
|
11132
|
+
this.lastAssignmentPos = void 0;
|
|
11133
11133
|
this.links = void 0;
|
|
11134
11134
|
}
|
|
11135
11135
|
function Type3(checker, flags) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-dev.
|
|
5
|
+
"version": "5.4.0-dev.20240109",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"chalk": "^4.1.2",
|
|
60
60
|
"chokidar": "^3.5.3",
|
|
61
61
|
"diff": "^5.1.0",
|
|
62
|
-
"dprint": "^0.
|
|
62
|
+
"dprint": "^0.45.0",
|
|
63
63
|
"esbuild": "^0.19.0",
|
|
64
64
|
"eslint": "^8.22.0",
|
|
65
65
|
"eslint-formatter-autolinkable-stylish": "^1.2.0",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "f57e5104a3e21e82cafb818b531c8ec54ec0baa0"
|
|
117
117
|
}
|