@typescript-deploys/pr-build 5.4.0-pr-56476-3 → 5.4.0-pr-56488-8
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 +52 -77
- package/lib/tsserver.js +145 -143
- package/lib/typescript.js +145 -143
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsserver.js
CHANGED
|
@@ -6675,7 +6675,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6675
6675
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
6676
6676
|
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
6677
6677
|
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
6678
|
-
TypeFlags2[TypeFlags2["ObjectFlagsType"] =
|
|
6678
|
+
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 138117121] = "ObjectFlagsType";
|
|
6679
6679
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
6680
6680
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
6681
6681
|
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
@@ -20061,7 +20061,7 @@ function getClassLikeDeclarationOfSymbol(symbol) {
|
|
|
20061
20061
|
return (_a = symbol.declarations) == null ? void 0 : _a.find(isClassLike);
|
|
20062
20062
|
}
|
|
20063
20063
|
function getObjectFlags(type) {
|
|
20064
|
-
return type.flags &
|
|
20064
|
+
return type.flags & 138117121 /* ObjectFlagsType */ ? type.objectFlags : 0;
|
|
20065
20065
|
}
|
|
20066
20066
|
function forSomeAncestorDirectory(directory, callback) {
|
|
20067
20067
|
return !!forEachAncestorDirectory(directory, (d) => callback(d) ? true : void 0);
|
|
@@ -58971,12 +58971,7 @@ function createTypeChecker(host) {
|
|
|
58971
58971
|
const checkType = type.checkType;
|
|
58972
58972
|
const constraint = getLowerBoundOfKeyType(checkType);
|
|
58973
58973
|
if (constraint !== checkType) {
|
|
58974
|
-
return getConditionalTypeInstantiation(
|
|
58975
|
-
type,
|
|
58976
|
-
prependTypeMapping(type.root.checkType, constraint, type.mapper),
|
|
58977
|
-
/*forConstraint*/
|
|
58978
|
-
false
|
|
58979
|
-
);
|
|
58974
|
+
return getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
|
|
58980
58975
|
}
|
|
58981
58976
|
}
|
|
58982
58977
|
return type;
|
|
@@ -59328,12 +59323,7 @@ function createTypeChecker(host) {
|
|
|
59328
59323
|
);
|
|
59329
59324
|
const constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
|
|
59330
59325
|
if (constraint && constraint !== type.checkType) {
|
|
59331
|
-
const instantiated = getConditionalTypeInstantiation(
|
|
59332
|
-
type,
|
|
59333
|
-
prependTypeMapping(type.root.checkType, constraint, type.mapper),
|
|
59334
|
-
/*forConstraint*/
|
|
59335
|
-
true
|
|
59336
|
-
);
|
|
59326
|
+
const instantiated = getConditionalTypeInstantiation(type, prependTypeMapping(type.root.checkType, constraint, type.mapper));
|
|
59337
59327
|
if (!(instantiated.flags & 131072 /* Never */)) {
|
|
59338
59328
|
type.resolvedConstraintOfDistributive = instantiated;
|
|
59339
59329
|
return instantiated;
|
|
@@ -61767,7 +61757,7 @@ function createTypeChecker(host) {
|
|
|
61767
61757
|
}
|
|
61768
61758
|
}
|
|
61769
61759
|
function removeStringLiteralsMatchedByTemplateLiterals(types) {
|
|
61770
|
-
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t));
|
|
61760
|
+
const templates = filter(types, (t) => !!(t.flags & 134217728 /* TemplateLiteral */) && isPatternLiteralType(t) && t.types.every((t2) => !(t2.flags & 2097152 /* Intersection */) || !areIntersectedTypesAvoidingPrimitiveReduction(t2.types)));
|
|
61771
61761
|
if (templates.length) {
|
|
61772
61762
|
let i = types.length;
|
|
61773
61763
|
while (i > 0) {
|
|
@@ -62167,14 +62157,19 @@ function createTypeChecker(host) {
|
|
|
62167
62157
|
function getConstituentCountOfTypes(types) {
|
|
62168
62158
|
return reduceLeft(types, (n, t) => n + getConstituentCount(t), 0);
|
|
62169
62159
|
}
|
|
62160
|
+
function areIntersectedTypesAvoidingPrimitiveReduction(types, primitiveFlags = 4 /* String */ | 8 /* Number */ | 64 /* BigInt */) {
|
|
62161
|
+
if (types.length !== 2) {
|
|
62162
|
+
return false;
|
|
62163
|
+
}
|
|
62164
|
+
const [t1, t2] = types;
|
|
62165
|
+
return !!(t1.flags & primitiveFlags) && t2 === emptyTypeLiteralType || !!(t2.flags & primitiveFlags) && t1 === emptyTypeLiteralType;
|
|
62166
|
+
}
|
|
62170
62167
|
function getTypeFromIntersectionTypeNode(node) {
|
|
62171
62168
|
const links = getNodeLinks(node);
|
|
62172
62169
|
if (!links.resolvedType) {
|
|
62173
62170
|
const aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
62174
62171
|
const types = map(node.types, getTypeFromTypeNode);
|
|
62175
|
-
const
|
|
62176
|
-
const t = emptyIndex >= 0 ? types[1 - emptyIndex] : unknownType;
|
|
62177
|
-
const noSupertypeReduction = !!(t.flags & (4 /* String */ | 8 /* Number */ | 64 /* BigInt */) || t.flags & 134217728 /* TemplateLiteral */ && isPatternLiteralType(t));
|
|
62172
|
+
const noSupertypeReduction = areIntersectedTypesAvoidingPrimitiveReduction(types);
|
|
62178
62173
|
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
62179
62174
|
}
|
|
62180
62175
|
return links.resolvedType;
|
|
@@ -62201,17 +62196,19 @@ function createTypeChecker(host) {
|
|
|
62201
62196
|
return constraintType;
|
|
62202
62197
|
}
|
|
62203
62198
|
const keyTypes = [];
|
|
62204
|
-
if (
|
|
62205
|
-
if (
|
|
62199
|
+
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
62200
|
+
if (!isGenericIndexType(constraintType)) {
|
|
62201
|
+
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
62202
|
+
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
62203
|
+
} else {
|
|
62206
62204
|
return getIndexTypeForGenericType(type, indexFlags);
|
|
62207
62205
|
}
|
|
62208
|
-
forEachType(constraintType, addMemberForKeyType);
|
|
62209
|
-
} else if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
62210
|
-
const modifiersType = getApparentType(getModifiersTypeFromMappedType(type));
|
|
62211
|
-
forEachMappedTypePropertyKeyTypeAndIndexSignatureKeyType(modifiersType, 8576 /* StringOrNumberLiteralOrUnique */, !!(indexFlags & 1 /* StringsOnly */), addMemberForKeyType);
|
|
62212
62206
|
} else {
|
|
62213
62207
|
forEachType(getLowerBoundOfKeyType(constraintType), addMemberForKeyType);
|
|
62214
62208
|
}
|
|
62209
|
+
if (isGenericIndexType(constraintType)) {
|
|
62210
|
+
forEachType(constraintType, addMemberForKeyType);
|
|
62211
|
+
}
|
|
62215
62212
|
const result = indexFlags & 2 /* NoIndexSignatures */ ? filterType(getUnionType(keyTypes), (t) => !(t.flags & (1 /* Any */ | 4 /* String */))) : getUnionType(keyTypes);
|
|
62216
62213
|
if (result.flags & 1048576 /* Union */ && constraintType.flags & 1048576 /* Union */ && getTypeListId(result.types) === getTypeListId(constraintType.types)) {
|
|
62217
62214
|
return constraintType;
|
|
@@ -62384,6 +62381,11 @@ function createTypeChecker(host) {
|
|
|
62384
62381
|
}
|
|
62385
62382
|
function createTemplateLiteralType(texts, types) {
|
|
62386
62383
|
const type = createType(134217728 /* TemplateLiteral */);
|
|
62384
|
+
type.objectFlags = getPropagatingFlagsOfTypes(
|
|
62385
|
+
types,
|
|
62386
|
+
/*excludeKinds*/
|
|
62387
|
+
98304 /* Nullable */
|
|
62388
|
+
);
|
|
62387
62389
|
type.texts = texts;
|
|
62388
62390
|
type.types = types;
|
|
62389
62391
|
return type;
|
|
@@ -62678,15 +62680,7 @@ function createTypeChecker(host) {
|
|
|
62678
62680
|
}
|
|
62679
62681
|
function isPatternLiteralPlaceholderType(type) {
|
|
62680
62682
|
if (type.flags & 2097152 /* Intersection */) {
|
|
62681
|
-
|
|
62682
|
-
for (const t of type.types) {
|
|
62683
|
-
if (t.flags & (2944 /* Literal */ | 98304 /* Nullable */) || isPatternLiteralPlaceholderType(t)) {
|
|
62684
|
-
seenPlaceholder = true;
|
|
62685
|
-
} else if (!(t.flags & 524288 /* Object */)) {
|
|
62686
|
-
return false;
|
|
62687
|
-
}
|
|
62688
|
-
}
|
|
62689
|
-
return seenPlaceholder;
|
|
62683
|
+
return !isGenericType(type) && some(type.types, (t) => !!(t.flags & (2944 /* Literal */ | 98304 /* Nullable */)) || isPatternLiteralPlaceholderType(t));
|
|
62690
62684
|
}
|
|
62691
62685
|
return !!(type.flags & (1 /* Any */ | 4 /* String */ | 8 /* Number */ | 64 /* BigInt */)) || isPatternLiteralType(type);
|
|
62692
62686
|
}
|
|
@@ -62703,7 +62697,7 @@ function createTypeChecker(host) {
|
|
|
62703
62697
|
return !!(getGenericObjectFlags(type) & 8388608 /* IsGenericIndexType */);
|
|
62704
62698
|
}
|
|
62705
62699
|
function getGenericObjectFlags(type) {
|
|
62706
|
-
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
62700
|
+
if (type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */)) {
|
|
62707
62701
|
if (!(type.objectFlags & 2097152 /* IsGenericTypeComputed */)) {
|
|
62708
62702
|
type.objectFlags |= 2097152 /* IsGenericTypeComputed */ | reduceLeft(type.types, (flags, t) => flags | getGenericObjectFlags(t), 0);
|
|
62709
62703
|
}
|
|
@@ -62715,7 +62709,7 @@ function createTypeChecker(host) {
|
|
|
62715
62709
|
}
|
|
62716
62710
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
62717
62711
|
}
|
|
62718
|
-
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ |
|
|
62712
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
62719
62713
|
}
|
|
62720
62714
|
function getSimplifiedType(type, writing) {
|
|
62721
62715
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -62896,7 +62890,7 @@ function createTypeChecker(host) {
|
|
|
62896
62890
|
function isDeferredType(type, checkTuples) {
|
|
62897
62891
|
return isGenericType(type) || checkTuples && isTupleType(type) && some(getElementTypes(type), isGenericType);
|
|
62898
62892
|
}
|
|
62899
|
-
function getConditionalType(root, mapper,
|
|
62893
|
+
function getConditionalType(root, mapper, aliasSymbol, aliasTypeArguments) {
|
|
62900
62894
|
let result;
|
|
62901
62895
|
let extraTypes;
|
|
62902
62896
|
let tailCount = 0;
|
|
@@ -62942,7 +62936,7 @@ function createTypeChecker(host) {
|
|
|
62942
62936
|
const inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
|
|
62943
62937
|
if (!checkTypeDeferred && !isDeferredType(inferredExtendsType, checkTuples)) {
|
|
62944
62938
|
if (!(inferredExtendsType.flags & 3 /* AnyOrUnknown */) && (checkType.flags & 1 /* Any */ || !isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType)))) {
|
|
62945
|
-
if (checkType.flags & 1 /* Any */
|
|
62939
|
+
if (checkType.flags & 1 /* Any */) {
|
|
62946
62940
|
(extraTypes || (extraTypes = [])).push(instantiateType(getTypeFromTypeNode(root.node.trueType), combinedMapper || mapper));
|
|
62947
62941
|
}
|
|
62948
62942
|
const falseType2 = getTypeFromTypeNode(root.node.falseType);
|
|
@@ -63052,9 +63046,7 @@ function createTypeChecker(host) {
|
|
|
63052
63046
|
links.resolvedType = getConditionalType(
|
|
63053
63047
|
root,
|
|
63054
63048
|
/*mapper*/
|
|
63055
|
-
void 0
|
|
63056
|
-
/*forConstraint*/
|
|
63057
|
-
false
|
|
63049
|
+
void 0
|
|
63058
63050
|
);
|
|
63059
63051
|
if (outerTypeParameters) {
|
|
63060
63052
|
root.instantiations = /* @__PURE__ */ new Map();
|
|
@@ -63743,7 +63735,7 @@ function createTypeChecker(host) {
|
|
|
63743
63735
|
result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
|
|
63744
63736
|
target.instantiations.set(id, result);
|
|
63745
63737
|
const resultObjectFlags = getObjectFlags(result);
|
|
63746
|
-
if (result.flags &
|
|
63738
|
+
if (result.flags & 138117121 /* ObjectFlagsType */ && !(resultObjectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
63747
63739
|
const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
|
|
63748
63740
|
if (!(getObjectFlags(result) & 524288 /* CouldContainTypeVariablesComputed */)) {
|
|
63749
63741
|
if (resultObjectFlags & (32 /* Mapped */ | 16 /* Anonymous */ | 4 /* Reference */)) {
|
|
@@ -63909,17 +63901,17 @@ function createTypeChecker(host) {
|
|
|
63909
63901
|
result.objectFlags |= result.aliasTypeArguments ? getPropagatingFlagsOfTypes(result.aliasTypeArguments) : 0;
|
|
63910
63902
|
return result;
|
|
63911
63903
|
}
|
|
63912
|
-
function getConditionalTypeInstantiation(type, mapper,
|
|
63904
|
+
function getConditionalTypeInstantiation(type, mapper, aliasSymbol, aliasTypeArguments) {
|
|
63913
63905
|
const root = type.root;
|
|
63914
63906
|
if (root.outerTypeParameters) {
|
|
63915
63907
|
const typeArguments = map(root.outerTypeParameters, (t) => getMappedType(t, mapper));
|
|
63916
|
-
const id =
|
|
63908
|
+
const id = getTypeListId(typeArguments) + getAliasId(aliasSymbol, aliasTypeArguments);
|
|
63917
63909
|
let result = root.instantiations.get(id);
|
|
63918
63910
|
if (!result) {
|
|
63919
63911
|
const newMapper = createTypeMapper(root.outerTypeParameters, typeArguments);
|
|
63920
63912
|
const checkType = root.checkType;
|
|
63921
63913
|
const distributionType = root.isDistributive ? getMappedType(checkType, newMapper) : void 0;
|
|
63922
|
-
result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)
|
|
63914
|
+
result = distributionType && checkType !== distributionType && distributionType.flags & (1048576 /* Union */ | 131072 /* Never */) ? mapTypeWithAlias(getReducedType(distributionType), (t) => getConditionalType(root, prependTypeMapping(checkType, t, newMapper)), aliasSymbol, aliasTypeArguments) : getConditionalType(root, newMapper, aliasSymbol, aliasTypeArguments);
|
|
63923
63915
|
root.instantiations.set(id, result);
|
|
63924
63916
|
}
|
|
63925
63917
|
return result;
|
|
@@ -64007,14 +63999,7 @@ function createTypeChecker(host) {
|
|
|
64007
63999
|
);
|
|
64008
64000
|
}
|
|
64009
64001
|
if (flags & 16777216 /* Conditional */) {
|
|
64010
|
-
return getConditionalTypeInstantiation(
|
|
64011
|
-
type,
|
|
64012
|
-
combineTypeMappers(type.mapper, mapper),
|
|
64013
|
-
/*forConstraint*/
|
|
64014
|
-
false,
|
|
64015
|
-
aliasSymbol,
|
|
64016
|
-
aliasTypeArguments
|
|
64017
|
-
);
|
|
64002
|
+
return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments);
|
|
64018
64003
|
}
|
|
64019
64004
|
if (flags & 33554432 /* Substitution */) {
|
|
64020
64005
|
const newBaseType = instantiateType(type.baseType, mapper);
|
|
@@ -65658,7 +65643,7 @@ function createTypeChecker(host) {
|
|
|
65658
65643
|
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */), intersectionState);
|
|
65659
65644
|
}
|
|
65660
65645
|
if (target2.flags & 1048576 /* Union */) {
|
|
65661
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */)
|
|
65646
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 402784252 /* Primitive */) && !(target2.flags & 402784252 /* Primitive */));
|
|
65662
65647
|
}
|
|
65663
65648
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
65664
65649
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
@@ -65703,8 +65688,7 @@ function createTypeChecker(host) {
|
|
|
65703
65688
|
sourceType,
|
|
65704
65689
|
target2,
|
|
65705
65690
|
/*reportErrors*/
|
|
65706
|
-
false
|
|
65707
|
-
0 /* None */
|
|
65691
|
+
false
|
|
65708
65692
|
);
|
|
65709
65693
|
if (!related) {
|
|
65710
65694
|
return 0 /* False */;
|
|
@@ -65713,7 +65697,7 @@ function createTypeChecker(host) {
|
|
|
65713
65697
|
}
|
|
65714
65698
|
return result2;
|
|
65715
65699
|
}
|
|
65716
|
-
function typeRelatedToSomeType(source2, target2, reportErrors2
|
|
65700
|
+
function typeRelatedToSomeType(source2, target2, reportErrors2) {
|
|
65717
65701
|
const targetTypes = target2.types;
|
|
65718
65702
|
if (target2.flags & 1048576 /* Union */) {
|
|
65719
65703
|
if (containsType(targetTypes, source2)) {
|
|
@@ -65731,10 +65715,7 @@ function createTypeChecker(host) {
|
|
|
65731
65715
|
match,
|
|
65732
65716
|
2 /* Target */,
|
|
65733
65717
|
/*reportErrors*/
|
|
65734
|
-
false
|
|
65735
|
-
/*headMessage*/
|
|
65736
|
-
void 0,
|
|
65737
|
-
intersectionState
|
|
65718
|
+
false
|
|
65738
65719
|
);
|
|
65739
65720
|
if (related) {
|
|
65740
65721
|
return related;
|
|
@@ -65747,10 +65728,7 @@ function createTypeChecker(host) {
|
|
|
65747
65728
|
type,
|
|
65748
65729
|
2 /* Target */,
|
|
65749
65730
|
/*reportErrors*/
|
|
65750
|
-
false
|
|
65751
|
-
/*headMessage*/
|
|
65752
|
-
void 0,
|
|
65753
|
-
intersectionState
|
|
65731
|
+
false
|
|
65754
65732
|
);
|
|
65755
65733
|
if (related) {
|
|
65756
65734
|
return related;
|
|
@@ -65764,10 +65742,7 @@ function createTypeChecker(host) {
|
|
|
65764
65742
|
bestMatchingType,
|
|
65765
65743
|
2 /* Target */,
|
|
65766
65744
|
/*reportErrors*/
|
|
65767
|
-
true
|
|
65768
|
-
/*headMessage*/
|
|
65769
|
-
void 0,
|
|
65770
|
-
intersectionState
|
|
65745
|
+
true
|
|
65771
65746
|
);
|
|
65772
65747
|
}
|
|
65773
65748
|
}
|
|
@@ -66565,6 +66540,13 @@ function createTypeChecker(host) {
|
|
|
66565
66540
|
return result2;
|
|
66566
66541
|
}
|
|
66567
66542
|
}
|
|
66543
|
+
} else {
|
|
66544
|
+
const distributiveConstraint = hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
|
|
66545
|
+
if (distributiveConstraint) {
|
|
66546
|
+
if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
|
|
66547
|
+
return result2;
|
|
66548
|
+
}
|
|
66549
|
+
}
|
|
66568
66550
|
}
|
|
66569
66551
|
const defaultConstraint = getDefaultConstraintOfConditionalType(source2);
|
|
66570
66552
|
if (defaultConstraint) {
|
|
@@ -66572,13 +66554,6 @@ function createTypeChecker(host) {
|
|
|
66572
66554
|
return result2;
|
|
66573
66555
|
}
|
|
66574
66556
|
}
|
|
66575
|
-
const distributiveConstraint = !(targetFlags & 16777216 /* Conditional */) && hasNonCircularBaseConstraint(source2) ? getConstraintOfDistributiveConditionalType(source2) : void 0;
|
|
66576
|
-
if (distributiveConstraint) {
|
|
66577
|
-
resetErrorInfo(saveErrorInfo);
|
|
66578
|
-
if (result2 = isRelatedTo(distributiveConstraint, target2, 1 /* Source */, reportErrors2)) {
|
|
66579
|
-
return result2;
|
|
66580
|
-
}
|
|
66581
|
-
}
|
|
66582
66557
|
} else {
|
|
66583
66558
|
if (relation !== subtypeRelation && relation !== strictSubtypeRelation && isPartialMappedType(target2) && isEmptyObjectType(source2)) {
|
|
66584
66559
|
return -1 /* True */;
|
|
@@ -68476,8 +68451,8 @@ function createTypeChecker(host) {
|
|
|
68476
68451
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
68477
68452
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
68478
68453
|
}
|
|
68479
|
-
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & 3145728 /* UnionOrIntersection */ && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68480
|
-
if (type.flags &
|
|
68454
|
+
const result = !!(type.flags & 465829888 /* Instantiable */ || type.flags & 524288 /* Object */ && !isNonGenericTopLevelType(type) && (objectFlags & 4 /* Reference */ && (type.node || some(getTypeArguments(type), couldContainTypeVariables)) || objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations || objectFlags & (32 /* Mapped */ | 1024 /* ReverseMapped */ | 4194304 /* ObjectRestType */ | 8388608 /* InstantiationExpressionType */)) || type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) && !(type.flags & 1024 /* EnumLiteral */) && !isNonGenericTopLevelType(type) && some(type.types, couldContainTypeVariables));
|
|
68455
|
+
if (type.flags & 138117121 /* ObjectFlagsType */) {
|
|
68481
68456
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
68482
68457
|
}
|
|
68483
68458
|
return result;
|
|
@@ -177574,6 +177549,7 @@ var Project3 = class _Project {
|
|
|
177574
177549
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
177575
177550
|
}
|
|
177576
177551
|
close() {
|
|
177552
|
+
var _a;
|
|
177577
177553
|
this.projectService.typingsCache.onProjectClosed(this);
|
|
177578
177554
|
this.closeWatchingTypingLocations();
|
|
177579
177555
|
this.cleanupProgram();
|
|
@@ -177590,6 +177566,11 @@ var Project3 = class _Project {
|
|
|
177590
177566
|
this.resolutionCache.clear();
|
|
177591
177567
|
this.resolutionCache = void 0;
|
|
177592
177568
|
this.cachedUnresolvedImportsPerFile = void 0;
|
|
177569
|
+
(_a = this.packageJsonWatches) == null ? void 0 : _a.forEach((watcher) => {
|
|
177570
|
+
watcher.projects.delete(this);
|
|
177571
|
+
watcher.close();
|
|
177572
|
+
});
|
|
177573
|
+
this.packageJsonWatches = void 0;
|
|
177593
177574
|
this.moduleSpecifierCache.clear();
|
|
177594
177575
|
this.moduleSpecifierCache = void 0;
|
|
177595
177576
|
this.directoryStructureHost = void 0;
|
|
@@ -177785,13 +177766,10 @@ var Project3 = class _Project {
|
|
|
177785
177766
|
}
|
|
177786
177767
|
}
|
|
177787
177768
|
/** @internal */
|
|
177788
|
-
onPackageJsonChange(
|
|
177789
|
-
|
|
177790
|
-
if (
|
|
177791
|
-
this.
|
|
177792
|
-
if (this.autoImportProviderHost) {
|
|
177793
|
-
this.autoImportProviderHost.markAsDirty();
|
|
177794
|
-
}
|
|
177769
|
+
onPackageJsonChange() {
|
|
177770
|
+
this.moduleSpecifierCache.clear();
|
|
177771
|
+
if (this.autoImportProviderHost) {
|
|
177772
|
+
this.autoImportProviderHost.markAsDirty();
|
|
177795
177773
|
}
|
|
177796
177774
|
}
|
|
177797
177775
|
/** @internal */
|
|
@@ -178465,7 +178443,7 @@ var Project3 = class _Project {
|
|
|
178465
178443
|
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
178466
178444
|
if (this.projectService.serverMode !== 0 /* Semantic */)
|
|
178467
178445
|
return emptyArray2;
|
|
178468
|
-
return this.projectService.getPackageJsonsVisibleToFile(fileName, rootDir);
|
|
178446
|
+
return this.projectService.getPackageJsonsVisibleToFile(fileName, this, rootDir);
|
|
178469
178447
|
}
|
|
178470
178448
|
/** @internal */
|
|
178471
178449
|
getNearestAncestorDirectoryWithPackageJson(fileName) {
|
|
@@ -178473,9 +178451,7 @@ var Project3 = class _Project {
|
|
|
178473
178451
|
}
|
|
178474
178452
|
/** @internal */
|
|
178475
178453
|
getPackageJsonsForAutoImport(rootDir) {
|
|
178476
|
-
|
|
178477
|
-
this.packageJsonsForAutoImport = new Set(packageJsons.map((p) => this.projectService.toPath(p.fileName)));
|
|
178478
|
-
return packageJsons;
|
|
178454
|
+
return this.getPackageJsonsVisibleToFile(combinePaths(this.currentDirectory, inferredTypesContainingFile), rootDir);
|
|
178479
178455
|
}
|
|
178480
178456
|
/** @internal */
|
|
178481
178457
|
getPackageJsonCache() {
|
|
@@ -180137,14 +180113,16 @@ var _ProjectService = class _ProjectService {
|
|
|
180137
180113
|
* @internal
|
|
180138
180114
|
*/
|
|
180139
180115
|
watchWildcardDirectory(directory, flags, configFileName, config) {
|
|
180140
|
-
|
|
180116
|
+
let watcher = this.watchFactory.watchDirectory(
|
|
180141
180117
|
directory,
|
|
180142
180118
|
(fileOrDirectory) => {
|
|
180143
180119
|
const fileOrDirectoryPath = this.toPath(fileOrDirectory);
|
|
180144
180120
|
const fsResult = config.cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
180145
180121
|
if (getBaseFileName(fileOrDirectoryPath) === "package.json" && !isInsideNodeModules(fileOrDirectoryPath) && (fsResult && fsResult.fileExists || !fsResult && this.host.fileExists(fileOrDirectory))) {
|
|
180146
|
-
|
|
180147
|
-
this.
|
|
180122
|
+
const file = this.getNormalizedAbsolutePath(fileOrDirectory);
|
|
180123
|
+
this.logger.info(`Config: ${configFileName} Detected new package.json: ${file}`);
|
|
180124
|
+
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
180125
|
+
this.watchPackageJsonFile(file, fileOrDirectoryPath, result);
|
|
180148
180126
|
}
|
|
180149
180127
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
180150
180128
|
if (isIgnoredFileFromWildCardWatching({
|
|
@@ -180193,6 +180171,22 @@ var _ProjectService = class _ProjectService {
|
|
|
180193
180171
|
WatchType.WildcardDirectory,
|
|
180194
180172
|
configFileName
|
|
180195
180173
|
);
|
|
180174
|
+
const result = {
|
|
180175
|
+
packageJsonWatches: void 0,
|
|
180176
|
+
close() {
|
|
180177
|
+
var _a;
|
|
180178
|
+
if (watcher) {
|
|
180179
|
+
watcher.close();
|
|
180180
|
+
watcher = void 0;
|
|
180181
|
+
(_a = result.packageJsonWatches) == null ? void 0 : _a.forEach((watcher2) => {
|
|
180182
|
+
watcher2.projects.delete(result);
|
|
180183
|
+
watcher2.close();
|
|
180184
|
+
});
|
|
180185
|
+
result.packageJsonWatches = void 0;
|
|
180186
|
+
}
|
|
180187
|
+
}
|
|
180188
|
+
};
|
|
180189
|
+
return result;
|
|
180196
180190
|
}
|
|
180197
180191
|
/** @internal */
|
|
180198
180192
|
delayUpdateProjectsFromParsedConfigOnConfigFileChange(canonicalConfigFilePath, loadReason) {
|
|
@@ -181276,9 +181270,9 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181276
181270
|
return;
|
|
181277
181271
|
const basename = getBaseFileName(fileOrDirectoryPath);
|
|
181278
181272
|
if (((_a = result.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.size) && (basename === "package.json" || basename === "node_modules")) {
|
|
181279
|
-
result.affectedModuleSpecifierCacheProjects.forEach((
|
|
181280
|
-
var _a2
|
|
181281
|
-
(
|
|
181273
|
+
result.affectedModuleSpecifierCacheProjects.forEach((project) => {
|
|
181274
|
+
var _a2;
|
|
181275
|
+
(_a2 = project.getModuleSpecifierCache()) == null ? void 0 : _a2.clear();
|
|
181282
181276
|
});
|
|
181283
181277
|
}
|
|
181284
181278
|
if (result.refreshScriptInfoRefCount) {
|
|
@@ -181320,12 +181314,12 @@ All files are: ${JSON.stringify(names)}`, "Err" /* Err */);
|
|
|
181320
181314
|
var _a;
|
|
181321
181315
|
const dirPath = this.toPath(dir);
|
|
181322
181316
|
const watcher = this.nodeModulesWatchers.get(dirPath) || this.createNodeModulesWatcher(dir, dirPath);
|
|
181323
|
-
Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project
|
|
181324
|
-
(watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project
|
|
181317
|
+
Debug.assert(!((_a = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a.has(project)));
|
|
181318
|
+
(watcher.affectedModuleSpecifierCacheProjects || (watcher.affectedModuleSpecifierCacheProjects = /* @__PURE__ */ new Set())).add(project);
|
|
181325
181319
|
return {
|
|
181326
181320
|
close: () => {
|
|
181327
181321
|
var _a2;
|
|
181328
|
-
(_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project
|
|
181322
|
+
(_a2 = watcher.affectedModuleSpecifierCacheProjects) == null ? void 0 : _a2.delete(project);
|
|
181329
181323
|
watcher.close();
|
|
181330
181324
|
}
|
|
181331
181325
|
};
|
|
@@ -181607,10 +181601,9 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
181607
181601
|
});
|
|
181608
181602
|
}
|
|
181609
181603
|
if (includePackageJsonAutoImports !== args.preferences.includePackageJsonAutoImports) {
|
|
181610
|
-
this.
|
|
181611
|
-
|
|
181612
|
-
|
|
181613
|
-
);
|
|
181604
|
+
this.forEachProject((project) => {
|
|
181605
|
+
project.onAutoImportProviderSettingsChanged();
|
|
181606
|
+
});
|
|
181614
181607
|
}
|
|
181615
181608
|
}
|
|
181616
181609
|
if (args.extraFileExtensions) {
|
|
@@ -182529,7 +182522,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182529
182522
|
this.currentPluginConfigOverrides.set(args.pluginName, args.configuration);
|
|
182530
182523
|
}
|
|
182531
182524
|
/** @internal */
|
|
182532
|
-
getPackageJsonsVisibleToFile(fileName, rootDir) {
|
|
182525
|
+
getPackageJsonsVisibleToFile(fileName, project, rootDir) {
|
|
182533
182526
|
const packageJsonCache = this.packageJsonCache;
|
|
182534
182527
|
const rootPath = rootDir && this.toPath(rootDir);
|
|
182535
182528
|
const result = [];
|
|
@@ -182540,7 +182533,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182540
182533
|
return processDirectory(directory);
|
|
182541
182534
|
case -1 /* True */:
|
|
182542
182535
|
const packageJsonFileName = combinePaths(directory, "package.json");
|
|
182543
|
-
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName));
|
|
182536
|
+
this.watchPackageJsonFile(packageJsonFileName, this.toPath(packageJsonFileName), project);
|
|
182544
182537
|
const info = packageJsonCache.getInDirectory(directory);
|
|
182545
182538
|
if (info)
|
|
182546
182539
|
result.push(info);
|
|
@@ -182566,40 +182559,54 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182566
182559
|
});
|
|
182567
182560
|
}
|
|
182568
182561
|
/** @internal */
|
|
182569
|
-
watchPackageJsonFile(file, path) {
|
|
182570
|
-
|
|
182571
|
-
|
|
182572
|
-
|
|
182573
|
-
|
|
182574
|
-
|
|
182575
|
-
|
|
182576
|
-
|
|
182577
|
-
|
|
182578
|
-
|
|
182579
|
-
|
|
182580
|
-
|
|
182581
|
-
|
|
182582
|
-
|
|
182583
|
-
|
|
182584
|
-
|
|
182585
|
-
|
|
182586
|
-
|
|
182587
|
-
|
|
182588
|
-
|
|
182589
|
-
|
|
182590
|
-
|
|
182591
|
-
|
|
182592
|
-
|
|
182593
|
-
this.hostConfiguration.watchOptions,
|
|
182594
|
-
WatchType.PackageJson
|
|
182595
|
-
)
|
|
182562
|
+
watchPackageJsonFile(file, path, project) {
|
|
182563
|
+
Debug.assert(project !== void 0);
|
|
182564
|
+
let result = (this.packageJsonFilesMap ?? (this.packageJsonFilesMap = /* @__PURE__ */ new Map())).get(path);
|
|
182565
|
+
if (!result) {
|
|
182566
|
+
let watcher = this.watchFactory.watchFile(
|
|
182567
|
+
file,
|
|
182568
|
+
(fileName, eventKind) => {
|
|
182569
|
+
switch (eventKind) {
|
|
182570
|
+
case 0 /* Created */:
|
|
182571
|
+
return Debug.fail();
|
|
182572
|
+
case 1 /* Changed */:
|
|
182573
|
+
this.packageJsonCache.addOrUpdate(fileName, path);
|
|
182574
|
+
this.onPackageJsonChange(result);
|
|
182575
|
+
break;
|
|
182576
|
+
case 2 /* Deleted */:
|
|
182577
|
+
this.packageJsonCache.delete(path);
|
|
182578
|
+
this.onPackageJsonChange(result);
|
|
182579
|
+
result.projects.clear();
|
|
182580
|
+
result.close();
|
|
182581
|
+
}
|
|
182582
|
+
},
|
|
182583
|
+
250 /* Low */,
|
|
182584
|
+
this.hostConfiguration.watchOptions,
|
|
182585
|
+
WatchType.PackageJson
|
|
182596
182586
|
);
|
|
182587
|
+
result = {
|
|
182588
|
+
projects: /* @__PURE__ */ new Set(),
|
|
182589
|
+
close: () => {
|
|
182590
|
+
var _a;
|
|
182591
|
+
if (result.projects.size || !watcher)
|
|
182592
|
+
return;
|
|
182593
|
+
watcher.close();
|
|
182594
|
+
watcher = void 0;
|
|
182595
|
+
(_a = this.packageJsonFilesMap) == null ? void 0 : _a.delete(path);
|
|
182596
|
+
this.packageJsonCache.invalidate(path);
|
|
182597
|
+
}
|
|
182598
|
+
};
|
|
182599
|
+
this.packageJsonFilesMap.set(path, result);
|
|
182597
182600
|
}
|
|
182601
|
+
result.projects.add(project);
|
|
182602
|
+
(project.packageJsonWatches ?? (project.packageJsonWatches = /* @__PURE__ */ new Set())).add(result);
|
|
182598
182603
|
}
|
|
182599
182604
|
/** @internal */
|
|
182600
|
-
|
|
182601
|
-
|
|
182602
|
-
|
|
182605
|
+
onPackageJsonChange(result) {
|
|
182606
|
+
result.projects.forEach((project) => {
|
|
182607
|
+
var _a;
|
|
182608
|
+
return (_a = project.onPackageJsonChange) == null ? void 0 : _a.call(project);
|
|
182609
|
+
});
|
|
182603
182610
|
}
|
|
182604
182611
|
/** @internal */
|
|
182605
182612
|
includePackageJsonAutoImports() {
|
|
@@ -182613,16 +182620,6 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
182613
182620
|
}
|
|
182614
182621
|
}
|
|
182615
182622
|
/** @internal */
|
|
182616
|
-
invalidateProjectPackageJson(packageJsonPath) {
|
|
182617
|
-
this.forEachProject((project) => {
|
|
182618
|
-
if (packageJsonPath) {
|
|
182619
|
-
project.onPackageJsonChange(packageJsonPath);
|
|
182620
|
-
} else {
|
|
182621
|
-
project.onAutoImportProviderSettingsChanged();
|
|
182622
|
-
}
|
|
182623
|
-
});
|
|
182624
|
-
}
|
|
182625
|
-
/** @internal */
|
|
182626
182623
|
getIncompleteCompletionsCache() {
|
|
182627
182624
|
return this.incompleteCompletionsCache || (this.incompleteCompletionsCache = createIncompleteCompletionsCache());
|
|
182628
182625
|
}
|
|
@@ -182757,6 +182754,7 @@ function createPackageJsonCache(host) {
|
|
|
182757
182754
|
const directoriesWithoutPackageJson = /* @__PURE__ */ new Map();
|
|
182758
182755
|
return {
|
|
182759
182756
|
addOrUpdate,
|
|
182757
|
+
invalidate,
|
|
182760
182758
|
delete: (fileName) => {
|
|
182761
182759
|
packageJsons.delete(fileName);
|
|
182762
182760
|
directoriesWithoutPackageJson.set(getDirectoryPath(fileName), true);
|
|
@@ -182785,6 +182783,10 @@ function createPackageJsonCache(host) {
|
|
|
182785
182783
|
packageJsons.set(path, packageJsonInfo);
|
|
182786
182784
|
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182787
182785
|
}
|
|
182786
|
+
function invalidate(path) {
|
|
182787
|
+
packageJsons.delete(path);
|
|
182788
|
+
directoriesWithoutPackageJson.delete(getDirectoryPath(path));
|
|
182789
|
+
}
|
|
182788
182790
|
function directoryHasPackageJson(directory) {
|
|
182789
182791
|
const path = host.toPath(directory);
|
|
182790
182792
|
return packageJsons.has(combinePaths(path, "package.json")) ? -1 /* True */ : directoriesWithoutPackageJson.has(path) ? 0 /* False */ : 3 /* Maybe */;
|