@typescript-deploys/pr-build 5.4.0-pr-52968-11 → 5.4.0-pr-56247-3
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/lib.es5.d.ts +0 -5
- package/lib/tsc.js +58 -88
- package/lib/tsserver.js +59 -95
- package/lib/typescript.d.ts +4 -9
- package/lib/typescript.js +60 -96
- package/lib/typingsInstaller.js +5 -6
- package/package.json +2 -2
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1666,11 +1666,6 @@ type Capitalize<S extends string> = intrinsic;
|
|
|
1666
1666
|
*/
|
|
1667
1667
|
type Uncapitalize<S extends string> = intrinsic;
|
|
1668
1668
|
|
|
1669
|
-
/**
|
|
1670
|
-
* Blocks the contained type from participating in type inference.
|
|
1671
|
-
*/
|
|
1672
|
-
type NoInfer<T> = intrinsic;
|
|
1673
|
-
|
|
1674
1669
|
/**
|
|
1675
1670
|
* Marker for contextual 'this' type
|
|
1676
1671
|
*/
|
package/lib/tsc.js
CHANGED
|
@@ -3634,7 +3634,6 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3634
3634
|
TypeFlags2[TypeFlags2["NonPrimitive"] = 67108864] = "NonPrimitive";
|
|
3635
3635
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3636
3636
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3637
|
-
TypeFlags2[TypeFlags2["NoInfer"] = 536870912] = "NoInfer";
|
|
3638
3637
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3639
3638
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3640
3639
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3658,14 +3657,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3658
3657
|
TypeFlags2[TypeFlags2["UnionOrIntersection"] = 3145728] = "UnionOrIntersection";
|
|
3659
3658
|
TypeFlags2[TypeFlags2["StructuredType"] = 3670016] = "StructuredType";
|
|
3660
3659
|
TypeFlags2[TypeFlags2["TypeVariable"] = 8650752] = "TypeVariable";
|
|
3661
|
-
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] =
|
|
3660
|
+
TypeFlags2[TypeFlags2["InstantiableNonPrimitive"] = 58982400] = "InstantiableNonPrimitive";
|
|
3662
3661
|
TypeFlags2[TypeFlags2["InstantiablePrimitive"] = 406847488] = "InstantiablePrimitive";
|
|
3663
|
-
TypeFlags2[TypeFlags2["Instantiable"] =
|
|
3664
|
-
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] =
|
|
3662
|
+
TypeFlags2[TypeFlags2["Instantiable"] = 465829888] = "Instantiable";
|
|
3663
|
+
TypeFlags2[TypeFlags2["StructuredOrInstantiable"] = 469499904] = "StructuredOrInstantiable";
|
|
3665
3664
|
TypeFlags2[TypeFlags2["ObjectFlagsType"] = 3899393] = "ObjectFlagsType";
|
|
3666
3665
|
TypeFlags2[TypeFlags2["Simplifiable"] = 25165824] = "Simplifiable";
|
|
3667
3666
|
TypeFlags2[TypeFlags2["Singleton"] = 67358815] = "Singleton";
|
|
3668
|
-
TypeFlags2[TypeFlags2["Narrowable"] =
|
|
3667
|
+
TypeFlags2[TypeFlags2["Narrowable"] = 536624127] = "Narrowable";
|
|
3669
3668
|
TypeFlags2[TypeFlags2["IncludesMask"] = 473694207] = "IncludesMask";
|
|
3670
3669
|
TypeFlags2[TypeFlags2["IncludesMissingType"] = 262144 /* TypeParameter */] = "IncludesMissingType";
|
|
3671
3670
|
TypeFlags2[TypeFlags2["IncludesNonWideningType"] = 4194304 /* Index */] = "IncludesNonWideningType";
|
|
@@ -43233,7 +43232,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
43233
43232
|
return SignatureCheckMode3;
|
|
43234
43233
|
})(SignatureCheckMode || {});
|
|
43235
43234
|
var isNotOverloadAndNotAccessor = and(isNotOverload, isNotAccessor);
|
|
43236
|
-
var
|
|
43235
|
+
var intrinsicTypeKinds = new Map(Object.entries({
|
|
43237
43236
|
Uppercase: 0 /* Uppercase */,
|
|
43238
43237
|
Lowercase: 1 /* Lowercase */,
|
|
43239
43238
|
Capitalize: 2 /* Capitalize */,
|
|
@@ -43790,7 +43789,7 @@ function createTypeChecker(host) {
|
|
|
43790
43789
|
var enumLiteralTypes = /* @__PURE__ */ new Map();
|
|
43791
43790
|
var indexedAccessTypes = /* @__PURE__ */ new Map();
|
|
43792
43791
|
var templateLiteralTypes = /* @__PURE__ */ new Map();
|
|
43793
|
-
var
|
|
43792
|
+
var stringMappingTypes = /* @__PURE__ */ new Map();
|
|
43794
43793
|
var substitutionTypes = /* @__PURE__ */ new Map();
|
|
43795
43794
|
var subtypeReductionCache = /* @__PURE__ */ new Map();
|
|
43796
43795
|
var decoratorContextOverrideTypeCache = /* @__PURE__ */ new Map();
|
|
@@ -48066,10 +48065,6 @@ function createTypeChecker(host) {
|
|
|
48066
48065
|
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
48067
48066
|
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
48068
48067
|
}
|
|
48069
|
-
if (type.flags & 536870912 /* NoInfer */) {
|
|
48070
|
-
const typeNode = typeToTypeNodeHelper(type.type, context);
|
|
48071
|
-
return symbolToTypeNode(type.symbol, context, 788968 /* Type */, [typeNode]);
|
|
48072
|
-
}
|
|
48073
48068
|
if (type.flags & 8388608 /* IndexedAccess */) {
|
|
48074
48069
|
const objectTypeNode = typeToTypeNodeHelper(type.objectType, context);
|
|
48075
48070
|
const indexTypeNode = typeToTypeNodeHelper(type.indexType, context);
|
|
@@ -49572,7 +49567,7 @@ function createTypeChecker(host) {
|
|
|
49572
49567
|
return factory.createStringLiteral(name, !!singleQuote);
|
|
49573
49568
|
}
|
|
49574
49569
|
if (isNumericLiteralName(name) && startsWith(name, "-")) {
|
|
49575
|
-
return factory.createComputedPropertyName(factory.createNumericLiteral(
|
|
49570
|
+
return factory.createComputedPropertyName(factory.createPrefixUnaryExpression(41 /* MinusToken */, factory.createNumericLiteral(-name)));
|
|
49576
49571
|
}
|
|
49577
49572
|
return createPropertyNameNodeForIdentifierOrLiteral(name, getEmitScriptTarget(compilerOptions), singleQuote, stringNamed, isMethod);
|
|
49578
49573
|
}
|
|
@@ -51773,10 +51768,10 @@ function createTypeChecker(host) {
|
|
|
51773
51768
|
return result;
|
|
51774
51769
|
}
|
|
51775
51770
|
function isGenericTypeWithUndefinedConstraint(type) {
|
|
51776
|
-
return !!(type.flags &
|
|
51771
|
+
return !!(type.flags & 465829888 /* Instantiable */) && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 32768 /* Undefined */);
|
|
51777
51772
|
}
|
|
51778
51773
|
function getNonUndefinedType(type) {
|
|
51779
|
-
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags &
|
|
51774
|
+
const typeOrConstraint = someType(type, isGenericTypeWithUndefinedConstraint) ? mapType(type, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOrType(t) : t) : type;
|
|
51780
51775
|
return getTypeWithFacts(typeOrConstraint, 524288 /* NEUndefined */);
|
|
51781
51776
|
}
|
|
51782
51777
|
function getFlowTypeOfDestructuring(node, declaredType) {
|
|
@@ -51874,7 +51869,7 @@ function createTypeChecker(host) {
|
|
|
51874
51869
|
const elementType = checkIteratedTypeOrElementType(65 /* Destructuring */ | (declaration.dotDotDotToken ? 0 : 128 /* PossiblyOutOfBounds */), parentType, undefinedType, pattern);
|
|
51875
51870
|
const index = pattern.elements.indexOf(declaration);
|
|
51876
51871
|
if (declaration.dotDotDotToken) {
|
|
51877
|
-
const baseConstraint = mapType(parentType, (t) => t.flags &
|
|
51872
|
+
const baseConstraint = mapType(parentType, (t) => t.flags & 58982400 /* InstantiableNonPrimitive */ ? getBaseConstraintOrType(t) : t);
|
|
51878
51873
|
type = everyType(baseConstraint, isTupleType) ? mapType(baseConstraint, (t) => sliceTupleType(t, index)) : createArrayType(elementType);
|
|
51879
51874
|
} else if (isArrayLikeType(parentType)) {
|
|
51880
51875
|
const indexType = getNumberLiteralType(index);
|
|
@@ -54673,7 +54668,7 @@ function createTypeChecker(host) {
|
|
|
54673
54668
|
let constraints;
|
|
54674
54669
|
let hasDisjointDomainType = false;
|
|
54675
54670
|
for (const t of types) {
|
|
54676
|
-
if (t.flags &
|
|
54671
|
+
if (t.flags & 465829888 /* Instantiable */) {
|
|
54677
54672
|
let constraint = getConstraintOfType(t);
|
|
54678
54673
|
while (constraint && constraint.flags & (262144 /* TypeParameter */ | 4194304 /* Index */ | 16777216 /* Conditional */)) {
|
|
54679
54674
|
constraint = getConstraintOfType(constraint);
|
|
@@ -54705,7 +54700,7 @@ function createTypeChecker(host) {
|
|
|
54705
54700
|
return void 0;
|
|
54706
54701
|
}
|
|
54707
54702
|
function getBaseConstraintOfType(type) {
|
|
54708
|
-
if (type.flags & (
|
|
54703
|
+
if (type.flags & (58982400 /* InstantiableNonPrimitive */ | 3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || isGenericTupleType(type)) {
|
|
54709
54704
|
const constraint = getResolvedBaseConstraint(type);
|
|
54710
54705
|
return constraint !== noConstraintType && constraint !== circularConstraintType ? constraint : void 0;
|
|
54711
54706
|
}
|
|
@@ -54796,9 +54791,6 @@ function createTypeChecker(host) {
|
|
|
54796
54791
|
const constraint = getBaseConstraint(t.type);
|
|
54797
54792
|
return constraint && constraint !== t.type ? getStringMappingType(t.symbol, constraint) : stringType;
|
|
54798
54793
|
}
|
|
54799
|
-
if (t.flags & 536870912 /* NoInfer */) {
|
|
54800
|
-
return getBaseConstraint(t.type);
|
|
54801
|
-
}
|
|
54802
54794
|
if (t.flags & 8388608 /* IndexedAccess */) {
|
|
54803
54795
|
if (isMappedTypeGenericIndexedAccess(t)) {
|
|
54804
54796
|
return getBaseConstraint(substituteIndexedMappedType(t.objectType, t.indexType));
|
|
@@ -54879,7 +54871,7 @@ function createTypeChecker(host) {
|
|
|
54879
54871
|
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
|
|
54880
54872
|
}
|
|
54881
54873
|
function getApparentType(type) {
|
|
54882
|
-
const t = type.flags &
|
|
54874
|
+
const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
|
|
54883
54875
|
const objectFlags = getObjectFlags(t);
|
|
54884
54876
|
return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
|
|
54885
54877
|
}
|
|
@@ -55988,11 +55980,8 @@ function createTypeChecker(host) {
|
|
|
55988
55980
|
}
|
|
55989
55981
|
function getTypeAliasInstantiation(symbol, typeArguments, aliasSymbol, aliasTypeArguments) {
|
|
55990
55982
|
const type = getDeclaredTypeOfSymbol(symbol);
|
|
55991
|
-
if (type === intrinsicMarkerType && typeArguments && typeArguments.length === 1) {
|
|
55992
|
-
|
|
55993
|
-
return getStringMappingType(symbol, typeArguments[0]);
|
|
55994
|
-
}
|
|
55995
|
-
return getNoInferType(symbol, typeArguments[0]);
|
|
55983
|
+
if (type === intrinsicMarkerType && intrinsicTypeKinds.has(symbol.escapedName) && typeArguments && typeArguments.length === 1) {
|
|
55984
|
+
return getStringMappingType(symbol, typeArguments[0]);
|
|
55996
55985
|
}
|
|
55997
55986
|
const links = getSymbolLinks(symbol);
|
|
55998
55987
|
const typeParameters = links.typeParameters;
|
|
@@ -56906,7 +56895,7 @@ function createTypeChecker(host) {
|
|
|
56906
56895
|
const type = elementTypes[i];
|
|
56907
56896
|
const flags = target.elementFlags[i];
|
|
56908
56897
|
if (flags & 8 /* Variadic */) {
|
|
56909
|
-
if (type.flags &
|
|
56898
|
+
if (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type)) {
|
|
56910
56899
|
addElement(type, 8 /* Variadic */, (_a = target.labeledElementDeclarations) == null ? void 0 : _a[i]);
|
|
56911
56900
|
} else if (isTupleType(type)) {
|
|
56912
56901
|
const elements = getElementTypes(type);
|
|
@@ -57013,7 +57002,7 @@ function createTypeChecker(host) {
|
|
|
57013
57002
|
const flags = type.flags;
|
|
57014
57003
|
if (!(flags & 131072 /* Never */)) {
|
|
57015
57004
|
includes |= flags & 473694207 /* IncludesMask */;
|
|
57016
|
-
if (flags &
|
|
57005
|
+
if (flags & 465829888 /* Instantiable */)
|
|
57017
57006
|
includes |= 33554432 /* IncludesInstantiable */;
|
|
57018
57007
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */)
|
|
57019
57008
|
includes |= 268435456 /* IncludesConstrainedTypeVariable */;
|
|
@@ -57059,14 +57048,14 @@ function createTypeChecker(host) {
|
|
|
57059
57048
|
while (i > 0) {
|
|
57060
57049
|
i--;
|
|
57061
57050
|
const source = types[i];
|
|
57062
|
-
if (hasEmptyObject || source.flags &
|
|
57051
|
+
if (hasEmptyObject || source.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
57063
57052
|
if (source.flags & 262144 /* TypeParameter */ && getBaseConstraintOrType(source).flags & 1048576 /* Union */) {
|
|
57064
57053
|
if (isTypeRelatedTo(source, getUnionType(map(types, (t) => t === source ? neverType : t)), strictSubtypeRelation)) {
|
|
57065
57054
|
orderedRemoveItemAt(types, i);
|
|
57066
57055
|
}
|
|
57067
57056
|
continue;
|
|
57068
57057
|
}
|
|
57069
|
-
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
57058
|
+
const keyProperty = source.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */) ? find(getPropertiesOfType(source), (p) => isUnitType(getTypeOfSymbol(p))) : void 0;
|
|
57070
57059
|
const keyPropertyType = keyProperty && getRegularTypeOfLiteralType(getTypeOfSymbol(keyProperty));
|
|
57071
57060
|
for (const target of types) {
|
|
57072
57061
|
if (source !== target) {
|
|
@@ -57079,7 +57068,7 @@ function createTypeChecker(host) {
|
|
|
57079
57068
|
}
|
|
57080
57069
|
}
|
|
57081
57070
|
count++;
|
|
57082
|
-
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
57071
|
+
if (keyProperty && target.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
57083
57072
|
const t = getTypeOfPropertyOfType(target, keyProperty.escapedName);
|
|
57084
57073
|
if (t && isUnitType(t) && getRegularTypeOfLiteralType(t) !== keyPropertyType) {
|
|
57085
57074
|
continue;
|
|
@@ -57679,7 +57668,7 @@ function createTypeChecker(host) {
|
|
|
57679
57668
|
);
|
|
57680
57669
|
}
|
|
57681
57670
|
function shouldDeferIndexType(type, indexFlags = 0 /* None */) {
|
|
57682
|
-
return !!(type.flags &
|
|
57671
|
+
return !!(type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && (!hasDistributiveNameType(type) || getMappedTypeNameTypeKind(type) === 2 /* Remapping */) || type.flags & 1048576 /* Union */ && !(indexFlags & 4 /* NoReducibleCheck */) && isGenericReducibleType(type) || type.flags & 2097152 /* Intersection */ && maybeTypeOfKind(type, 465829888 /* Instantiable */) && some(type.types, isEmptyAnonymousObjectType));
|
|
57683
57672
|
}
|
|
57684
57673
|
function getIndexType(type, indexFlags = defaultIndexFlags) {
|
|
57685
57674
|
type = getReducedType(type);
|
|
@@ -57797,19 +57786,8 @@ function createTypeChecker(host) {
|
|
|
57797
57786
|
)
|
|
57798
57787
|
);
|
|
57799
57788
|
}
|
|
57800
|
-
function getNoInferType(symbol, type) {
|
|
57801
|
-
if (!isGenericType(type)) {
|
|
57802
|
-
return type;
|
|
57803
|
-
}
|
|
57804
|
-
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
57805
|
-
let result = intrinsicWrapperTypes.get(id);
|
|
57806
|
-
if (!result) {
|
|
57807
|
-
intrinsicWrapperTypes.set(id, result = createNoInferType(symbol, type));
|
|
57808
|
-
}
|
|
57809
|
-
return result;
|
|
57810
|
-
}
|
|
57811
57789
|
function applyStringMapping(symbol, str) {
|
|
57812
|
-
switch (
|
|
57790
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
57813
57791
|
case 0 /* Uppercase */:
|
|
57814
57792
|
return str.toUpperCase();
|
|
57815
57793
|
case 1 /* Lowercase */:
|
|
@@ -57822,7 +57800,7 @@ function createTypeChecker(host) {
|
|
|
57822
57800
|
return str;
|
|
57823
57801
|
}
|
|
57824
57802
|
function applyTemplateStringMapping(symbol, texts, types) {
|
|
57825
|
-
switch (
|
|
57803
|
+
switch (intrinsicTypeKinds.get(symbol.escapedName)) {
|
|
57826
57804
|
case 0 /* Uppercase */:
|
|
57827
57805
|
return [texts.map((t) => t.toUpperCase()), types.map((t) => getStringMappingType(symbol, t))];
|
|
57828
57806
|
case 1 /* Lowercase */:
|
|
@@ -57836,9 +57814,9 @@ function createTypeChecker(host) {
|
|
|
57836
57814
|
}
|
|
57837
57815
|
function getStringMappingTypeForGenericType(symbol, type) {
|
|
57838
57816
|
const id = `${getSymbolId(symbol)},${getTypeId(type)}`;
|
|
57839
|
-
let result =
|
|
57817
|
+
let result = stringMappingTypes.get(id);
|
|
57840
57818
|
if (!result) {
|
|
57841
|
-
|
|
57819
|
+
stringMappingTypes.set(id, result = createStringMappingType(symbol, type));
|
|
57842
57820
|
}
|
|
57843
57821
|
return result;
|
|
57844
57822
|
}
|
|
@@ -57847,11 +57825,6 @@ function createTypeChecker(host) {
|
|
|
57847
57825
|
result.type = type;
|
|
57848
57826
|
return result;
|
|
57849
57827
|
}
|
|
57850
|
-
function createNoInferType(symbol, type) {
|
|
57851
|
-
const result = createTypeWithSymbol(536870912 /* NoInfer */, symbol);
|
|
57852
|
-
result.type = type;
|
|
57853
|
-
return result;
|
|
57854
|
-
}
|
|
57855
57828
|
function createIndexedAccessType(objectType, indexType, accessFlags, aliasSymbol, aliasTypeArguments) {
|
|
57856
57829
|
const type = createType(8388608 /* IndexedAccess */);
|
|
57857
57830
|
type.objectType = objectType;
|
|
@@ -57874,7 +57847,7 @@ function createTypeChecker(host) {
|
|
|
57874
57847
|
if (type.flags & 2097152 /* Intersection */) {
|
|
57875
57848
|
return some(type.types, isJSLiteralType);
|
|
57876
57849
|
}
|
|
57877
|
-
if (type.flags &
|
|
57850
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
57878
57851
|
const constraint = getResolvedBaseConstraint(type);
|
|
57879
57852
|
return constraint !== type && isJSLiteralType(constraint);
|
|
57880
57853
|
}
|
|
@@ -58131,7 +58104,7 @@ function createTypeChecker(host) {
|
|
|
58131
58104
|
}
|
|
58132
58105
|
return type.objectFlags & 12582912 /* IsGenericType */;
|
|
58133
58106
|
}
|
|
58134
|
-
return (type.flags &
|
|
58107
|
+
return (type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericMappedType(type) || isGenericTupleType(type) ? 4194304 /* IsGenericObjectType */ : 0) | (type.flags & (58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) && !isPatternLiteralType(type) ? 8388608 /* IsGenericIndexType */ : 0);
|
|
58135
58108
|
}
|
|
58136
58109
|
function getSimplifiedType(type, writing) {
|
|
58137
58110
|
return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) : type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) : type;
|
|
@@ -58160,7 +58133,7 @@ function createTypeChecker(host) {
|
|
|
58160
58133
|
if (distributedOverIndex) {
|
|
58161
58134
|
return type[cache] = distributedOverIndex;
|
|
58162
58135
|
}
|
|
58163
|
-
if (!(indexType.flags &
|
|
58136
|
+
if (!(indexType.flags & 465829888 /* Instantiable */)) {
|
|
58164
58137
|
const distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
|
|
58165
58138
|
if (distributedOverObject) {
|
|
58166
58139
|
return type[cache] = distributedOverObject;
|
|
@@ -59237,7 +59210,7 @@ function createTypeChecker(host) {
|
|
|
59237
59210
|
return mapTypeWithAlias(
|
|
59238
59211
|
getReducedType(mappedTypeVariable),
|
|
59239
59212
|
(t) => {
|
|
59240
|
-
if (t.flags & (3 /* AnyOrUnknown */ |
|
|
59213
|
+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
59241
59214
|
if (!type.declaration.nameType) {
|
|
59242
59215
|
let constraint;
|
|
59243
59216
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
@@ -59409,9 +59382,6 @@ function createTypeChecker(host) {
|
|
|
59409
59382
|
if (flags & 268435456 /* StringMapping */) {
|
|
59410
59383
|
return getStringMappingType(type.symbol, instantiateType(type.type, mapper));
|
|
59411
59384
|
}
|
|
59412
|
-
if (flags & 536870912 /* NoInfer */) {
|
|
59413
|
-
return getNoInferType(type.symbol, instantiateType(type.type, mapper));
|
|
59414
|
-
}
|
|
59415
59385
|
if (flags & 8388608 /* IndexedAccess */) {
|
|
59416
59386
|
const newAliasSymbol = aliasSymbol || type.aliasSymbol;
|
|
59417
59387
|
const newAliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(type.aliasTypeArguments, mapper);
|
|
@@ -59571,7 +59541,7 @@ function createTypeChecker(host) {
|
|
|
59571
59541
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
59572
59542
|
}
|
|
59573
59543
|
function isTypeDerivedFrom(source, target) {
|
|
59574
|
-
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags &
|
|
59544
|
+
return source.flags & 1048576 /* Union */ ? every(source.types, (t) => isTypeDerivedFrom(t, target)) : target.flags & 1048576 /* Union */ ? some(target.types, (t) => isTypeDerivedFrom(source, t)) : source.flags & 2097152 /* Intersection */ ? some(source.types, (t) => isTypeDerivedFrom(t, target)) : source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) : isEmptyAnonymousObjectType(target) ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) : target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) && !isEmptyAnonymousObjectType(source) : target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) : hasBaseType(source, getTargetType(target)) || isArrayType(target) && !isReadonlyArrayType(target) && isTypeDerivedFrom(source, globalReadonlyArrayType);
|
|
59575
59545
|
}
|
|
59576
59546
|
function isTypeComparableTo(source, target) {
|
|
59577
59547
|
return isTypeRelatedTo(source, target, comparableRelation);
|
|
@@ -60450,7 +60420,7 @@ function createTypeChecker(host) {
|
|
|
60450
60420
|
return !!(related & 1 /* Succeeded */);
|
|
60451
60421
|
}
|
|
60452
60422
|
}
|
|
60453
|
-
if (source.flags &
|
|
60423
|
+
if (source.flags & 469499904 /* StructuredOrInstantiable */ || target.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60454
60424
|
return checkTypeRelatedTo(
|
|
60455
60425
|
source,
|
|
60456
60426
|
target,
|
|
@@ -60466,7 +60436,7 @@ function createTypeChecker(host) {
|
|
|
60466
60436
|
}
|
|
60467
60437
|
function getNormalizedType(type, writing) {
|
|
60468
60438
|
while (true) {
|
|
60469
|
-
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type
|
|
60439
|
+
const t = isFreshLiteralType(type) ? type.regularType : isGenericTupleType(type) ? getNormalizedTupleType(type, writing) : getObjectFlags(type) & 4 /* Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : type.flags & 33554432 /* Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* Simplifiable */ ? getSimplifiedType(type, writing) : type;
|
|
60470
60440
|
if (t === type)
|
|
60471
60441
|
return t;
|
|
60472
60442
|
type = t;
|
|
@@ -60855,7 +60825,7 @@ function createTypeChecker(host) {
|
|
|
60855
60825
|
}
|
|
60856
60826
|
if (relation === comparableRelation && !(target2.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(target2, source2, relation) || isSimpleTypeRelatedTo(source2, target2, relation, reportErrors2 ? reportError : void 0))
|
|
60857
60827
|
return -1 /* True */;
|
|
60858
|
-
if (source2.flags &
|
|
60828
|
+
if (source2.flags & 469499904 /* StructuredOrInstantiable */ || target2.flags & 469499904 /* StructuredOrInstantiable */) {
|
|
60859
60829
|
const isPerformingExcessPropertyChecks = !(intersectionState & 2 /* Target */) && (isObjectLiteralType(source2) && getObjectFlags(source2) & 8192 /* FreshLiteral */);
|
|
60860
60830
|
if (isPerformingExcessPropertyChecks) {
|
|
60861
60831
|
if (hasExcessProperties(source2, target2, reportErrors2)) {
|
|
@@ -60894,7 +60864,7 @@ function createTypeChecker(host) {
|
|
|
60894
60864
|
return 0 /* False */;
|
|
60895
60865
|
}
|
|
60896
60866
|
traceUnionsOrIntersectionsTooLarge(source2, target2);
|
|
60897
|
-
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags &
|
|
60867
|
+
const skipCaching = source2.flags & 1048576 /* Union */ && source2.types.length < 4 && !(target2.flags & 1048576 /* Union */) || target2.flags & 1048576 /* Union */ && target2.types.length < 4 && !(source2.flags & 469499904 /* StructuredOrInstantiable */);
|
|
60898
60868
|
const result2 = skipCaching ? unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) : recursiveTypeRelatedTo(source2, target2, reportErrors2, intersectionState, recursionFlags);
|
|
60899
60869
|
if (result2) {
|
|
60900
60870
|
return result2;
|
|
@@ -61083,7 +61053,7 @@ function createTypeChecker(host) {
|
|
|
61083
61053
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
61084
61054
|
}
|
|
61085
61055
|
if (relation === comparableRelation && target2.flags & 402784252 /* Primitive */) {
|
|
61086
|
-
const constraints = sameMap(source2.types, (t) => t.flags &
|
|
61056
|
+
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
61087
61057
|
if (constraints !== source2.types) {
|
|
61088
61058
|
source2 = getIntersectionType(constraints);
|
|
61089
61059
|
if (source2.flags & 131072 /* Never */) {
|
|
@@ -61675,7 +61645,7 @@ function createTypeChecker(host) {
|
|
|
61675
61645
|
if (result2 = unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState)) {
|
|
61676
61646
|
return result2;
|
|
61677
61647
|
}
|
|
61678
|
-
if (!(sourceFlags &
|
|
61648
|
+
if (!(sourceFlags & 465829888 /* Instantiable */ || sourceFlags & 524288 /* Object */ && targetFlags & 1048576 /* Union */ || sourceFlags & 2097152 /* Intersection */ && targetFlags & (524288 /* Object */ | 1048576 /* Union */ | 465829888 /* Instantiable */))) {
|
|
61679
61649
|
return 0 /* False */;
|
|
61680
61650
|
}
|
|
61681
61651
|
}
|
|
@@ -62838,7 +62808,7 @@ function createTypeChecker(host) {
|
|
|
62838
62808
|
if (type.flags & 3145728 /* UnionOrIntersection */) {
|
|
62839
62809
|
return !!forEach(type.types, typeCouldHaveTopLevelSingletonTypes);
|
|
62840
62810
|
}
|
|
62841
|
-
if (type.flags &
|
|
62811
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
62842
62812
|
const constraint = getConstraintOfType(type);
|
|
62843
62813
|
if (constraint && constraint !== type) {
|
|
62844
62814
|
return typeCouldHaveTopLevelSingletonTypes(constraint);
|
|
@@ -63895,7 +63865,7 @@ function createTypeChecker(host) {
|
|
|
63895
63865
|
if (objectFlags & 524288 /* CouldContainTypeVariablesComputed */) {
|
|
63896
63866
|
return !!(objectFlags & 1048576 /* CouldContainTypeVariables */);
|
|
63897
63867
|
}
|
|
63898
|
-
const result = !!(type.flags &
|
|
63868
|
+
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));
|
|
63899
63869
|
if (type.flags & 3899393 /* ObjectFlagsType */) {
|
|
63900
63870
|
type.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (result ? 1048576 /* CouldContainTypeVariables */ : 0);
|
|
63901
63871
|
}
|
|
@@ -64187,7 +64157,7 @@ function createTypeChecker(host) {
|
|
|
64187
64157
|
let expandingFlags = 0 /* None */;
|
|
64188
64158
|
inferFromTypes(originalSource, originalTarget);
|
|
64189
64159
|
function inferFromTypes(source, target) {
|
|
64190
|
-
if (!couldContainTypeVariables(target)
|
|
64160
|
+
if (!couldContainTypeVariables(target)) {
|
|
64191
64161
|
return;
|
|
64192
64162
|
}
|
|
64193
64163
|
if (source === wildcardType || source === blockedStringType) {
|
|
@@ -64290,7 +64260,7 @@ function createTypeChecker(host) {
|
|
|
64290
64260
|
/*writing*/
|
|
64291
64261
|
false
|
|
64292
64262
|
);
|
|
64293
|
-
if (indexType.flags &
|
|
64263
|
+
if (indexType.flags & 465829888 /* Instantiable */) {
|
|
64294
64264
|
const simplified2 = distributeIndexOverObjectType(
|
|
64295
64265
|
getSimplifiedType(
|
|
64296
64266
|
target.objectType,
|
|
@@ -64337,7 +64307,7 @@ function createTypeChecker(host) {
|
|
|
64337
64307
|
inferToTemplateLiteralType(source, target);
|
|
64338
64308
|
} else {
|
|
64339
64309
|
source = getReducedType(source);
|
|
64340
|
-
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ |
|
|
64310
|
+
if (!(priority & 512 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */))) {
|
|
64341
64311
|
const apparentSource = getApparentType(source);
|
|
64342
64312
|
if (apparentSource !== source && !(apparentSource.flags & (524288 /* Object */ | 2097152 /* Intersection */))) {
|
|
64343
64313
|
return inferFromTypes(apparentSource, target);
|
|
@@ -65080,7 +65050,7 @@ function createTypeChecker(host) {
|
|
|
65080
65050
|
const map2 = /* @__PURE__ */ new Map();
|
|
65081
65051
|
let count = 0;
|
|
65082
65052
|
for (const type of types) {
|
|
65083
|
-
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ |
|
|
65053
|
+
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
65084
65054
|
const discriminant = getTypeOfPropertyOfType(type, name);
|
|
65085
65055
|
if (discriminant) {
|
|
65086
65056
|
if (!isLiteralType(discriminant)) {
|
|
@@ -65106,11 +65076,11 @@ function createTypeChecker(host) {
|
|
|
65106
65076
|
}
|
|
65107
65077
|
function getKeyPropertyName(unionType) {
|
|
65108
65078
|
const types = unionType.types;
|
|
65109
|
-
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ |
|
|
65079
|
+
if (types.length < 10 || getObjectFlags(unionType) & 32768 /* PrimitiveUnion */ || countWhere(types, (t) => !!(t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */))) < 10) {
|
|
65110
65080
|
return void 0;
|
|
65111
65081
|
}
|
|
65112
65082
|
if (unionType.keyPropertyName === void 0) {
|
|
65113
|
-
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ |
|
|
65083
|
+
const keyPropertyName = forEach(types, (t) => t.flags & (524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) ? forEach(getPropertiesOfType(t), (p) => isUnitType(getTypeOfSymbol(p)) ? p.escapedName : void 0) : void 0);
|
|
65114
65084
|
const mapByKeyProperty = keyPropertyName && mapTypesByKeyProperty(types, keyPropertyName);
|
|
65115
65085
|
unionType.keyPropertyName = mapByKeyProperty ? keyPropertyName : "";
|
|
65116
65086
|
unionType.constituentMap = mapByKeyProperty;
|
|
@@ -65193,7 +65163,7 @@ function createTypeChecker(host) {
|
|
|
65193
65163
|
return getTypeFacts(type, mask) !== 0;
|
|
65194
65164
|
}
|
|
65195
65165
|
function getTypeFactsWorker(type, callerOnlyNeeds) {
|
|
65196
|
-
if (type.flags & (2097152 /* Intersection */ |
|
|
65166
|
+
if (type.flags & (2097152 /* Intersection */ | 465829888 /* Instantiable */)) {
|
|
65197
65167
|
type = getBaseConstraintOfType(type) || unknownType;
|
|
65198
65168
|
}
|
|
65199
65169
|
const flags = type.flags;
|
|
@@ -66821,7 +66791,7 @@ function createTypeChecker(host) {
|
|
|
66821
66791
|
matching || type,
|
|
66822
66792
|
checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType
|
|
66823
66793
|
);
|
|
66824
|
-
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t,
|
|
66794
|
+
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
66825
66795
|
});
|
|
66826
66796
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
66827
66797
|
}
|
|
@@ -67009,10 +66979,10 @@ function createTypeChecker(host) {
|
|
|
67009
66979
|
return parent.kind === 211 /* PropertyAccessExpression */ || parent.kind === 166 /* QualifiedName */ || parent.kind === 213 /* CallExpression */ && parent.expression === node || parent.kind === 212 /* ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
67010
66980
|
}
|
|
67011
66981
|
function isGenericTypeWithUnionConstraint(type) {
|
|
67012
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags &
|
|
66982
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithUnionConstraint) : !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
67013
66983
|
}
|
|
67014
66984
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
67015
|
-
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags &
|
|
66985
|
+
return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
|
|
67016
66986
|
}
|
|
67017
66987
|
function hasContextualTypeWithNoGenericTypes(node, checkMode) {
|
|
67018
66988
|
const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 32 /* RestBindingElement */ ? getContextualType(node, 8 /* SkipBindingPatterns */) : getContextualType(
|
|
@@ -67909,7 +67879,7 @@ function createTypeChecker(host) {
|
|
|
67909
67879
|
const functionFlags = getFunctionFlags(functionDecl);
|
|
67910
67880
|
if (functionFlags & 1 /* Generator */) {
|
|
67911
67881
|
return filterType(returnType2, (t) => {
|
|
67912
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
67882
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || checkGeneratorInstantiationAssignabilityToReturnType(
|
|
67913
67883
|
t,
|
|
67914
67884
|
functionFlags,
|
|
67915
67885
|
/*errorNode*/
|
|
@@ -67919,7 +67889,7 @@ function createTypeChecker(host) {
|
|
|
67919
67889
|
}
|
|
67920
67890
|
if (functionFlags & 2 /* Async */) {
|
|
67921
67891
|
return filterType(returnType2, (t) => {
|
|
67922
|
-
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ |
|
|
67892
|
+
return !!(t.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */ | 58982400 /* InstantiableNonPrimitive */)) || !!getAwaitedTypeOfPromise(t);
|
|
67923
67893
|
});
|
|
67924
67894
|
}
|
|
67925
67895
|
return returnType2;
|
|
@@ -68398,7 +68368,7 @@ function createTypeChecker(host) {
|
|
|
68398
68368
|
}
|
|
68399
68369
|
}
|
|
68400
68370
|
function instantiateContextualType(contextualType, node, contextFlags) {
|
|
68401
|
-
if (contextualType && maybeTypeOfKind(contextualType,
|
|
68371
|
+
if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* Instantiable */)) {
|
|
68402
68372
|
const inferenceContext = getInferenceContext(node);
|
|
68403
68373
|
if (inferenceContext && contextFlags & 1 /* Signature */ && some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) {
|
|
68404
68374
|
return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
|
|
@@ -68411,7 +68381,7 @@ function createTypeChecker(host) {
|
|
|
68411
68381
|
return contextualType;
|
|
68412
68382
|
}
|
|
68413
68383
|
function instantiateInstantiableTypes(type, mapper) {
|
|
68414
|
-
if (type.flags &
|
|
68384
|
+
if (type.flags & 465829888 /* Instantiable */) {
|
|
68415
68385
|
return instantiateType(type, mapper);
|
|
68416
68386
|
}
|
|
68417
68387
|
if (type.flags & 1048576 /* Union */) {
|
|
@@ -69169,7 +69139,7 @@ function createTypeChecker(host) {
|
|
|
69169
69139
|
}
|
|
69170
69140
|
function isValidSpreadType(type) {
|
|
69171
69141
|
const t = removeDefinitelyFalsyTypes(mapType(type, getBaseConstraintOrType));
|
|
69172
|
-
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ |
|
|
69142
|
+
return !!(t.flags & (1 /* Any */ | 67108864 /* NonPrimitive */ | 524288 /* Object */ | 58982400 /* InstantiableNonPrimitive */) || t.flags & 3145728 /* UnionOrIntersection */ && every(t.types, isValidSpreadType));
|
|
69173
69143
|
}
|
|
69174
69144
|
function checkJsxSelfClosingElementDeferred(node) {
|
|
69175
69145
|
checkJsxOpeningLikeElementOrOpeningFragment(node);
|
|
@@ -72849,7 +72819,7 @@ function createTypeChecker(host) {
|
|
|
72849
72819
|
result3.node = node;
|
|
72850
72820
|
return result3;
|
|
72851
72821
|
}
|
|
72852
|
-
} else if (type2.flags &
|
|
72822
|
+
} else if (type2.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
72853
72823
|
const constraint = getBaseConstraintOfType(type2);
|
|
72854
72824
|
if (constraint) {
|
|
72855
72825
|
const instantiated = getInstantiatedTypePart(constraint);
|
|
@@ -75212,7 +75182,7 @@ function createTypeChecker(host) {
|
|
|
75212
75182
|
return evaluated ? getFreshTypeOfLiteralType(getStringLiteralType(evaluated)) : stringType;
|
|
75213
75183
|
}
|
|
75214
75184
|
function isTemplateLiteralContextualType(type) {
|
|
75215
|
-
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags &
|
|
75185
|
+
return !!(type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */) || type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* StringLike */));
|
|
75216
75186
|
}
|
|
75217
75187
|
function getContextNode(node) {
|
|
75218
75188
|
if (isJsxAttributes(node) && !isJsxSelfClosingElement(node.parent)) {
|
|
@@ -75325,7 +75295,7 @@ function createTypeChecker(host) {
|
|
|
75325
75295
|
const types = contextualType.types;
|
|
75326
75296
|
return some(types, (t) => isLiteralOfContextualType(candidateType, t));
|
|
75327
75297
|
}
|
|
75328
|
-
if (contextualType.flags &
|
|
75298
|
+
if (contextualType.flags & 58982400 /* InstantiableNonPrimitive */) {
|
|
75329
75299
|
const constraint = getBaseConstraintOfType(contextualType) || unknownType;
|
|
75330
75300
|
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) || maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) || maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) || maybeTypeOfKind(constraint, 4096 /* ESSymbol */) && maybeTypeOfKind(candidateType, 8192 /* UniqueESSymbol */) || isLiteralOfContextualType(candidateType, constraint);
|
|
75331
75301
|
}
|
|
@@ -78395,7 +78365,7 @@ function createTypeChecker(host) {
|
|
|
78395
78365
|
);
|
|
78396
78366
|
}
|
|
78397
78367
|
}
|
|
78398
|
-
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ |
|
|
78368
|
+
if (rightType === neverType || !isTypeAssignableToKind(rightType, 67108864 /* NonPrimitive */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
78399
78369
|
error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_here_has_type_0, typeToString(rightType));
|
|
78400
78370
|
}
|
|
78401
78371
|
checkSourceElement(node.statement);
|
|
@@ -80054,7 +80024,7 @@ function createTypeChecker(host) {
|
|
|
80054
80024
|
checkExportsOnMergedDeclarations(node);
|
|
80055
80025
|
checkTypeParameters(node.typeParameters);
|
|
80056
80026
|
if (node.type.kind === 141 /* IntrinsicKeyword */) {
|
|
80057
|
-
if (!
|
|
80027
|
+
if (!intrinsicTypeKinds.has(node.name.escapedText) || length(node.typeParameters) !== 1) {
|
|
80058
80028
|
error(node.type, Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types);
|
|
80059
80029
|
}
|
|
80060
80030
|
} else {
|