typescript 5.0.0-dev.20230214 → 5.0.0-dev.20230216
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 +115 -75
- package/lib/tsserver.js +130 -87
- package/lib/tsserverlibrary.d.ts +8 -5
- package/lib/tsserverlibrary.js +130 -87
- package/lib/typescript.d.ts +8 -5
- package/lib/typescript.js +130 -87
- package/lib/typingsInstaller.js +5 -4
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -23,7 +23,7 @@ var __export = (target, all) => {
|
|
|
23
23
|
|
|
24
24
|
// src/compiler/corePublic.ts
|
|
25
25
|
var versionMajorMinor = "5.0";
|
|
26
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
26
|
+
var version = `${versionMajorMinor}.0-dev.20230216`;
|
|
27
27
|
|
|
28
28
|
// src/compiler/core.ts
|
|
29
29
|
var emptyArray = [];
|
|
@@ -3748,13 +3748,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3748
3748
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3749
3749
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3750
3750
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
3751
|
-
TypeFlags2[TypeFlags2["Unit"] =
|
|
3751
|
+
TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
|
|
3752
|
+
TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
|
|
3752
3753
|
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
3753
3754
|
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
|
|
3754
3755
|
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
3755
3756
|
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
3756
3757
|
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
|
|
3757
|
-
TypeFlags2[TypeFlags2["Primitive"] =
|
|
3758
|
+
TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
|
|
3758
3759
|
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
|
|
3759
3760
|
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
|
|
3760
3761
|
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
|
|
@@ -26987,7 +26988,6 @@ var Parser;
|
|
|
26987
26988
|
return canFollowExportModifier();
|
|
26988
26989
|
case 88 /* DefaultKeyword */:
|
|
26989
26990
|
return nextTokenCanFollowDefaultKeyword();
|
|
26990
|
-
case 127 /* AccessorKeyword */:
|
|
26991
26991
|
case 124 /* StaticKeyword */:
|
|
26992
26992
|
case 137 /* GetKeyword */:
|
|
26993
26993
|
case 151 /* SetKeyword */:
|
|
@@ -42519,6 +42519,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
42519
42519
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
42520
42520
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
42521
42521
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
42522
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
42522
42523
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
42523
42524
|
return SignatureCheckMode3;
|
|
42524
42525
|
})(SignatureCheckMode || {});
|
|
@@ -42793,15 +42794,14 @@ function createTypeChecker(host) {
|
|
|
42793
42794
|
getTypeOfPropertyOfContextualType,
|
|
42794
42795
|
getFullyQualifiedName,
|
|
42795
42796
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
42796
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
42797
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
42797
42798
|
call,
|
|
42798
42799
|
candidatesOutArray,
|
|
42799
42800
|
/*argumentCount*/
|
|
42800
42801
|
void 0,
|
|
42801
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
42802
|
-
|
|
42803
|
-
),
|
|
42804
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
42802
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
42803
|
+
)),
|
|
42804
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
42805
42805
|
getExpandedParameters,
|
|
42806
42806
|
hasEffectiveRestParameter,
|
|
42807
42807
|
containsArgumentsReference,
|
|
@@ -42995,32 +42995,41 @@ function createTypeChecker(host) {
|
|
|
42995
42995
|
getMemberOverrideModifierStatus,
|
|
42996
42996
|
isTypeParameterPossiblyReferenced
|
|
42997
42997
|
};
|
|
42998
|
-
function
|
|
42998
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
42999
42999
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
43000
43000
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
43001
|
+
if (containingCall) {
|
|
43002
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
43003
|
+
}
|
|
43004
|
+
const result = fn();
|
|
43005
|
+
if (containingCall) {
|
|
43006
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
43007
|
+
}
|
|
43008
|
+
return result;
|
|
43009
|
+
}
|
|
43010
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
43011
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
43001
43012
|
if (containingCall) {
|
|
43002
43013
|
let toMarkSkip = node;
|
|
43003
43014
|
do {
|
|
43004
43015
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
43005
43016
|
toMarkSkip = toMarkSkip.parent;
|
|
43006
43017
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43007
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
43008
43018
|
}
|
|
43009
|
-
const result = fn
|
|
43019
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
43010
43020
|
if (containingCall) {
|
|
43011
43021
|
let toMarkSkip = node;
|
|
43012
43022
|
do {
|
|
43013
43023
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
43014
43024
|
toMarkSkip = toMarkSkip.parent;
|
|
43015
43025
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43016
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
43017
43026
|
}
|
|
43018
43027
|
return result;
|
|
43019
43028
|
}
|
|
43020
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
43029
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
43021
43030
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
43022
43031
|
apparentArgumentCount = argumentCount;
|
|
43023
|
-
const res = !node ? void 0 :
|
|
43032
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
43024
43033
|
apparentArgumentCount = void 0;
|
|
43025
43034
|
return res;
|
|
43026
43035
|
}
|
|
@@ -45982,7 +45991,7 @@ function createTypeChecker(host) {
|
|
|
45982
45991
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
45983
45992
|
}
|
|
45984
45993
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
45985
|
-
return !(resolvedExternalModuleType.flags &
|
|
45994
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
45986
45995
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
45987
45996
|
}
|
|
45988
45997
|
function getExportsOfSymbol(symbol) {
|
|
@@ -50181,8 +50190,8 @@ function createTypeChecker(host) {
|
|
|
50181
50190
|
const t = types[i];
|
|
50182
50191
|
flags |= t.flags;
|
|
50183
50192
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
50184
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
50185
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
50193
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
50194
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
50186
50195
|
if (baseType.flags & 1048576 /* Union */) {
|
|
50187
50196
|
const count = baseType.types.length;
|
|
50188
50197
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -52059,8 +52068,8 @@ function createTypeChecker(host) {
|
|
|
52059
52068
|
}
|
|
52060
52069
|
return links.declaredType;
|
|
52061
52070
|
}
|
|
52062
|
-
function
|
|
52063
|
-
return type.flags &
|
|
52071
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
52072
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
52064
52073
|
}
|
|
52065
52074
|
function getDeclaredTypeOfEnum(symbol) {
|
|
52066
52075
|
const links = getSymbolLinks(symbol);
|
|
@@ -52073,7 +52082,7 @@ function createTypeChecker(host) {
|
|
|
52073
52082
|
if (hasBindableName(member)) {
|
|
52074
52083
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
52075
52084
|
const value = getEnumMemberValue(member);
|
|
52076
|
-
const memberType = value !== void 0 ?
|
|
52085
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
52077
52086
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
52078
52087
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
52079
52088
|
}
|
|
@@ -52087,7 +52096,7 @@ function createTypeChecker(host) {
|
|
|
52087
52096
|
symbol,
|
|
52088
52097
|
/*aliasTypeArguments*/
|
|
52089
52098
|
void 0
|
|
52090
|
-
) :
|
|
52099
|
+
) : createComputedEnumType(symbol);
|
|
52091
52100
|
if (enumType.flags & 1048576 /* Union */) {
|
|
52092
52101
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
52093
52102
|
enumType.symbol = symbol;
|
|
@@ -52096,6 +52105,15 @@ function createTypeChecker(host) {
|
|
|
52096
52105
|
}
|
|
52097
52106
|
return links.declaredType;
|
|
52098
52107
|
}
|
|
52108
|
+
function createComputedEnumType(symbol) {
|
|
52109
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
52110
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
52111
|
+
regularType.regularType = regularType;
|
|
52112
|
+
regularType.freshType = freshType;
|
|
52113
|
+
freshType.regularType = regularType;
|
|
52114
|
+
freshType.freshType = freshType;
|
|
52115
|
+
return regularType;
|
|
52116
|
+
}
|
|
52099
52117
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
52100
52118
|
const links = getSymbolLinks(symbol);
|
|
52101
52119
|
if (!links.declaredType) {
|
|
@@ -55784,7 +55802,7 @@ function createTypeChecker(host) {
|
|
|
55784
55802
|
orderedRemoveItemAt(typeSet, 1);
|
|
55785
55803
|
}
|
|
55786
55804
|
}
|
|
55787
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55805
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55788
55806
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55789
55807
|
}
|
|
55790
55808
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -55915,7 +55933,7 @@ function createTypeChecker(host) {
|
|
|
55915
55933
|
type = undefinedType;
|
|
55916
55934
|
}
|
|
55917
55935
|
if (!typeSet.has(type.id.toString())) {
|
|
55918
|
-
if (type.flags &
|
|
55936
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
55919
55937
|
includes |= 67108864 /* NonPrimitive */;
|
|
55920
55938
|
}
|
|
55921
55939
|
typeSet.set(type.id.toString(), type);
|
|
@@ -56191,7 +56209,7 @@ function createTypeChecker(host) {
|
|
|
56191
56209
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
56192
56210
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
56193
56211
|
function isDistributive(type) {
|
|
56194
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
56212
|
+
return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
|
|
56195
56213
|
}
|
|
56196
56214
|
}
|
|
56197
56215
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -57288,7 +57306,7 @@ function createTypeChecker(host) {
|
|
|
57288
57306
|
return type;
|
|
57289
57307
|
}
|
|
57290
57308
|
function getFreshTypeOfLiteralType(type) {
|
|
57291
|
-
if (type.flags &
|
|
57309
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
57292
57310
|
if (!type.freshType) {
|
|
57293
57311
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
57294
57312
|
freshType.freshType = freshType;
|
|
@@ -57299,10 +57317,10 @@ function createTypeChecker(host) {
|
|
|
57299
57317
|
return type;
|
|
57300
57318
|
}
|
|
57301
57319
|
function getRegularTypeOfLiteralType(type) {
|
|
57302
|
-
return type.flags &
|
|
57320
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
57303
57321
|
}
|
|
57304
57322
|
function isFreshLiteralType(type) {
|
|
57305
|
-
return !!(type.flags &
|
|
57323
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
57306
57324
|
}
|
|
57307
57325
|
function getStringLiteralType(value) {
|
|
57308
57326
|
let type;
|
|
@@ -57981,13 +57999,13 @@ function createTypeChecker(host) {
|
|
|
57981
57999
|
return type;
|
|
57982
58000
|
}
|
|
57983
58001
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
57984
|
-
return type.flags & (
|
|
58002
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
57985
58003
|
}
|
|
57986
58004
|
function getPermissiveInstantiation(type) {
|
|
57987
|
-
return type.flags & (
|
|
58005
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
57988
58006
|
}
|
|
57989
58007
|
function getRestrictiveInstantiation(type) {
|
|
57990
|
-
if (type.flags & (
|
|
58008
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
57991
58009
|
return type;
|
|
57992
58010
|
}
|
|
57993
58011
|
if (type.restrictiveInstantiation) {
|
|
@@ -58567,7 +58585,7 @@ function createTypeChecker(host) {
|
|
|
58567
58585
|
}
|
|
58568
58586
|
}
|
|
58569
58587
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58570
|
-
if (target.flags & (
|
|
58588
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58571
58589
|
return false;
|
|
58572
58590
|
if (isTupleLikeType(source)) {
|
|
58573
58591
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -58616,7 +58634,7 @@ function createTypeChecker(host) {
|
|
|
58616
58634
|
}
|
|
58617
58635
|
}
|
|
58618
58636
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58619
|
-
if (target.flags & (
|
|
58637
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58620
58638
|
return false;
|
|
58621
58639
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
58622
58640
|
}
|
|
@@ -58639,16 +58657,24 @@ function createTypeChecker(host) {
|
|
|
58639
58657
|
void 0
|
|
58640
58658
|
) !== 0 /* False */;
|
|
58641
58659
|
}
|
|
58642
|
-
function
|
|
58643
|
-
|
|
58660
|
+
function isTopSignature(s) {
|
|
58661
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
58662
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
58663
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
58664
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
58665
|
+
}
|
|
58666
|
+
return false;
|
|
58644
58667
|
}
|
|
58645
58668
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
58646
58669
|
if (source === target) {
|
|
58647
58670
|
return -1 /* True */;
|
|
58648
58671
|
}
|
|
58649
|
-
if (
|
|
58672
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
58650
58673
|
return -1 /* True */;
|
|
58651
58674
|
}
|
|
58675
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
58676
|
+
return 0 /* False */;
|
|
58677
|
+
}
|
|
58652
58678
|
const targetCount = getParameterCount(target);
|
|
58653
58679
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
58654
58680
|
if (sourceHasMoreParameters) {
|
|
@@ -58866,7 +58892,9 @@ function createTypeChecker(host) {
|
|
|
58866
58892
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
58867
58893
|
const s = source.flags;
|
|
58868
58894
|
const t = target.flags;
|
|
58869
|
-
if (t &
|
|
58895
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
58896
|
+
return true;
|
|
58897
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
58870
58898
|
return true;
|
|
58871
58899
|
if (t & 131072 /* Never */)
|
|
58872
58900
|
return false;
|
|
@@ -59263,7 +59291,7 @@ function createTypeChecker(host) {
|
|
|
59263
59291
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
59264
59292
|
}
|
|
59265
59293
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
59266
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
59294
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
59267
59295
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
59268
59296
|
return -1 /* True */;
|
|
59269
59297
|
}
|
|
@@ -59327,7 +59355,7 @@ function createTypeChecker(host) {
|
|
|
59327
59355
|
return 0 /* False */;
|
|
59328
59356
|
}
|
|
59329
59357
|
}
|
|
59330
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
59358
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
|
|
59331
59359
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
59332
59360
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
59333
59361
|
if (reportErrors2) {
|
|
@@ -59389,7 +59417,7 @@ function createTypeChecker(host) {
|
|
|
59389
59417
|
maybeSuppress = !!errorInfo;
|
|
59390
59418
|
}
|
|
59391
59419
|
}
|
|
59392
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
59420
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
59393
59421
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
59394
59422
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
59395
59423
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -59535,15 +59563,15 @@ function createTypeChecker(host) {
|
|
|
59535
59563
|
}
|
|
59536
59564
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
59537
59565
|
if (source2.flags & 1048576 /* Union */) {
|
|
59538
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
59566
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
59539
59567
|
}
|
|
59540
59568
|
if (target2.flags & 1048576 /* Union */) {
|
|
59541
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
59569
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
59542
59570
|
}
|
|
59543
59571
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
59544
59572
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
59545
59573
|
}
|
|
59546
|
-
if (relation === comparableRelation && target2.flags &
|
|
59574
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
59547
59575
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
59548
59576
|
if (constraints !== source2.types) {
|
|
59549
59577
|
source2 = getIntersectionType(constraints);
|
|
@@ -60436,7 +60464,7 @@ function createTypeChecker(host) {
|
|
|
60436
60464
|
}
|
|
60437
60465
|
return 0 /* False */;
|
|
60438
60466
|
}
|
|
60439
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
60467
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
60440
60468
|
if (relation !== identityRelation) {
|
|
60441
60469
|
source2 = getApparentType(source2);
|
|
60442
60470
|
sourceFlags = source2.flags;
|
|
@@ -61106,10 +61134,11 @@ function createTypeChecker(host) {
|
|
|
61106
61134
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
61107
61135
|
}
|
|
61108
61136
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
61137
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
61109
61138
|
return compareSignaturesRelated(
|
|
61110
61139
|
erase ? getErasedSignature(source2) : source2,
|
|
61111
61140
|
erase ? getErasedSignature(target2) : target2,
|
|
61112
|
-
|
|
61141
|
+
checkMode,
|
|
61113
61142
|
reportErrors2,
|
|
61114
61143
|
reportError,
|
|
61115
61144
|
incompatibleReporter,
|
|
@@ -61234,7 +61263,7 @@ function createTypeChecker(host) {
|
|
|
61234
61263
|
if (sourceInfo) {
|
|
61235
61264
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
61236
61265
|
}
|
|
61237
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61266
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61238
61267
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
61239
61268
|
}
|
|
61240
61269
|
if (reportErrors2) {
|
|
@@ -61779,10 +61808,10 @@ function createTypeChecker(host) {
|
|
|
61779
61808
|
return void 0;
|
|
61780
61809
|
}
|
|
61781
61810
|
function isNeitherUnitTypeNorNever(type) {
|
|
61782
|
-
return !(type.flags & (
|
|
61811
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
61783
61812
|
}
|
|
61784
61813
|
function isUnitType(type) {
|
|
61785
|
-
return !!(type.flags &
|
|
61814
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
61786
61815
|
}
|
|
61787
61816
|
function isUnitLikeType(type) {
|
|
61788
61817
|
const t = getBaseConstraintOrType(type);
|
|
@@ -61795,7 +61824,7 @@ function createTypeChecker(host) {
|
|
|
61795
61824
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
61796
61825
|
}
|
|
61797
61826
|
function getBaseTypeOfLiteralType(type) {
|
|
61798
|
-
return type.flags &
|
|
61827
|
+
return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
|
|
61799
61828
|
}
|
|
61800
61829
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
61801
61830
|
var _a2;
|
|
@@ -61803,7 +61832,7 @@ function createTypeChecker(host) {
|
|
|
61803
61832
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
61804
61833
|
}
|
|
61805
61834
|
function getWidenedLiteralType(type) {
|
|
61806
|
-
return type.flags &
|
|
61835
|
+
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
61807
61836
|
}
|
|
61808
61837
|
function getWidenedUniqueESSymbolType(type) {
|
|
61809
61838
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -62336,8 +62365,8 @@ function createTypeChecker(host) {
|
|
|
62336
62365
|
}
|
|
62337
62366
|
return false;
|
|
62338
62367
|
}
|
|
62339
|
-
function isTypeParameterAtTopLevel(type,
|
|
62340
|
-
return !!(type ===
|
|
62368
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
62369
|
+
return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
|
|
62341
62370
|
}
|
|
62342
62371
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
62343
62372
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -62431,7 +62460,7 @@ function createTypeChecker(host) {
|
|
|
62431
62460
|
yield targetProp;
|
|
62432
62461
|
} else if (matchDiscriminantProperties) {
|
|
62433
62462
|
const targetType = getTypeOfSymbol(targetProp);
|
|
62434
|
-
if (targetType.flags &
|
|
62463
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
62435
62464
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
62436
62465
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
62437
62466
|
yield targetProp;
|
|
@@ -63190,7 +63219,7 @@ function createTypeChecker(host) {
|
|
|
63190
63219
|
}
|
|
63191
63220
|
function hasPrimitiveConstraint(type) {
|
|
63192
63221
|
const constraint = getConstraintOfTypeParameter(type);
|
|
63193
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
63222
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
63194
63223
|
}
|
|
63195
63224
|
function isObjectLiteralType(type) {
|
|
63196
63225
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -63672,7 +63701,7 @@ function createTypeChecker(host) {
|
|
|
63672
63701
|
return 83886079 /* UnknownFacts */;
|
|
63673
63702
|
}
|
|
63674
63703
|
function getIntersectionTypeFacts(type) {
|
|
63675
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
63704
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
63676
63705
|
let oredFacts = 0 /* None */;
|
|
63677
63706
|
let andedFacts = 134217727 /* All */;
|
|
63678
63707
|
for (const t of type.types) {
|
|
@@ -63871,7 +63900,7 @@ function createTypeChecker(host) {
|
|
|
63871
63900
|
}
|
|
63872
63901
|
return true;
|
|
63873
63902
|
}
|
|
63874
|
-
if (source.flags &
|
|
63903
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
63875
63904
|
return true;
|
|
63876
63905
|
}
|
|
63877
63906
|
return containsType(target.types, source);
|
|
@@ -64935,7 +64964,7 @@ function createTypeChecker(host) {
|
|
|
64935
64964
|
}
|
|
64936
64965
|
if (assumeTrue) {
|
|
64937
64966
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
64938
|
-
if (valueType.flags & (
|
|
64967
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
64939
64968
|
return valueType;
|
|
64940
64969
|
}
|
|
64941
64970
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -64985,7 +65014,7 @@ function createTypeChecker(host) {
|
|
|
64985
65014
|
let groundClauseTypes;
|
|
64986
65015
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
64987
65016
|
const t = clauseTypes[i];
|
|
64988
|
-
if (t.flags & (
|
|
65017
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
64989
65018
|
if (groundClauseTypes !== void 0) {
|
|
64990
65019
|
groundClauseTypes.push(t);
|
|
64991
65020
|
}
|
|
@@ -65133,18 +65162,29 @@ function createTypeChecker(host) {
|
|
|
65133
65162
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
65134
65163
|
}
|
|
65135
65164
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
65136
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65137
65165
|
if (!assumeTrue) {
|
|
65138
|
-
|
|
65166
|
+
if (checkDerived) {
|
|
65167
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
65168
|
+
}
|
|
65169
|
+
const trueType2 = getNarrowedType(
|
|
65170
|
+
type,
|
|
65171
|
+
candidate,
|
|
65172
|
+
/*assumeTrue*/
|
|
65173
|
+
true,
|
|
65174
|
+
/*checkDerived*/
|
|
65175
|
+
false
|
|
65176
|
+
);
|
|
65177
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
65139
65178
|
}
|
|
65140
65179
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
65141
65180
|
return candidate;
|
|
65142
65181
|
}
|
|
65182
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65143
65183
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
65144
65184
|
const narrowedType = mapType(candidate, (c) => {
|
|
65145
65185
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65146
65186
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65147
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
65187
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
65148
65188
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65149
65189
|
});
|
|
65150
65190
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -68484,7 +68524,7 @@ function createTypeChecker(host) {
|
|
|
68484
68524
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
68485
68525
|
let errorInfo;
|
|
68486
68526
|
let relatedInfo;
|
|
68487
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
68527
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
68488
68528
|
for (const subtype of containingType.types) {
|
|
68489
68529
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
68490
68530
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -69081,7 +69121,7 @@ function createTypeChecker(host) {
|
|
|
69081
69121
|
} else {
|
|
69082
69122
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69083
69123
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
69084
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
69124
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
69085
69125
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
69086
69126
|
flags.push(1 /* Required */);
|
|
69087
69127
|
}
|
|
@@ -72331,7 +72371,7 @@ function createTypeChecker(host) {
|
|
|
72331
72371
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
72332
72372
|
return silentNeverType;
|
|
72333
72373
|
}
|
|
72334
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
72374
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
72335
72375
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
72336
72376
|
}
|
|
72337
72377
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -72917,7 +72957,7 @@ function createTypeChecker(host) {
|
|
|
72917
72957
|
return leftType;
|
|
72918
72958
|
} else {
|
|
72919
72959
|
checkAssignmentOperator(rightType);
|
|
72920
|
-
return
|
|
72960
|
+
return rightType;
|
|
72921
72961
|
}
|
|
72922
72962
|
case 27 /* CommaToken */:
|
|
72923
72963
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -74850,7 +74890,7 @@ function createTypeChecker(host) {
|
|
|
74850
74890
|
))) {
|
|
74851
74891
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
74852
74892
|
}
|
|
74853
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74893
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74854
74894
|
return void 0;
|
|
74855
74895
|
}
|
|
74856
74896
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74902,7 +74942,7 @@ function createTypeChecker(host) {
|
|
|
74902
74942
|
return awaitedType || errorType;
|
|
74903
74943
|
}
|
|
74904
74944
|
function isThenableType(type) {
|
|
74905
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74945
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74906
74946
|
return false;
|
|
74907
74947
|
}
|
|
74908
74948
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74951,7 +74991,7 @@ function createTypeChecker(host) {
|
|
|
74951
74991
|
return awaitedType;
|
|
74952
74992
|
}
|
|
74953
74993
|
}
|
|
74954
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
74994
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
74955
74995
|
return type;
|
|
74956
74996
|
}
|
|
74957
74997
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -80300,7 +80340,7 @@ function createTypeChecker(host) {
|
|
|
80300
80340
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
80301
80341
|
}
|
|
80302
80342
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
80303
|
-
var _a2
|
|
80343
|
+
var _a2;
|
|
80304
80344
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
80305
80345
|
if (!typeName)
|
|
80306
80346
|
return 0 /* Unknown */;
|
|
@@ -80332,7 +80372,7 @@ function createTypeChecker(host) {
|
|
|
80332
80372
|
location
|
|
80333
80373
|
);
|
|
80334
80374
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
80335
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
80375
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
80336
80376
|
const typeSymbol = resolveEntityName(
|
|
80337
80377
|
typeName,
|
|
80338
80378
|
788968 /* Type */,
|
|
@@ -80483,7 +80523,7 @@ function createTypeChecker(host) {
|
|
|
80483
80523
|
return false;
|
|
80484
80524
|
}
|
|
80485
80525
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
80486
|
-
const enumResult = type.flags &
|
|
80526
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
80487
80527
|
type.symbol,
|
|
80488
80528
|
111551 /* Value */,
|
|
80489
80529
|
enclosing,
|
|
@@ -82044,7 +82084,7 @@ function createTypeChecker(host) {
|
|
|
82044
82084
|
}
|
|
82045
82085
|
function isSimpleLiteralEnumReference(expr) {
|
|
82046
82086
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
82047
|
-
return !!(checkExpressionCached(expr).flags &
|
|
82087
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
82048
82088
|
}
|
|
82049
82089
|
}
|
|
82050
82090
|
function checkAmbientInitializer(node) {
|
|
@@ -82446,10 +82486,10 @@ function createTypeChecker(host) {
|
|
|
82446
82486
|
}
|
|
82447
82487
|
function findMostOverlappyType(source, unionTarget) {
|
|
82448
82488
|
let bestMatch;
|
|
82449
|
-
if (!(source.flags & (
|
|
82489
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82450
82490
|
let matchingCount = 0;
|
|
82451
82491
|
for (const target of unionTarget.types) {
|
|
82452
|
-
if (!(target.flags & (
|
|
82492
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82453
82493
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
82454
82494
|
if (overlap.flags & 4194304 /* Index */) {
|
|
82455
82495
|
return target;
|
|
@@ -82467,7 +82507,7 @@ function createTypeChecker(host) {
|
|
|
82467
82507
|
}
|
|
82468
82508
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
82469
82509
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
82470
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
82510
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
82471
82511
|
if (!(result.flags & 131072 /* Never */)) {
|
|
82472
82512
|
return result;
|
|
82473
82513
|
}
|