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