@typescript-deploys/pr-build 5.4.0-pr-56875-6 → 5.4.0-pr-56908-17
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 +75 -69
- package/lib/tsserver.js +72 -75
- package/lib/typescript.js +72 -73
- package/lib/typingsInstaller.js +2 -2
- 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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20231231`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -12913,6 +12913,9 @@ function forEachTsConfigPropArray(tsConfigSourceFile, propKey, callback) {
|
|
|
12913
12913
|
function getContainingFunction(node) {
|
|
12914
12914
|
return findAncestor(node.parent, isFunctionLike);
|
|
12915
12915
|
}
|
|
12916
|
+
function getContainingFunctionDeclaration(node) {
|
|
12917
|
+
return findAncestor(node.parent, isFunctionLikeDeclaration);
|
|
12918
|
+
}
|
|
12916
12919
|
function getContainingClass(node) {
|
|
12917
12920
|
return findAncestor(node.parent, isClassLike);
|
|
12918
12921
|
}
|
|
@@ -16081,7 +16084,7 @@ function Symbol4(flags, name) {
|
|
|
16081
16084
|
this.exportSymbol = void 0;
|
|
16082
16085
|
this.constEnumOnlyModule = void 0;
|
|
16083
16086
|
this.isReferenced = void 0;
|
|
16084
|
-
this.
|
|
16087
|
+
this.lastAssignmentPos = void 0;
|
|
16085
16088
|
this.links = void 0;
|
|
16086
16089
|
}
|
|
16087
16090
|
function Type3(checker, flags) {
|
|
@@ -17503,13 +17506,6 @@ function hasContextSensitiveParameters(node) {
|
|
|
17503
17506
|
function isInfinityOrNaNString(name) {
|
|
17504
17507
|
return name === "Infinity" || name === "-Infinity" || name === "NaN";
|
|
17505
17508
|
}
|
|
17506
|
-
function isCatchClauseVariableDeclaration(node) {
|
|
17507
|
-
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
17508
|
-
}
|
|
17509
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
17510
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
17511
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
17512
|
-
}
|
|
17513
17509
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
17514
17510
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
17515
17511
|
}
|
|
@@ -44094,6 +44090,7 @@ function createTypeChecker(host) {
|
|
|
44094
44090
|
);
|
|
44095
44091
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
44096
44092
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
44093
|
+
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
44097
44094
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
44098
44095
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
44099
44096
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -44103,7 +44100,6 @@ function createTypeChecker(host) {
|
|
|
44103
44100
|
void 0,
|
|
44104
44101
|
"non-null"
|
|
44105
44102
|
);
|
|
44106
|
-
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
44107
44103
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
44108
44104
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
44109
44105
|
var missingType = createIntrinsicType(
|
|
@@ -52654,7 +52650,7 @@ function createTypeChecker(host) {
|
|
|
52654
52650
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
52655
52651
|
reportImplicitAny(element, anyType);
|
|
52656
52652
|
}
|
|
52657
|
-
return includePatternInType ?
|
|
52653
|
+
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
52658
52654
|
}
|
|
52659
52655
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
52660
52656
|
const members = createSymbolTable();
|
|
@@ -60660,7 +60656,7 @@ function createTypeChecker(host) {
|
|
|
60660
60656
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
60661
60657
|
const s = source.flags;
|
|
60662
60658
|
const t = target.flags;
|
|
60663
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType
|
|
60659
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
60664
60660
|
return true;
|
|
60665
60661
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
60666
60662
|
return true;
|
|
@@ -63910,9 +63906,6 @@ function createTypeChecker(host) {
|
|
|
63910
63906
|
result = anyType;
|
|
63911
63907
|
} else if (isObjectLiteralType(type)) {
|
|
63912
63908
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
63913
|
-
if (type.pattern) {
|
|
63914
|
-
result.pattern = type.pattern;
|
|
63915
|
-
}
|
|
63916
63909
|
} else if (type.flags & 1048576 /* Union */) {
|
|
63917
63910
|
const unionContext = context || createWideningContext(
|
|
63918
63911
|
/*parent*/
|
|
@@ -63927,9 +63920,6 @@ function createTypeChecker(host) {
|
|
|
63927
63920
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
63928
63921
|
} else if (isArrayOrTupleType(type)) {
|
|
63929
63922
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
63930
|
-
if (type.pattern) {
|
|
63931
|
-
result.pattern = type.pattern;
|
|
63932
|
-
}
|
|
63933
63923
|
}
|
|
63934
63924
|
if (result && context === void 0) {
|
|
63935
63925
|
type.widened = result;
|
|
@@ -64263,22 +64253,12 @@ function createTypeChecker(host) {
|
|
|
64263
64253
|
return void 0;
|
|
64264
64254
|
}
|
|
64265
64255
|
if (isArrayType(source)) {
|
|
64266
|
-
|
|
64267
|
-
if (source.pattern) {
|
|
64268
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
64269
|
-
reversed2.pattern = source.pattern;
|
|
64270
|
-
}
|
|
64271
|
-
return reversed2;
|
|
64256
|
+
return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
64272
64257
|
}
|
|
64273
64258
|
if (isTupleType(source)) {
|
|
64274
64259
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
64275
64260
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
64276
|
-
|
|
64277
|
-
if (source.pattern) {
|
|
64278
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
64279
|
-
reversed2.pattern = source.pattern;
|
|
64280
|
-
}
|
|
64281
|
-
return reversed2;
|
|
64261
|
+
return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
64282
64262
|
}
|
|
64283
64263
|
const reversed = createObjectType(
|
|
64284
64264
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -64288,9 +64268,6 @@ function createTypeChecker(host) {
|
|
|
64288
64268
|
reversed.source = source;
|
|
64289
64269
|
reversed.mappedType = target;
|
|
64290
64270
|
reversed.constraintType = constraint;
|
|
64291
|
-
if (source.pattern) {
|
|
64292
|
-
reversed.pattern = source.pattern;
|
|
64293
|
-
}
|
|
64294
64271
|
return reversed;
|
|
64295
64272
|
}
|
|
64296
64273
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -64305,7 +64282,7 @@ function createTypeChecker(host) {
|
|
|
64305
64282
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
64306
64283
|
const inference = createInferenceInfo(typeParameter);
|
|
64307
64284
|
inferTypes([inference], sourceType, templateType);
|
|
64308
|
-
return getTypeFromInference(inference) ||
|
|
64285
|
+
return getTypeFromInference(inference) || unknownType;
|
|
64309
64286
|
}
|
|
64310
64287
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
64311
64288
|
const properties = getPropertiesOfType(target);
|
|
@@ -64333,7 +64310,7 @@ function createTypeChecker(host) {
|
|
|
64333
64310
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
64334
64311
|
}
|
|
64335
64312
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
64336
|
-
return !
|
|
64313
|
+
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
64337
64314
|
}
|
|
64338
64315
|
function typesDefinitelyUnrelated(source, target) {
|
|
64339
64316
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -64552,7 +64529,7 @@ function createTypeChecker(host) {
|
|
|
64552
64529
|
}
|
|
64553
64530
|
const inference = getInferenceInfoForType(target);
|
|
64554
64531
|
if (inference) {
|
|
64555
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
64532
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
64556
64533
|
return;
|
|
64557
64534
|
}
|
|
64558
64535
|
if (!inference.isFixed) {
|
|
@@ -65114,16 +65091,12 @@ function createTypeChecker(host) {
|
|
|
65114
65091
|
function getInferredType(context, index) {
|
|
65115
65092
|
const inference = context.inferences[index];
|
|
65116
65093
|
if (!inference.inferredType) {
|
|
65117
|
-
let isFromBindingPattern = false;
|
|
65118
65094
|
let inferredType;
|
|
65119
65095
|
let fallbackType;
|
|
65120
65096
|
if (context.signature) {
|
|
65121
65097
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
65122
65098
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
65123
|
-
if (inferredCovariantType
|
|
65124
|
-
isFromBindingPattern = true;
|
|
65125
|
-
inferredType = inferredCovariantType;
|
|
65126
|
-
} else if (inferredCovariantType || inferredContravariantType) {
|
|
65099
|
+
if (inferredCovariantType || inferredContravariantType) {
|
|
65127
65100
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
65128
65101
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
65129
65102
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -65142,9 +65115,7 @@ function createTypeChecker(host) {
|
|
|
65142
65115
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
65143
65116
|
if (constraint) {
|
|
65144
65117
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
65145
|
-
if (
|
|
65146
|
-
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
65147
|
-
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
65118
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
65148
65119
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
65149
65120
|
}
|
|
65150
65121
|
}
|
|
@@ -66179,7 +66150,7 @@ function createTypeChecker(host) {
|
|
|
66179
66150
|
case 80 /* Identifier */:
|
|
66180
66151
|
if (!isThisInTypeQuery(node)) {
|
|
66181
66152
|
const symbol = getResolvedSymbol(node);
|
|
66182
|
-
return isConstantVariable(symbol) ||
|
|
66153
|
+
return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
|
|
66183
66154
|
}
|
|
66184
66155
|
break;
|
|
66185
66156
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -67269,10 +67240,17 @@ function createTypeChecker(host) {
|
|
|
67269
67240
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
67270
67241
|
}
|
|
67271
67242
|
function isSymbolAssigned(symbol) {
|
|
67272
|
-
|
|
67243
|
+
return !isPastLastAssignment(
|
|
67244
|
+
symbol,
|
|
67245
|
+
/*location*/
|
|
67246
|
+
void 0
|
|
67247
|
+
);
|
|
67248
|
+
}
|
|
67249
|
+
function isPastLastAssignment(symbol, location) {
|
|
67250
|
+
const parent = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
|
|
67251
|
+
if (!parent) {
|
|
67273
67252
|
return false;
|
|
67274
67253
|
}
|
|
67275
|
-
const parent = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
67276
67254
|
const links = getNodeLinks(parent);
|
|
67277
67255
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
67278
67256
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -67280,7 +67258,7 @@ function createTypeChecker(host) {
|
|
|
67280
67258
|
markNodeAssignments(parent);
|
|
67281
67259
|
}
|
|
67282
67260
|
}
|
|
67283
|
-
return symbol.
|
|
67261
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
67284
67262
|
}
|
|
67285
67263
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
67286
67264
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -67293,23 +67271,60 @@ function createTypeChecker(host) {
|
|
|
67293
67271
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
67294
67272
|
}
|
|
67295
67273
|
function hasParentWithAssignmentsMarked(node) {
|
|
67296
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
67274
|
+
return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
67275
|
+
}
|
|
67276
|
+
function isAssignmentMarkingContainer(node) {
|
|
67277
|
+
return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
|
|
67297
67278
|
}
|
|
67298
67279
|
function markNodeAssignments(node) {
|
|
67299
|
-
|
|
67300
|
-
|
|
67301
|
-
|
|
67302
|
-
|
|
67303
|
-
|
|
67304
|
-
|
|
67280
|
+
let statementEnd;
|
|
67281
|
+
markAssignments(node);
|
|
67282
|
+
function markAssignments(node2) {
|
|
67283
|
+
switch (node2.kind) {
|
|
67284
|
+
case 80 /* Identifier */:
|
|
67285
|
+
if (isAssignmentTarget(node2)) {
|
|
67286
|
+
const symbol = getResolvedSymbol(node2);
|
|
67287
|
+
if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
67288
|
+
const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
|
|
67289
|
+
const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
|
|
67290
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
|
|
67291
|
+
}
|
|
67292
|
+
}
|
|
67293
|
+
return;
|
|
67294
|
+
case 243 /* VariableStatement */:
|
|
67295
|
+
case 244 /* ExpressionStatement */:
|
|
67296
|
+
case 245 /* IfStatement */:
|
|
67297
|
+
case 246 /* DoStatement */:
|
|
67298
|
+
case 247 /* WhileStatement */:
|
|
67299
|
+
case 248 /* ForStatement */:
|
|
67300
|
+
case 249 /* ForInStatement */:
|
|
67301
|
+
case 250 /* ForOfStatement */:
|
|
67302
|
+
case 254 /* WithStatement */:
|
|
67303
|
+
case 255 /* SwitchStatement */:
|
|
67304
|
+
case 258 /* TryStatement */:
|
|
67305
|
+
case 263 /* ClassDeclaration */:
|
|
67306
|
+
const saveStatementEnd = statementEnd;
|
|
67307
|
+
statementEnd ?? (statementEnd = node2.end);
|
|
67308
|
+
forEachChild(node2, markAssignments);
|
|
67309
|
+
statementEnd = saveStatementEnd;
|
|
67310
|
+
return;
|
|
67311
|
+
case 264 /* InterfaceDeclaration */:
|
|
67312
|
+
case 265 /* TypeAliasDeclaration */:
|
|
67313
|
+
case 266 /* EnumDeclaration */:
|
|
67314
|
+
return;
|
|
67315
|
+
}
|
|
67316
|
+
if (!isTypeNode(node2)) {
|
|
67317
|
+
forEachChild(node2, markAssignments);
|
|
67305
67318
|
}
|
|
67306
|
-
} else {
|
|
67307
|
-
forEachChild(node, markNodeAssignments);
|
|
67308
67319
|
}
|
|
67309
67320
|
}
|
|
67310
67321
|
function isConstantVariable(symbol) {
|
|
67311
67322
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
67312
67323
|
}
|
|
67324
|
+
function isParameterOrLetOrCatchVariable(symbol) {
|
|
67325
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
67326
|
+
return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
|
|
67327
|
+
}
|
|
67313
67328
|
function parameterInitializerContainsUndefined(declaration) {
|
|
67314
67329
|
const links = getNodeLinks(declaration);
|
|
67315
67330
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -67558,7 +67573,7 @@ function createTypeChecker(host) {
|
|
|
67558
67573
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
67559
67574
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
67560
67575
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
67561
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
67576
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
67562
67577
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
67563
67578
|
}
|
|
67564
67579
|
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 */;
|
|
@@ -68471,16 +68486,7 @@ function createTypeChecker(host) {
|
|
|
68471
68486
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
68472
68487
|
const prop = getPropertyOfType(t, name);
|
|
68473
68488
|
if (prop) {
|
|
68474
|
-
|
|
68475
|
-
return void 0;
|
|
68476
|
-
}
|
|
68477
|
-
const type2 = getTypeOfSymbol(prop);
|
|
68478
|
-
if (type2 !== nonInferrableUnknownType) {
|
|
68479
|
-
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
68480
|
-
}
|
|
68481
|
-
if (t.flags & 2097152 /* Intersection */) {
|
|
68482
|
-
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
68483
|
-
}
|
|
68489
|
+
return isCircularMappedProperty(prop) ? void 0 : removeMissingType(getTypeOfSymbol(prop), !!(prop && prop.flags & 16777216 /* Optional */));
|
|
68484
68490
|
}
|
|
68485
68491
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
68486
68492
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -69330,7 +69336,7 @@ function createTypeChecker(host) {
|
|
|
69330
69336
|
/*contextFlags*/
|
|
69331
69337
|
void 0
|
|
69332
69338
|
);
|
|
69333
|
-
const contextualTypeHasPattern =
|
|
69339
|
+
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
69334
69340
|
const inConstContext = isConstContext(node);
|
|
69335
69341
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
69336
69342
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
package/lib/tsserver.js
CHANGED
|
@@ -1251,7 +1251,6 @@ __export(server_exports, {
|
|
|
1251
1251
|
isCaseKeyword: () => isCaseKeyword,
|
|
1252
1252
|
isCaseOrDefaultClause: () => isCaseOrDefaultClause,
|
|
1253
1253
|
isCatchClause: () => isCatchClause,
|
|
1254
|
-
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
|
|
1255
1254
|
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
|
|
1256
1255
|
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
|
|
1257
1256
|
isChildOfNodeWithKind: () => isChildOfNodeWithKind,
|
|
@@ -1653,7 +1652,6 @@ __export(server_exports, {
|
|
|
1653
1652
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
1654
1653
|
isParameter: () => isParameter,
|
|
1655
1654
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
1656
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
1657
1655
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
1658
1656
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
1659
1657
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -2339,7 +2337,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2339
2337
|
|
|
2340
2338
|
// src/compiler/corePublic.ts
|
|
2341
2339
|
var versionMajorMinor = "5.4";
|
|
2342
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2340
|
+
var version = `${versionMajorMinor}.0-insiders.20231231`;
|
|
2343
2341
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2344
2342
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2345
2343
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -20232,7 +20230,7 @@ function Symbol4(flags, name) {
|
|
|
20232
20230
|
this.exportSymbol = void 0;
|
|
20233
20231
|
this.constEnumOnlyModule = void 0;
|
|
20234
20232
|
this.isReferenced = void 0;
|
|
20235
|
-
this.
|
|
20233
|
+
this.lastAssignmentPos = void 0;
|
|
20236
20234
|
this.links = void 0;
|
|
20237
20235
|
}
|
|
20238
20236
|
function Type3(checker, flags) {
|
|
@@ -21704,13 +21702,6 @@ function hasContextSensitiveParameters(node) {
|
|
|
21704
21702
|
function isInfinityOrNaNString(name) {
|
|
21705
21703
|
return name === "Infinity" || name === "-Infinity" || name === "NaN";
|
|
21706
21704
|
}
|
|
21707
|
-
function isCatchClauseVariableDeclaration(node) {
|
|
21708
|
-
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
21709
|
-
}
|
|
21710
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
21711
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
21712
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
21713
|
-
}
|
|
21714
21705
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
21715
21706
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
21716
21707
|
}
|
|
@@ -48813,6 +48804,7 @@ function createTypeChecker(host) {
|
|
|
48813
48804
|
);
|
|
48814
48805
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
48815
48806
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
48807
|
+
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
48816
48808
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
48817
48809
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
48818
48810
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -48822,7 +48814,6 @@ function createTypeChecker(host) {
|
|
|
48822
48814
|
void 0,
|
|
48823
48815
|
"non-null"
|
|
48824
48816
|
);
|
|
48825
|
-
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
48826
48817
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
48827
48818
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
48828
48819
|
var missingType = createIntrinsicType(
|
|
@@ -57373,7 +57364,7 @@ function createTypeChecker(host) {
|
|
|
57373
57364
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
57374
57365
|
reportImplicitAny(element, anyType);
|
|
57375
57366
|
}
|
|
57376
|
-
return includePatternInType ?
|
|
57367
|
+
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
57377
57368
|
}
|
|
57378
57369
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
57379
57370
|
const members = createSymbolTable();
|
|
@@ -65379,7 +65370,7 @@ function createTypeChecker(host) {
|
|
|
65379
65370
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
65380
65371
|
const s = source.flags;
|
|
65381
65372
|
const t = target.flags;
|
|
65382
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType
|
|
65373
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
65383
65374
|
return true;
|
|
65384
65375
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
65385
65376
|
return true;
|
|
@@ -68629,9 +68620,6 @@ function createTypeChecker(host) {
|
|
|
68629
68620
|
result = anyType;
|
|
68630
68621
|
} else if (isObjectLiteralType2(type)) {
|
|
68631
68622
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
68632
|
-
if (type.pattern) {
|
|
68633
|
-
result.pattern = type.pattern;
|
|
68634
|
-
}
|
|
68635
68623
|
} else if (type.flags & 1048576 /* Union */) {
|
|
68636
68624
|
const unionContext = context || createWideningContext(
|
|
68637
68625
|
/*parent*/
|
|
@@ -68646,9 +68634,6 @@ function createTypeChecker(host) {
|
|
|
68646
68634
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
68647
68635
|
} else if (isArrayOrTupleType(type)) {
|
|
68648
68636
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
68649
|
-
if (type.pattern) {
|
|
68650
|
-
result.pattern = type.pattern;
|
|
68651
|
-
}
|
|
68652
68637
|
}
|
|
68653
68638
|
if (result && context === void 0) {
|
|
68654
68639
|
type.widened = result;
|
|
@@ -68982,22 +68967,12 @@ function createTypeChecker(host) {
|
|
|
68982
68967
|
return void 0;
|
|
68983
68968
|
}
|
|
68984
68969
|
if (isArrayType(source)) {
|
|
68985
|
-
|
|
68986
|
-
if (source.pattern) {
|
|
68987
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
68988
|
-
reversed2.pattern = source.pattern;
|
|
68989
|
-
}
|
|
68990
|
-
return reversed2;
|
|
68970
|
+
return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
68991
68971
|
}
|
|
68992
68972
|
if (isTupleType(source)) {
|
|
68993
68973
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
68994
68974
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
68995
|
-
|
|
68996
|
-
if (source.pattern) {
|
|
68997
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
68998
|
-
reversed2.pattern = source.pattern;
|
|
68999
|
-
}
|
|
69000
|
-
return reversed2;
|
|
68975
|
+
return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
69001
68976
|
}
|
|
69002
68977
|
const reversed = createObjectType(
|
|
69003
68978
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -69007,9 +68982,6 @@ function createTypeChecker(host) {
|
|
|
69007
68982
|
reversed.source = source;
|
|
69008
68983
|
reversed.mappedType = target;
|
|
69009
68984
|
reversed.constraintType = constraint;
|
|
69010
|
-
if (source.pattern) {
|
|
69011
|
-
reversed.pattern = source.pattern;
|
|
69012
|
-
}
|
|
69013
68985
|
return reversed;
|
|
69014
68986
|
}
|
|
69015
68987
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -69024,7 +68996,7 @@ function createTypeChecker(host) {
|
|
|
69024
68996
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
69025
68997
|
const inference = createInferenceInfo(typeParameter);
|
|
69026
68998
|
inferTypes([inference], sourceType, templateType);
|
|
69027
|
-
return getTypeFromInference(inference) ||
|
|
68999
|
+
return getTypeFromInference(inference) || unknownType;
|
|
69028
69000
|
}
|
|
69029
69001
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
69030
69002
|
const properties = getPropertiesOfType(target);
|
|
@@ -69052,7 +69024,7 @@ function createTypeChecker(host) {
|
|
|
69052
69024
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
69053
69025
|
}
|
|
69054
69026
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
69055
|
-
return !
|
|
69027
|
+
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
69056
69028
|
}
|
|
69057
69029
|
function typesDefinitelyUnrelated(source, target) {
|
|
69058
69030
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -69271,7 +69243,7 @@ function createTypeChecker(host) {
|
|
|
69271
69243
|
}
|
|
69272
69244
|
const inference = getInferenceInfoForType(target);
|
|
69273
69245
|
if (inference) {
|
|
69274
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
69246
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
69275
69247
|
return;
|
|
69276
69248
|
}
|
|
69277
69249
|
if (!inference.isFixed) {
|
|
@@ -69833,16 +69805,12 @@ function createTypeChecker(host) {
|
|
|
69833
69805
|
function getInferredType(context, index) {
|
|
69834
69806
|
const inference = context.inferences[index];
|
|
69835
69807
|
if (!inference.inferredType) {
|
|
69836
|
-
let isFromBindingPattern = false;
|
|
69837
69808
|
let inferredType;
|
|
69838
69809
|
let fallbackType;
|
|
69839
69810
|
if (context.signature) {
|
|
69840
69811
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
69841
69812
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
69842
|
-
if (inferredCovariantType
|
|
69843
|
-
isFromBindingPattern = true;
|
|
69844
|
-
inferredType = inferredCovariantType;
|
|
69845
|
-
} else if (inferredCovariantType || inferredContravariantType) {
|
|
69813
|
+
if (inferredCovariantType || inferredContravariantType) {
|
|
69846
69814
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
69847
69815
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
69848
69816
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -69861,9 +69829,7 @@ function createTypeChecker(host) {
|
|
|
69861
69829
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
69862
69830
|
if (constraint) {
|
|
69863
69831
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
69864
|
-
if (
|
|
69865
|
-
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
69866
|
-
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
69832
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
69867
69833
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
69868
69834
|
}
|
|
69869
69835
|
}
|
|
@@ -70898,7 +70864,7 @@ function createTypeChecker(host) {
|
|
|
70898
70864
|
case 80 /* Identifier */:
|
|
70899
70865
|
if (!isThisInTypeQuery(node)) {
|
|
70900
70866
|
const symbol = getResolvedSymbol(node);
|
|
70901
|
-
return isConstantVariable(symbol) ||
|
|
70867
|
+
return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
|
|
70902
70868
|
}
|
|
70903
70869
|
break;
|
|
70904
70870
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -71988,10 +71954,17 @@ function createTypeChecker(host) {
|
|
|
71988
71954
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
71989
71955
|
}
|
|
71990
71956
|
function isSymbolAssigned(symbol) {
|
|
71991
|
-
|
|
71957
|
+
return !isPastLastAssignment(
|
|
71958
|
+
symbol,
|
|
71959
|
+
/*location*/
|
|
71960
|
+
void 0
|
|
71961
|
+
);
|
|
71962
|
+
}
|
|
71963
|
+
function isPastLastAssignment(symbol, location) {
|
|
71964
|
+
const parent2 = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
|
|
71965
|
+
if (!parent2) {
|
|
71992
71966
|
return false;
|
|
71993
71967
|
}
|
|
71994
|
-
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
71995
71968
|
const links = getNodeLinks(parent2);
|
|
71996
71969
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
71997
71970
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -71999,7 +71972,7 @@ function createTypeChecker(host) {
|
|
|
71999
71972
|
markNodeAssignments(parent2);
|
|
72000
71973
|
}
|
|
72001
71974
|
}
|
|
72002
|
-
return symbol.
|
|
71975
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
72003
71976
|
}
|
|
72004
71977
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
72005
71978
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -72012,23 +71985,60 @@ function createTypeChecker(host) {
|
|
|
72012
71985
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
72013
71986
|
}
|
|
72014
71987
|
function hasParentWithAssignmentsMarked(node) {
|
|
72015
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
71988
|
+
return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
71989
|
+
}
|
|
71990
|
+
function isAssignmentMarkingContainer(node) {
|
|
71991
|
+
return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
|
|
72016
71992
|
}
|
|
72017
71993
|
function markNodeAssignments(node) {
|
|
72018
|
-
|
|
72019
|
-
|
|
72020
|
-
|
|
72021
|
-
|
|
72022
|
-
|
|
72023
|
-
|
|
71994
|
+
let statementEnd;
|
|
71995
|
+
markAssignments(node);
|
|
71996
|
+
function markAssignments(node2) {
|
|
71997
|
+
switch (node2.kind) {
|
|
71998
|
+
case 80 /* Identifier */:
|
|
71999
|
+
if (isAssignmentTarget(node2)) {
|
|
72000
|
+
const symbol = getResolvedSymbol(node2);
|
|
72001
|
+
if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
72002
|
+
const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
|
|
72003
|
+
const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
|
|
72004
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
|
|
72005
|
+
}
|
|
72006
|
+
}
|
|
72007
|
+
return;
|
|
72008
|
+
case 243 /* VariableStatement */:
|
|
72009
|
+
case 244 /* ExpressionStatement */:
|
|
72010
|
+
case 245 /* IfStatement */:
|
|
72011
|
+
case 246 /* DoStatement */:
|
|
72012
|
+
case 247 /* WhileStatement */:
|
|
72013
|
+
case 248 /* ForStatement */:
|
|
72014
|
+
case 249 /* ForInStatement */:
|
|
72015
|
+
case 250 /* ForOfStatement */:
|
|
72016
|
+
case 254 /* WithStatement */:
|
|
72017
|
+
case 255 /* SwitchStatement */:
|
|
72018
|
+
case 258 /* TryStatement */:
|
|
72019
|
+
case 263 /* ClassDeclaration */:
|
|
72020
|
+
const saveStatementEnd = statementEnd;
|
|
72021
|
+
statementEnd ?? (statementEnd = node2.end);
|
|
72022
|
+
forEachChild(node2, markAssignments);
|
|
72023
|
+
statementEnd = saveStatementEnd;
|
|
72024
|
+
return;
|
|
72025
|
+
case 264 /* InterfaceDeclaration */:
|
|
72026
|
+
case 265 /* TypeAliasDeclaration */:
|
|
72027
|
+
case 266 /* EnumDeclaration */:
|
|
72028
|
+
return;
|
|
72029
|
+
}
|
|
72030
|
+
if (!isTypeNode(node2)) {
|
|
72031
|
+
forEachChild(node2, markAssignments);
|
|
72024
72032
|
}
|
|
72025
|
-
} else {
|
|
72026
|
-
forEachChild(node, markNodeAssignments);
|
|
72027
72033
|
}
|
|
72028
72034
|
}
|
|
72029
72035
|
function isConstantVariable(symbol) {
|
|
72030
72036
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
72031
72037
|
}
|
|
72038
|
+
function isParameterOrLetOrCatchVariable(symbol) {
|
|
72039
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
72040
|
+
return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
|
|
72041
|
+
}
|
|
72032
72042
|
function parameterInitializerContainsUndefined(declaration) {
|
|
72033
72043
|
const links = getNodeLinks(declaration);
|
|
72034
72044
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -72277,7 +72287,7 @@ function createTypeChecker(host) {
|
|
|
72277
72287
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
72278
72288
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
72279
72289
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
72280
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
72290
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
72281
72291
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
72282
72292
|
}
|
|
72283
72293
|
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 */;
|
|
@@ -73190,16 +73200,7 @@ function createTypeChecker(host) {
|
|
|
73190
73200
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
73191
73201
|
const prop = getPropertyOfType(t, name);
|
|
73192
73202
|
if (prop) {
|
|
73193
|
-
|
|
73194
|
-
return void 0;
|
|
73195
|
-
}
|
|
73196
|
-
const type2 = getTypeOfSymbol(prop);
|
|
73197
|
-
if (type2 !== nonInferrableUnknownType) {
|
|
73198
|
-
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
73199
|
-
}
|
|
73200
|
-
if (t.flags & 2097152 /* Intersection */) {
|
|
73201
|
-
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
73202
|
-
}
|
|
73203
|
+
return isCircularMappedProperty(prop) ? void 0 : removeMissingType(getTypeOfSymbol(prop), !!(prop && prop.flags & 16777216 /* Optional */));
|
|
73203
73204
|
}
|
|
73204
73205
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
73205
73206
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -74049,7 +74050,7 @@ function createTypeChecker(host) {
|
|
|
74049
74050
|
/*contextFlags*/
|
|
74050
74051
|
void 0
|
|
74051
74052
|
);
|
|
74052
|
-
const contextualTypeHasPattern =
|
|
74053
|
+
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
74053
74054
|
const inConstContext = isConstContext(node);
|
|
74054
74055
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
74055
74056
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
@@ -174955,7 +174956,6 @@ __export(ts_exports2, {
|
|
|
174955
174956
|
isCaseKeyword: () => isCaseKeyword,
|
|
174956
174957
|
isCaseOrDefaultClause: () => isCaseOrDefaultClause,
|
|
174957
174958
|
isCatchClause: () => isCatchClause,
|
|
174958
|
-
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
|
|
174959
174959
|
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
|
|
174960
174960
|
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
|
|
174961
174961
|
isChildOfNodeWithKind: () => isChildOfNodeWithKind,
|
|
@@ -175357,7 +175357,6 @@ __export(ts_exports2, {
|
|
|
175357
175357
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
175358
175358
|
isParameter: () => isParameter,
|
|
175359
175359
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
175360
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
175361
175360
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
175362
175361
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
175363
175362
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -189754,7 +189753,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189754
189753
|
isCaseKeyword,
|
|
189755
189754
|
isCaseOrDefaultClause,
|
|
189756
189755
|
isCatchClause,
|
|
189757
|
-
isCatchClauseVariableDeclaration,
|
|
189758
189756
|
isCatchClauseVariableDeclarationOrBindingElement,
|
|
189759
189757
|
isCheckJsEnabledForFile,
|
|
189760
189758
|
isChildOfNodeWithKind,
|
|
@@ -190156,7 +190154,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
190156
190154
|
isPackedArrayLiteral,
|
|
190157
190155
|
isParameter,
|
|
190158
190156
|
isParameterDeclaration,
|
|
190159
|
-
isParameterOrCatchClauseVariable,
|
|
190160
190157
|
isParameterPropertyDeclaration,
|
|
190161
190158
|
isParameterPropertyModifier,
|
|
190162
190159
|
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-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20231231`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -17522,7 +17522,7 @@ ${lanes.join("\n")}
|
|
|
17522
17522
|
this.exportSymbol = void 0;
|
|
17523
17523
|
this.constEnumOnlyModule = void 0;
|
|
17524
17524
|
this.isReferenced = void 0;
|
|
17525
|
-
this.
|
|
17525
|
+
this.lastAssignmentPos = void 0;
|
|
17526
17526
|
this.links = void 0;
|
|
17527
17527
|
}
|
|
17528
17528
|
function Type3(checker, flags) {
|
|
@@ -18701,13 +18701,6 @@ ${lanes.join("\n")}
|
|
|
18701
18701
|
function isInfinityOrNaNString(name) {
|
|
18702
18702
|
return name === "Infinity" || name === "-Infinity" || name === "NaN";
|
|
18703
18703
|
}
|
|
18704
|
-
function isCatchClauseVariableDeclaration(node) {
|
|
18705
|
-
return node.kind === 260 /* VariableDeclaration */ && node.parent.kind === 299 /* CatchClause */;
|
|
18706
|
-
}
|
|
18707
|
-
function isParameterOrCatchClauseVariable(symbol) {
|
|
18708
|
-
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
18709
|
-
return !!declaration && (isParameter(declaration) || isCatchClauseVariableDeclaration(declaration));
|
|
18710
|
-
}
|
|
18711
18704
|
function isFunctionExpressionOrArrowFunction(node) {
|
|
18712
18705
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
18713
18706
|
}
|
|
@@ -46569,6 +46562,7 @@ ${lanes.join("\n")}
|
|
|
46569
46562
|
);
|
|
46570
46563
|
var errorType = createIntrinsicType(1 /* Any */, "error");
|
|
46571
46564
|
var unresolvedType = createIntrinsicType(1 /* Any */, "unresolved");
|
|
46565
|
+
var nonInferrableAnyType = createIntrinsicType(1 /* Any */, "any", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
46572
46566
|
var intrinsicMarkerType = createIntrinsicType(1 /* Any */, "intrinsic");
|
|
46573
46567
|
var unknownType = createIntrinsicType(2 /* Unknown */, "unknown");
|
|
46574
46568
|
var nonNullUnknownType = createIntrinsicType(
|
|
@@ -46578,7 +46572,6 @@ ${lanes.join("\n")}
|
|
|
46578
46572
|
void 0,
|
|
46579
46573
|
"non-null"
|
|
46580
46574
|
);
|
|
46581
|
-
var nonInferrableUnknownType = createIntrinsicType(2 /* Unknown */, "unknown", 65536 /* ContainsWideningType */, "non-inferrable");
|
|
46582
46575
|
var undefinedType = createIntrinsicType(32768 /* Undefined */, "undefined");
|
|
46583
46576
|
var undefinedWideningType = strictNullChecks ? undefinedType : createIntrinsicType(32768 /* Undefined */, "undefined", 65536 /* ContainsWideningType */, "widening");
|
|
46584
46577
|
var missingType = createIntrinsicType(
|
|
@@ -55129,7 +55122,7 @@ ${lanes.join("\n")}
|
|
|
55129
55122
|
if (reportErrors2 && !declarationBelongsToPrivateAmbientMember(element)) {
|
|
55130
55123
|
reportImplicitAny(element, anyType);
|
|
55131
55124
|
}
|
|
55132
|
-
return includePatternInType ?
|
|
55125
|
+
return includePatternInType ? nonInferrableAnyType : anyType;
|
|
55133
55126
|
}
|
|
55134
55127
|
function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors2) {
|
|
55135
55128
|
const members = createSymbolTable();
|
|
@@ -63135,7 +63128,7 @@ ${lanes.join("\n")}
|
|
|
63135
63128
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
63136
63129
|
const s = source.flags;
|
|
63137
63130
|
const t = target.flags;
|
|
63138
|
-
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType
|
|
63131
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
63139
63132
|
return true;
|
|
63140
63133
|
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
63141
63134
|
return true;
|
|
@@ -66385,9 +66378,6 @@ ${lanes.join("\n")}
|
|
|
66385
66378
|
result = anyType;
|
|
66386
66379
|
} else if (isObjectLiteralType2(type)) {
|
|
66387
66380
|
result = getWidenedTypeOfObjectLiteral(type, context);
|
|
66388
|
-
if (type.pattern) {
|
|
66389
|
-
result.pattern = type.pattern;
|
|
66390
|
-
}
|
|
66391
66381
|
} else if (type.flags & 1048576 /* Union */) {
|
|
66392
66382
|
const unionContext = context || createWideningContext(
|
|
66393
66383
|
/*parent*/
|
|
@@ -66402,9 +66392,6 @@ ${lanes.join("\n")}
|
|
|
66402
66392
|
result = getIntersectionType(sameMap(type.types, getWidenedType));
|
|
66403
66393
|
} else if (isArrayOrTupleType(type)) {
|
|
66404
66394
|
result = createTypeReference(type.target, sameMap(getTypeArguments(type), getWidenedType));
|
|
66405
|
-
if (type.pattern) {
|
|
66406
|
-
result.pattern = type.pattern;
|
|
66407
|
-
}
|
|
66408
66395
|
}
|
|
66409
66396
|
if (result && context === void 0) {
|
|
66410
66397
|
type.widened = result;
|
|
@@ -66738,22 +66725,12 @@ ${lanes.join("\n")}
|
|
|
66738
66725
|
return void 0;
|
|
66739
66726
|
}
|
|
66740
66727
|
if (isArrayType(source)) {
|
|
66741
|
-
|
|
66742
|
-
if (source.pattern) {
|
|
66743
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
66744
|
-
reversed2.pattern = source.pattern;
|
|
66745
|
-
}
|
|
66746
|
-
return reversed2;
|
|
66728
|
+
return createArrayType(inferReverseMappedType(getTypeArguments(source)[0], target, constraint), isReadonlyArrayType(source));
|
|
66747
66729
|
}
|
|
66748
66730
|
if (isTupleType(source)) {
|
|
66749
66731
|
const elementTypes = map(getElementTypes(source), (t) => inferReverseMappedType(t, target, constraint));
|
|
66750
66732
|
const elementFlags = getMappedTypeModifiers(target) & 4 /* IncludeOptional */ ? sameMap(source.target.elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : source.target.elementFlags;
|
|
66751
|
-
|
|
66752
|
-
if (source.pattern) {
|
|
66753
|
-
reversed2 = cloneTypeReference(reversed2);
|
|
66754
|
-
reversed2.pattern = source.pattern;
|
|
66755
|
-
}
|
|
66756
|
-
return reversed2;
|
|
66733
|
+
return createTupleType(elementTypes, elementFlags, source.target.readonly, source.target.labeledElementDeclarations);
|
|
66757
66734
|
}
|
|
66758
66735
|
const reversed = createObjectType(
|
|
66759
66736
|
1024 /* ReverseMapped */ | 16 /* Anonymous */,
|
|
@@ -66763,9 +66740,6 @@ ${lanes.join("\n")}
|
|
|
66763
66740
|
reversed.source = source;
|
|
66764
66741
|
reversed.mappedType = target;
|
|
66765
66742
|
reversed.constraintType = constraint;
|
|
66766
|
-
if (source.pattern) {
|
|
66767
|
-
reversed.pattern = source.pattern;
|
|
66768
|
-
}
|
|
66769
66743
|
return reversed;
|
|
66770
66744
|
}
|
|
66771
66745
|
function getTypeOfReverseMappedSymbol(symbol) {
|
|
@@ -66780,7 +66754,7 @@ ${lanes.join("\n")}
|
|
|
66780
66754
|
const templateType = getTemplateTypeFromMappedType(target);
|
|
66781
66755
|
const inference = createInferenceInfo(typeParameter);
|
|
66782
66756
|
inferTypes([inference], sourceType, templateType);
|
|
66783
|
-
return getTypeFromInference(inference) ||
|
|
66757
|
+
return getTypeFromInference(inference) || unknownType;
|
|
66784
66758
|
}
|
|
66785
66759
|
function* getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
|
|
66786
66760
|
const properties = getPropertiesOfType(target);
|
|
@@ -66808,7 +66782,7 @@ ${lanes.join("\n")}
|
|
|
66808
66782
|
return firstOrUndefinedIterator(getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties));
|
|
66809
66783
|
}
|
|
66810
66784
|
function tupleTypesDefinitelyUnrelated(source, target) {
|
|
66811
|
-
return !
|
|
66785
|
+
return !(target.target.combinedFlags & 8 /* Variadic */) && target.target.minLength > source.target.minLength || !target.target.hasRestElement && (source.target.hasRestElement || target.target.fixedLength < source.target.fixedLength);
|
|
66812
66786
|
}
|
|
66813
66787
|
function typesDefinitelyUnrelated(source, target) {
|
|
66814
66788
|
return isTupleType(source) && isTupleType(target) ? tupleTypesDefinitelyUnrelated(source, target) : !!getUnmatchedProperty(
|
|
@@ -67027,7 +67001,7 @@ ${lanes.join("\n")}
|
|
|
67027
67001
|
}
|
|
67028
67002
|
const inference = getInferenceInfoForType(target);
|
|
67029
67003
|
if (inference) {
|
|
67030
|
-
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source ===
|
|
67004
|
+
if (getObjectFlags(source) & 262144 /* NonInferrableType */ || source === nonInferrableAnyType) {
|
|
67031
67005
|
return;
|
|
67032
67006
|
}
|
|
67033
67007
|
if (!inference.isFixed) {
|
|
@@ -67589,16 +67563,12 @@ ${lanes.join("\n")}
|
|
|
67589
67563
|
function getInferredType(context, index) {
|
|
67590
67564
|
const inference = context.inferences[index];
|
|
67591
67565
|
if (!inference.inferredType) {
|
|
67592
|
-
let isFromBindingPattern = false;
|
|
67593
67566
|
let inferredType;
|
|
67594
67567
|
let fallbackType;
|
|
67595
67568
|
if (context.signature) {
|
|
67596
67569
|
const inferredCovariantType = inference.candidates ? getCovariantInference(inference, context.signature) : void 0;
|
|
67597
67570
|
const inferredContravariantType = inference.contraCandidates ? getContravariantInference(inference) : void 0;
|
|
67598
|
-
if (inferredCovariantType
|
|
67599
|
-
isFromBindingPattern = true;
|
|
67600
|
-
inferredType = inferredCovariantType;
|
|
67601
|
-
} else if (inferredCovariantType || inferredContravariantType) {
|
|
67571
|
+
if (inferredCovariantType || inferredContravariantType) {
|
|
67602
67572
|
const preferCovariantType = inferredCovariantType && (!inferredContravariantType || !(inferredCovariantType.flags & 131072 /* Never */) && some(inference.contraCandidates, (t) => isTypeSubtypeOf(inferredCovariantType, t)) && every(context.inferences, (other) => other !== inference && getConstraintOfTypeParameter(other.typeParameter) !== inference.typeParameter || every(other.candidates, (t) => isTypeSubtypeOf(t, inferredCovariantType))));
|
|
67603
67573
|
inferredType = preferCovariantType ? inferredCovariantType : inferredContravariantType;
|
|
67604
67574
|
fallbackType = preferCovariantType ? inferredContravariantType : inferredCovariantType;
|
|
@@ -67617,9 +67587,7 @@ ${lanes.join("\n")}
|
|
|
67617
67587
|
const constraint = getConstraintOfTypeParameter(inference.typeParameter);
|
|
67618
67588
|
if (constraint) {
|
|
67619
67589
|
const instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
|
|
67620
|
-
if (
|
|
67621
|
-
inference.inferredType = getIntersectionType([inference.inferredType, instantiatedConstraint]);
|
|
67622
|
-
} else if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
67590
|
+
if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
|
|
67623
67591
|
inference.inferredType = fallbackType && context.compareTypes(fallbackType, getTypeWithThisArgument(instantiatedConstraint, fallbackType)) ? fallbackType : instantiatedConstraint;
|
|
67624
67592
|
}
|
|
67625
67593
|
}
|
|
@@ -68654,7 +68622,7 @@ ${lanes.join("\n")}
|
|
|
68654
68622
|
case 80 /* Identifier */:
|
|
68655
68623
|
if (!isThisInTypeQuery(node)) {
|
|
68656
68624
|
const symbol = getResolvedSymbol(node);
|
|
68657
|
-
return isConstantVariable(symbol) ||
|
|
68625
|
+
return isConstantVariable(symbol) || isParameterOrLetOrCatchVariable(symbol) && !isSymbolAssigned(symbol);
|
|
68658
68626
|
}
|
|
68659
68627
|
break;
|
|
68660
68628
|
case 211 /* PropertyAccessExpression */:
|
|
@@ -69744,10 +69712,17 @@ ${lanes.join("\n")}
|
|
|
69744
69712
|
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 312 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
|
|
69745
69713
|
}
|
|
69746
69714
|
function isSymbolAssigned(symbol) {
|
|
69747
|
-
|
|
69715
|
+
return !isPastLastAssignment(
|
|
69716
|
+
symbol,
|
|
69717
|
+
/*location*/
|
|
69718
|
+
void 0
|
|
69719
|
+
);
|
|
69720
|
+
}
|
|
69721
|
+
function isPastLastAssignment(symbol, location) {
|
|
69722
|
+
const parent2 = findAncestor(symbol.valueDeclaration, isAssignmentMarkingContainer);
|
|
69723
|
+
if (!parent2) {
|
|
69748
69724
|
return false;
|
|
69749
69725
|
}
|
|
69750
|
-
const parent2 = getRootDeclaration(symbol.valueDeclaration).parent;
|
|
69751
69726
|
const links = getNodeLinks(parent2);
|
|
69752
69727
|
if (!(links.flags & 131072 /* AssignmentsMarked */)) {
|
|
69753
69728
|
links.flags |= 131072 /* AssignmentsMarked */;
|
|
@@ -69755,7 +69730,7 @@ ${lanes.join("\n")}
|
|
|
69755
69730
|
markNodeAssignments(parent2);
|
|
69756
69731
|
}
|
|
69757
69732
|
}
|
|
69758
|
-
return symbol.
|
|
69733
|
+
return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
|
|
69759
69734
|
}
|
|
69760
69735
|
function isSomeSymbolAssigned(rootDeclaration) {
|
|
69761
69736
|
Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
|
|
@@ -69768,23 +69743,60 @@ ${lanes.join("\n")}
|
|
|
69768
69743
|
return some(node.elements, (e) => e.kind !== 232 /* OmittedExpression */ && isSomeSymbolAssignedWorker(e.name));
|
|
69769
69744
|
}
|
|
69770
69745
|
function hasParentWithAssignmentsMarked(node) {
|
|
69771
|
-
return !!findAncestor(node.parent, (node2) => (
|
|
69746
|
+
return !!findAncestor(node.parent, (node2) => isAssignmentMarkingContainer(node2) && !!(getNodeLinks(node2).flags & 131072 /* AssignmentsMarked */));
|
|
69747
|
+
}
|
|
69748
|
+
function isAssignmentMarkingContainer(node) {
|
|
69749
|
+
return isFunctionLikeDeclaration(node) || isBlock(node) || isSourceFile(node) || isForStatement(node) || isForInOrOfStatement(node) || isCatchClause(node);
|
|
69772
69750
|
}
|
|
69773
69751
|
function markNodeAssignments(node) {
|
|
69774
|
-
|
|
69775
|
-
|
|
69776
|
-
|
|
69777
|
-
|
|
69778
|
-
|
|
69779
|
-
|
|
69752
|
+
let statementEnd;
|
|
69753
|
+
markAssignments(node);
|
|
69754
|
+
function markAssignments(node2) {
|
|
69755
|
+
switch (node2.kind) {
|
|
69756
|
+
case 80 /* Identifier */:
|
|
69757
|
+
if (isAssignmentTarget(node2)) {
|
|
69758
|
+
const symbol = getResolvedSymbol(node2);
|
|
69759
|
+
if (isParameterOrLetOrCatchVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
|
|
69760
|
+
const referencingFunction = getContainingFunctionDeclaration(node2) || getSourceFileOfNode(node2);
|
|
69761
|
+
const declaringFunction = getContainingFunctionDeclaration(symbol.valueDeclaration) || getSourceFileOfNode(node2);
|
|
69762
|
+
symbol.lastAssignmentPos = referencingFunction === declaringFunction ? statementEnd ?? node2.pos : Number.MAX_VALUE;
|
|
69763
|
+
}
|
|
69764
|
+
}
|
|
69765
|
+
return;
|
|
69766
|
+
case 243 /* VariableStatement */:
|
|
69767
|
+
case 244 /* ExpressionStatement */:
|
|
69768
|
+
case 245 /* IfStatement */:
|
|
69769
|
+
case 246 /* DoStatement */:
|
|
69770
|
+
case 247 /* WhileStatement */:
|
|
69771
|
+
case 248 /* ForStatement */:
|
|
69772
|
+
case 249 /* ForInStatement */:
|
|
69773
|
+
case 250 /* ForOfStatement */:
|
|
69774
|
+
case 254 /* WithStatement */:
|
|
69775
|
+
case 255 /* SwitchStatement */:
|
|
69776
|
+
case 258 /* TryStatement */:
|
|
69777
|
+
case 263 /* ClassDeclaration */:
|
|
69778
|
+
const saveStatementEnd = statementEnd;
|
|
69779
|
+
statementEnd ?? (statementEnd = node2.end);
|
|
69780
|
+
forEachChild(node2, markAssignments);
|
|
69781
|
+
statementEnd = saveStatementEnd;
|
|
69782
|
+
return;
|
|
69783
|
+
case 264 /* InterfaceDeclaration */:
|
|
69784
|
+
case 265 /* TypeAliasDeclaration */:
|
|
69785
|
+
case 266 /* EnumDeclaration */:
|
|
69786
|
+
return;
|
|
69787
|
+
}
|
|
69788
|
+
if (!isTypeNode(node2)) {
|
|
69789
|
+
forEachChild(node2, markAssignments);
|
|
69780
69790
|
}
|
|
69781
|
-
} else {
|
|
69782
|
-
forEachChild(node, markNodeAssignments);
|
|
69783
69791
|
}
|
|
69784
69792
|
}
|
|
69785
69793
|
function isConstantVariable(symbol) {
|
|
69786
69794
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 6 /* Constant */) !== 0;
|
|
69787
69795
|
}
|
|
69796
|
+
function isParameterOrLetOrCatchVariable(symbol) {
|
|
69797
|
+
const declaration = symbol.valueDeclaration && getRootDeclaration(symbol.valueDeclaration);
|
|
69798
|
+
return !!(declaration && (isParameter(declaration) || isVariableDeclaration(declaration) && (declaration.parent.kind === 299 /* CatchClause */ || declaration.parent.flags & 1 /* Let */)));
|
|
69799
|
+
}
|
|
69788
69800
|
function parameterInitializerContainsUndefined(declaration) {
|
|
69789
69801
|
const links = getNodeLinks(declaration);
|
|
69790
69802
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
@@ -70033,7 +70045,7 @@ ${lanes.join("\n")}
|
|
|
70033
70045
|
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
|
|
70034
70046
|
const typeIsAutomatic = type === autoType || type === autoArrayType;
|
|
70035
70047
|
const isAutomaticTypeInNonNull = typeIsAutomatic && node.parent.kind === 235 /* NonNullExpression */;
|
|
70036
|
-
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType ||
|
|
70048
|
+
while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrLetOrCatchVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
|
|
70037
70049
|
flowContainer = getControlFlowContainer(flowContainer);
|
|
70038
70050
|
}
|
|
70039
70051
|
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 */;
|
|
@@ -70946,16 +70958,7 @@ ${lanes.join("\n")}
|
|
|
70946
70958
|
} else if (t.flags & 3670016 /* StructuredType */) {
|
|
70947
70959
|
const prop = getPropertyOfType(t, name);
|
|
70948
70960
|
if (prop) {
|
|
70949
|
-
|
|
70950
|
-
return void 0;
|
|
70951
|
-
}
|
|
70952
|
-
const type2 = getTypeOfSymbol(prop);
|
|
70953
|
-
if (type2 !== nonInferrableUnknownType) {
|
|
70954
|
-
return removeMissingType(type2, !!(prop && prop.flags & 16777216 /* Optional */));
|
|
70955
|
-
}
|
|
70956
|
-
if (t.flags & 2097152 /* Intersection */) {
|
|
70957
|
-
t = getIntersectionType(t.types.filter((t2) => !t2.pattern));
|
|
70958
|
-
}
|
|
70961
|
+
return isCircularMappedProperty(prop) ? void 0 : removeMissingType(getTypeOfSymbol(prop), !!(prop && prop.flags & 16777216 /* Optional */));
|
|
70959
70962
|
}
|
|
70960
70963
|
if (isTupleType(t) && isNumericLiteralName(name) && +name >= 0) {
|
|
70961
70964
|
const restType = getElementTypeOfSliceOfTupleType(
|
|
@@ -71805,7 +71808,7 @@ ${lanes.join("\n")}
|
|
|
71805
71808
|
/*contextFlags*/
|
|
71806
71809
|
void 0
|
|
71807
71810
|
);
|
|
71808
|
-
const contextualTypeHasPattern =
|
|
71811
|
+
const contextualTypeHasPattern = contextualType && contextualType.pattern && (contextualType.pattern.kind === 206 /* ObjectBindingPattern */ || contextualType.pattern.kind === 210 /* ObjectLiteralExpression */);
|
|
71809
71812
|
const inConstContext = isConstContext(node);
|
|
71810
71813
|
const checkFlags = inConstContext ? 8 /* Readonly */ : 0;
|
|
71811
71814
|
const isInJavascript = isInJSFile(node) && !isInJsonFile(node);
|
|
@@ -186506,7 +186509,6 @@ ${e.message}`;
|
|
|
186506
186509
|
isCaseKeyword: () => isCaseKeyword,
|
|
186507
186510
|
isCaseOrDefaultClause: () => isCaseOrDefaultClause,
|
|
186508
186511
|
isCatchClause: () => isCatchClause,
|
|
186509
|
-
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
|
|
186510
186512
|
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
|
|
186511
186513
|
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
|
|
186512
186514
|
isChildOfNodeWithKind: () => isChildOfNodeWithKind,
|
|
@@ -186908,7 +186910,6 @@ ${e.message}`;
|
|
|
186908
186910
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
186909
186911
|
isParameter: () => isParameter,
|
|
186910
186912
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
186911
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
186912
186913
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
186913
186914
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
186914
186915
|
isParenthesizedExpression: () => isParenthesizedExpression,
|
|
@@ -188926,7 +188927,6 @@ ${e.message}`;
|
|
|
188926
188927
|
isCaseKeyword: () => isCaseKeyword,
|
|
188927
188928
|
isCaseOrDefaultClause: () => isCaseOrDefaultClause,
|
|
188928
188929
|
isCatchClause: () => isCatchClause,
|
|
188929
|
-
isCatchClauseVariableDeclaration: () => isCatchClauseVariableDeclaration,
|
|
188930
188930
|
isCatchClauseVariableDeclarationOrBindingElement: () => isCatchClauseVariableDeclarationOrBindingElement,
|
|
188931
188931
|
isCheckJsEnabledForFile: () => isCheckJsEnabledForFile,
|
|
188932
188932
|
isChildOfNodeWithKind: () => isChildOfNodeWithKind,
|
|
@@ -189328,7 +189328,6 @@ ${e.message}`;
|
|
|
189328
189328
|
isPackedArrayLiteral: () => isPackedArrayLiteral,
|
|
189329
189329
|
isParameter: () => isParameter,
|
|
189330
189330
|
isParameterDeclaration: () => isParameterDeclaration,
|
|
189331
|
-
isParameterOrCatchClauseVariable: () => isParameterOrCatchClauseVariable,
|
|
189332
189331
|
isParameterPropertyDeclaration: () => isParameterPropertyDeclaration,
|
|
189333
189332
|
isParameterPropertyModifier: () => isParameterPropertyModifier,
|
|
189334
189333
|
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-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20231231`;
|
|
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-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-56908-17",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -114,5 +114,5 @@
|
|
|
114
114
|
"node": "20.1.0",
|
|
115
115
|
"npm": "8.19.4"
|
|
116
116
|
},
|
|
117
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "04c952ee8448121bfb4aaa4b847226c087f15635"
|
|
118
118
|
}
|