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