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/tsserver.js
CHANGED
|
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2287
|
|
|
2288
2288
|
// src/compiler/corePublic.ts
|
|
2289
2289
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2290
|
+
var version = `${versionMajorMinor}.0-dev.20230215`;
|
|
2291
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6671,13 +6671,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6671
6671
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
6672
6672
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
6673
6673
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
6674
|
-
TypeFlags2[TypeFlags2["Unit"] =
|
|
6674
|
+
TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
|
|
6675
|
+
TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
|
|
6675
6676
|
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
6676
6677
|
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
|
|
6677
6678
|
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
6678
6679
|
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
6679
6680
|
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
|
|
6680
|
-
TypeFlags2[TypeFlags2["Primitive"] =
|
|
6681
|
+
TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
|
|
6681
6682
|
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
|
|
6682
6683
|
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
|
|
6683
6684
|
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
|
|
@@ -47095,6 +47096,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
47095
47096
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
47096
47097
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
47097
47098
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
47099
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
47098
47100
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
47099
47101
|
return SignatureCheckMode3;
|
|
47100
47102
|
})(SignatureCheckMode || {});
|
|
@@ -47369,15 +47371,14 @@ function createTypeChecker(host) {
|
|
|
47369
47371
|
getTypeOfPropertyOfContextualType,
|
|
47370
47372
|
getFullyQualifiedName,
|
|
47371
47373
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
47372
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
47374
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
47373
47375
|
call,
|
|
47374
47376
|
candidatesOutArray,
|
|
47375
47377
|
/*argumentCount*/
|
|
47376
47378
|
void 0,
|
|
47377
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
47378
|
-
|
|
47379
|
-
),
|
|
47380
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
47379
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
47380
|
+
)),
|
|
47381
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
47381
47382
|
getExpandedParameters,
|
|
47382
47383
|
hasEffectiveRestParameter,
|
|
47383
47384
|
containsArgumentsReference,
|
|
@@ -47571,32 +47572,41 @@ function createTypeChecker(host) {
|
|
|
47571
47572
|
getMemberOverrideModifierStatus,
|
|
47572
47573
|
isTypeParameterPossiblyReferenced
|
|
47573
47574
|
};
|
|
47574
|
-
function
|
|
47575
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
47575
47576
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
47576
47577
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
47578
|
+
if (containingCall) {
|
|
47579
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
47580
|
+
}
|
|
47581
|
+
const result = fn();
|
|
47582
|
+
if (containingCall) {
|
|
47583
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47584
|
+
}
|
|
47585
|
+
return result;
|
|
47586
|
+
}
|
|
47587
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
47588
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
47577
47589
|
if (containingCall) {
|
|
47578
47590
|
let toMarkSkip = node;
|
|
47579
47591
|
do {
|
|
47580
47592
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
47581
47593
|
toMarkSkip = toMarkSkip.parent;
|
|
47582
47594
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47583
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
47584
47595
|
}
|
|
47585
|
-
const result = fn
|
|
47596
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
47586
47597
|
if (containingCall) {
|
|
47587
47598
|
let toMarkSkip = node;
|
|
47588
47599
|
do {
|
|
47589
47600
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
47590
47601
|
toMarkSkip = toMarkSkip.parent;
|
|
47591
47602
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47592
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47593
47603
|
}
|
|
47594
47604
|
return result;
|
|
47595
47605
|
}
|
|
47596
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
47606
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47597
47607
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
47598
47608
|
apparentArgumentCount = argumentCount;
|
|
47599
|
-
const res = !node ? void 0 :
|
|
47609
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
47600
47610
|
apparentArgumentCount = void 0;
|
|
47601
47611
|
return res;
|
|
47602
47612
|
}
|
|
@@ -50558,7 +50568,7 @@ function createTypeChecker(host) {
|
|
|
50558
50568
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
50559
50569
|
}
|
|
50560
50570
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
50561
|
-
return !(resolvedExternalModuleType.flags &
|
|
50571
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
50562
50572
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
50563
50573
|
}
|
|
50564
50574
|
function getExportsOfSymbol(symbol) {
|
|
@@ -54757,8 +54767,8 @@ function createTypeChecker(host) {
|
|
|
54757
54767
|
const t = types[i];
|
|
54758
54768
|
flags |= t.flags;
|
|
54759
54769
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
54760
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
54761
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
54770
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
54771
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
54762
54772
|
if (baseType.flags & 1048576 /* Union */) {
|
|
54763
54773
|
const count = baseType.types.length;
|
|
54764
54774
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -56635,8 +56645,8 @@ function createTypeChecker(host) {
|
|
|
56635
56645
|
}
|
|
56636
56646
|
return links.declaredType;
|
|
56637
56647
|
}
|
|
56638
|
-
function
|
|
56639
|
-
return type.flags &
|
|
56648
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
56649
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
56640
56650
|
}
|
|
56641
56651
|
function getDeclaredTypeOfEnum(symbol) {
|
|
56642
56652
|
const links = getSymbolLinks(symbol);
|
|
@@ -56649,7 +56659,7 @@ function createTypeChecker(host) {
|
|
|
56649
56659
|
if (hasBindableName(member)) {
|
|
56650
56660
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
56651
56661
|
const value = getEnumMemberValue(member);
|
|
56652
|
-
const memberType = value !== void 0 ?
|
|
56662
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
56653
56663
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
56654
56664
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
56655
56665
|
}
|
|
@@ -56663,7 +56673,7 @@ function createTypeChecker(host) {
|
|
|
56663
56673
|
symbol,
|
|
56664
56674
|
/*aliasTypeArguments*/
|
|
56665
56675
|
void 0
|
|
56666
|
-
) :
|
|
56676
|
+
) : createComputedEnumType(symbol);
|
|
56667
56677
|
if (enumType.flags & 1048576 /* Union */) {
|
|
56668
56678
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
56669
56679
|
enumType.symbol = symbol;
|
|
@@ -56672,6 +56682,15 @@ function createTypeChecker(host) {
|
|
|
56672
56682
|
}
|
|
56673
56683
|
return links.declaredType;
|
|
56674
56684
|
}
|
|
56685
|
+
function createComputedEnumType(symbol) {
|
|
56686
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
56687
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
56688
|
+
regularType.regularType = regularType;
|
|
56689
|
+
regularType.freshType = freshType;
|
|
56690
|
+
freshType.regularType = regularType;
|
|
56691
|
+
freshType.freshType = freshType;
|
|
56692
|
+
return regularType;
|
|
56693
|
+
}
|
|
56675
56694
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
56676
56695
|
const links = getSymbolLinks(symbol);
|
|
56677
56696
|
if (!links.declaredType) {
|
|
@@ -60360,7 +60379,7 @@ function createTypeChecker(host) {
|
|
|
60360
60379
|
orderedRemoveItemAt(typeSet, 1);
|
|
60361
60380
|
}
|
|
60362
60381
|
}
|
|
60363
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
60382
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
60364
60383
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
60365
60384
|
}
|
|
60366
60385
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -60491,7 +60510,7 @@ function createTypeChecker(host) {
|
|
|
60491
60510
|
type = undefinedType;
|
|
60492
60511
|
}
|
|
60493
60512
|
if (!typeSet.has(type.id.toString())) {
|
|
60494
|
-
if (type.flags &
|
|
60513
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
60495
60514
|
includes |= 67108864 /* NonPrimitive */;
|
|
60496
60515
|
}
|
|
60497
60516
|
typeSet.set(type.id.toString(), type);
|
|
@@ -60767,7 +60786,7 @@ function createTypeChecker(host) {
|
|
|
60767
60786
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
60768
60787
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
60769
60788
|
function isDistributive(type) {
|
|
60770
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
60789
|
+
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;
|
|
60771
60790
|
}
|
|
60772
60791
|
}
|
|
60773
60792
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -61864,7 +61883,7 @@ function createTypeChecker(host) {
|
|
|
61864
61883
|
return type;
|
|
61865
61884
|
}
|
|
61866
61885
|
function getFreshTypeOfLiteralType(type) {
|
|
61867
|
-
if (type.flags &
|
|
61886
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
61868
61887
|
if (!type.freshType) {
|
|
61869
61888
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
61870
61889
|
freshType.freshType = freshType;
|
|
@@ -61875,10 +61894,10 @@ function createTypeChecker(host) {
|
|
|
61875
61894
|
return type;
|
|
61876
61895
|
}
|
|
61877
61896
|
function getRegularTypeOfLiteralType(type) {
|
|
61878
|
-
return type.flags &
|
|
61897
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
61879
61898
|
}
|
|
61880
61899
|
function isFreshLiteralType(type) {
|
|
61881
|
-
return !!(type.flags &
|
|
61900
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
61882
61901
|
}
|
|
61883
61902
|
function getStringLiteralType(value) {
|
|
61884
61903
|
let type;
|
|
@@ -62557,13 +62576,13 @@ function createTypeChecker(host) {
|
|
|
62557
62576
|
return type;
|
|
62558
62577
|
}
|
|
62559
62578
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
62560
|
-
return type.flags & (
|
|
62579
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
62561
62580
|
}
|
|
62562
62581
|
function getPermissiveInstantiation(type) {
|
|
62563
|
-
return type.flags & (
|
|
62582
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
62564
62583
|
}
|
|
62565
62584
|
function getRestrictiveInstantiation(type) {
|
|
62566
|
-
if (type.flags & (
|
|
62585
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
62567
62586
|
return type;
|
|
62568
62587
|
}
|
|
62569
62588
|
if (type.restrictiveInstantiation) {
|
|
@@ -63143,7 +63162,7 @@ function createTypeChecker(host) {
|
|
|
63143
63162
|
}
|
|
63144
63163
|
}
|
|
63145
63164
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
63146
|
-
if (target.flags & (
|
|
63165
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
63147
63166
|
return false;
|
|
63148
63167
|
if (isTupleLikeType(source)) {
|
|
63149
63168
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -63192,7 +63211,7 @@ function createTypeChecker(host) {
|
|
|
63192
63211
|
}
|
|
63193
63212
|
}
|
|
63194
63213
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
63195
|
-
if (target.flags & (
|
|
63214
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
63196
63215
|
return false;
|
|
63197
63216
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
63198
63217
|
}
|
|
@@ -63215,16 +63234,24 @@ function createTypeChecker(host) {
|
|
|
63215
63234
|
void 0
|
|
63216
63235
|
) !== 0 /* False */;
|
|
63217
63236
|
}
|
|
63218
|
-
function
|
|
63219
|
-
|
|
63237
|
+
function isTopSignature(s) {
|
|
63238
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
63239
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
63240
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
63241
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
63242
|
+
}
|
|
63243
|
+
return false;
|
|
63220
63244
|
}
|
|
63221
63245
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
63222
63246
|
if (source === target) {
|
|
63223
63247
|
return -1 /* True */;
|
|
63224
63248
|
}
|
|
63225
|
-
if (
|
|
63249
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
63226
63250
|
return -1 /* True */;
|
|
63227
63251
|
}
|
|
63252
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
63253
|
+
return 0 /* False */;
|
|
63254
|
+
}
|
|
63228
63255
|
const targetCount = getParameterCount(target);
|
|
63229
63256
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
63230
63257
|
if (sourceHasMoreParameters) {
|
|
@@ -63442,7 +63469,9 @@ function createTypeChecker(host) {
|
|
|
63442
63469
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
63443
63470
|
const s = source.flags;
|
|
63444
63471
|
const t = target.flags;
|
|
63445
|
-
if (t &
|
|
63472
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
63473
|
+
return true;
|
|
63474
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
63446
63475
|
return true;
|
|
63447
63476
|
if (t & 131072 /* Never */)
|
|
63448
63477
|
return false;
|
|
@@ -63839,7 +63868,7 @@ function createTypeChecker(host) {
|
|
|
63839
63868
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
63840
63869
|
}
|
|
63841
63870
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
63842
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
63871
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
63843
63872
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
63844
63873
|
return -1 /* True */;
|
|
63845
63874
|
}
|
|
@@ -63903,7 +63932,7 @@ function createTypeChecker(host) {
|
|
|
63903
63932
|
return 0 /* False */;
|
|
63904
63933
|
}
|
|
63905
63934
|
}
|
|
63906
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
63935
|
+
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));
|
|
63907
63936
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
63908
63937
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
63909
63938
|
if (reportErrors2) {
|
|
@@ -63965,7 +63994,7 @@ function createTypeChecker(host) {
|
|
|
63965
63994
|
maybeSuppress = !!errorInfo;
|
|
63966
63995
|
}
|
|
63967
63996
|
}
|
|
63968
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
63997
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
63969
63998
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
63970
63999
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
63971
64000
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -64111,15 +64140,15 @@ function createTypeChecker(host) {
|
|
|
64111
64140
|
}
|
|
64112
64141
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
64113
64142
|
if (source2.flags & 1048576 /* Union */) {
|
|
64114
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
64143
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
64115
64144
|
}
|
|
64116
64145
|
if (target2.flags & 1048576 /* Union */) {
|
|
64117
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
64146
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
64118
64147
|
}
|
|
64119
64148
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
64120
64149
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
64121
64150
|
}
|
|
64122
|
-
if (relation === comparableRelation && target2.flags &
|
|
64151
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
64123
64152
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
64124
64153
|
if (constraints !== source2.types) {
|
|
64125
64154
|
source2 = getIntersectionType(constraints);
|
|
@@ -65012,7 +65041,7 @@ function createTypeChecker(host) {
|
|
|
65012
65041
|
}
|
|
65013
65042
|
return 0 /* False */;
|
|
65014
65043
|
}
|
|
65015
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
65044
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
65016
65045
|
if (relation !== identityRelation) {
|
|
65017
65046
|
source2 = getApparentType(source2);
|
|
65018
65047
|
sourceFlags = source2.flags;
|
|
@@ -65682,10 +65711,11 @@ function createTypeChecker(host) {
|
|
|
65682
65711
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
65683
65712
|
}
|
|
65684
65713
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
65714
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
65685
65715
|
return compareSignaturesRelated(
|
|
65686
65716
|
erase ? getErasedSignature(source2) : source2,
|
|
65687
65717
|
erase ? getErasedSignature(target2) : target2,
|
|
65688
|
-
|
|
65718
|
+
checkMode,
|
|
65689
65719
|
reportErrors2,
|
|
65690
65720
|
reportError,
|
|
65691
65721
|
incompatibleReporter,
|
|
@@ -65810,7 +65840,7 @@ function createTypeChecker(host) {
|
|
|
65810
65840
|
if (sourceInfo) {
|
|
65811
65841
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
65812
65842
|
}
|
|
65813
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
65843
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
65814
65844
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
65815
65845
|
}
|
|
65816
65846
|
if (reportErrors2) {
|
|
@@ -66355,10 +66385,10 @@ function createTypeChecker(host) {
|
|
|
66355
66385
|
return void 0;
|
|
66356
66386
|
}
|
|
66357
66387
|
function isNeitherUnitTypeNorNever(type) {
|
|
66358
|
-
return !(type.flags & (
|
|
66388
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
66359
66389
|
}
|
|
66360
66390
|
function isUnitType(type) {
|
|
66361
|
-
return !!(type.flags &
|
|
66391
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
66362
66392
|
}
|
|
66363
66393
|
function isUnitLikeType(type) {
|
|
66364
66394
|
const t = getBaseConstraintOrType(type);
|
|
@@ -66371,7 +66401,7 @@ function createTypeChecker(host) {
|
|
|
66371
66401
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
66372
66402
|
}
|
|
66373
66403
|
function getBaseTypeOfLiteralType(type) {
|
|
66374
|
-
return type.flags &
|
|
66404
|
+
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;
|
|
66375
66405
|
}
|
|
66376
66406
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
66377
66407
|
var _a2;
|
|
@@ -66379,7 +66409,7 @@ function createTypeChecker(host) {
|
|
|
66379
66409
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
66380
66410
|
}
|
|
66381
66411
|
function getWidenedLiteralType(type) {
|
|
66382
|
-
return type.flags &
|
|
66412
|
+
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;
|
|
66383
66413
|
}
|
|
66384
66414
|
function getWidenedUniqueESSymbolType(type) {
|
|
66385
66415
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -66912,8 +66942,8 @@ function createTypeChecker(host) {
|
|
|
66912
66942
|
}
|
|
66913
66943
|
return false;
|
|
66914
66944
|
}
|
|
66915
|
-
function isTypeParameterAtTopLevel(type,
|
|
66916
|
-
return !!(type ===
|
|
66945
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
66946
|
+
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)));
|
|
66917
66947
|
}
|
|
66918
66948
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
66919
66949
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -67007,7 +67037,7 @@ function createTypeChecker(host) {
|
|
|
67007
67037
|
yield targetProp;
|
|
67008
67038
|
} else if (matchDiscriminantProperties) {
|
|
67009
67039
|
const targetType = getTypeOfSymbol(targetProp);
|
|
67010
|
-
if (targetType.flags &
|
|
67040
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
67011
67041
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
67012
67042
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
67013
67043
|
yield targetProp;
|
|
@@ -67766,7 +67796,7 @@ function createTypeChecker(host) {
|
|
|
67766
67796
|
}
|
|
67767
67797
|
function hasPrimitiveConstraint(type) {
|
|
67768
67798
|
const constraint = getConstraintOfTypeParameter(type);
|
|
67769
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
67799
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
67770
67800
|
}
|
|
67771
67801
|
function isObjectLiteralType2(type) {
|
|
67772
67802
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -68248,7 +68278,7 @@ function createTypeChecker(host) {
|
|
|
68248
68278
|
return 83886079 /* UnknownFacts */;
|
|
68249
68279
|
}
|
|
68250
68280
|
function getIntersectionTypeFacts(type) {
|
|
68251
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
68281
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
68252
68282
|
let oredFacts = 0 /* None */;
|
|
68253
68283
|
let andedFacts = 134217727 /* All */;
|
|
68254
68284
|
for (const t of type.types) {
|
|
@@ -68447,7 +68477,7 @@ function createTypeChecker(host) {
|
|
|
68447
68477
|
}
|
|
68448
68478
|
return true;
|
|
68449
68479
|
}
|
|
68450
|
-
if (source.flags &
|
|
68480
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
68451
68481
|
return true;
|
|
68452
68482
|
}
|
|
68453
68483
|
return containsType(target.types, source);
|
|
@@ -69511,7 +69541,7 @@ function createTypeChecker(host) {
|
|
|
69511
69541
|
}
|
|
69512
69542
|
if (assumeTrue) {
|
|
69513
69543
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
69514
|
-
if (valueType.flags & (
|
|
69544
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
69515
69545
|
return valueType;
|
|
69516
69546
|
}
|
|
69517
69547
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -69561,7 +69591,7 @@ function createTypeChecker(host) {
|
|
|
69561
69591
|
let groundClauseTypes;
|
|
69562
69592
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
69563
69593
|
const t = clauseTypes[i];
|
|
69564
|
-
if (t.flags & (
|
|
69594
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
69565
69595
|
if (groundClauseTypes !== void 0) {
|
|
69566
69596
|
groundClauseTypes.push(t);
|
|
69567
69597
|
}
|
|
@@ -69709,18 +69739,29 @@ function createTypeChecker(host) {
|
|
|
69709
69739
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
69710
69740
|
}
|
|
69711
69741
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
69712
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
69713
69742
|
if (!assumeTrue) {
|
|
69714
|
-
|
|
69743
|
+
if (checkDerived) {
|
|
69744
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
69745
|
+
}
|
|
69746
|
+
const trueType2 = getNarrowedType(
|
|
69747
|
+
type,
|
|
69748
|
+
candidate,
|
|
69749
|
+
/*assumeTrue*/
|
|
69750
|
+
true,
|
|
69751
|
+
/*checkDerived*/
|
|
69752
|
+
false
|
|
69753
|
+
);
|
|
69754
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
69715
69755
|
}
|
|
69716
69756
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
69717
69757
|
return candidate;
|
|
69718
69758
|
}
|
|
69759
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
69719
69760
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
69720
69761
|
const narrowedType = mapType(candidate, (c) => {
|
|
69721
69762
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
69722
69763
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
69723
|
-
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);
|
|
69764
|
+
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);
|
|
69724
69765
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
69725
69766
|
});
|
|
69726
69767
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -73060,7 +73101,7 @@ function createTypeChecker(host) {
|
|
|
73060
73101
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
73061
73102
|
let errorInfo;
|
|
73062
73103
|
let relatedInfo;
|
|
73063
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
73104
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
73064
73105
|
for (const subtype of containingType.types) {
|
|
73065
73106
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
73066
73107
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -73657,7 +73698,7 @@ function createTypeChecker(host) {
|
|
|
73657
73698
|
} else {
|
|
73658
73699
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
73659
73700
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
73660
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
73701
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
73661
73702
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
73662
73703
|
flags.push(1 /* Required */);
|
|
73663
73704
|
}
|
|
@@ -76907,7 +76948,7 @@ function createTypeChecker(host) {
|
|
|
76907
76948
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
76908
76949
|
return silentNeverType;
|
|
76909
76950
|
}
|
|
76910
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
76951
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
76911
76952
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
76912
76953
|
}
|
|
76913
76954
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -77493,7 +77534,7 @@ function createTypeChecker(host) {
|
|
|
77493
77534
|
return leftType;
|
|
77494
77535
|
} else {
|
|
77495
77536
|
checkAssignmentOperator(rightType);
|
|
77496
|
-
return
|
|
77537
|
+
return rightType;
|
|
77497
77538
|
}
|
|
77498
77539
|
case 27 /* CommaToken */:
|
|
77499
77540
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -79426,7 +79467,7 @@ function createTypeChecker(host) {
|
|
|
79426
79467
|
))) {
|
|
79427
79468
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
79428
79469
|
}
|
|
79429
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
79470
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
79430
79471
|
return void 0;
|
|
79431
79472
|
}
|
|
79432
79473
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -79478,7 +79519,7 @@ function createTypeChecker(host) {
|
|
|
79478
79519
|
return awaitedType || errorType;
|
|
79479
79520
|
}
|
|
79480
79521
|
function isThenableType(type) {
|
|
79481
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
79522
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
79482
79523
|
return false;
|
|
79483
79524
|
}
|
|
79484
79525
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -79527,7 +79568,7 @@ function createTypeChecker(host) {
|
|
|
79527
79568
|
return awaitedType;
|
|
79528
79569
|
}
|
|
79529
79570
|
}
|
|
79530
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79571
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79531
79572
|
return type;
|
|
79532
79573
|
}
|
|
79533
79574
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -84876,7 +84917,7 @@ function createTypeChecker(host) {
|
|
|
84876
84917
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
84877
84918
|
}
|
|
84878
84919
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
84879
|
-
var _a2
|
|
84920
|
+
var _a2;
|
|
84880
84921
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
84881
84922
|
if (!typeName)
|
|
84882
84923
|
return 0 /* Unknown */;
|
|
@@ -84908,7 +84949,7 @@ function createTypeChecker(host) {
|
|
|
84908
84949
|
location
|
|
84909
84950
|
);
|
|
84910
84951
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
84911
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
84952
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
84912
84953
|
const typeSymbol = resolveEntityName(
|
|
84913
84954
|
typeName,
|
|
84914
84955
|
788968 /* Type */,
|
|
@@ -85059,7 +85100,7 @@ function createTypeChecker(host) {
|
|
|
85059
85100
|
return false;
|
|
85060
85101
|
}
|
|
85061
85102
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
85062
|
-
const enumResult = type.flags &
|
|
85103
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
85063
85104
|
type.symbol,
|
|
85064
85105
|
111551 /* Value */,
|
|
85065
85106
|
enclosing,
|
|
@@ -86620,7 +86661,7 @@ function createTypeChecker(host) {
|
|
|
86620
86661
|
}
|
|
86621
86662
|
function isSimpleLiteralEnumReference(expr) {
|
|
86622
86663
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
86623
|
-
return !!(checkExpressionCached(expr).flags &
|
|
86664
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
86624
86665
|
}
|
|
86625
86666
|
}
|
|
86626
86667
|
function checkAmbientInitializer(node) {
|
|
@@ -87022,10 +87063,10 @@ function createTypeChecker(host) {
|
|
|
87022
87063
|
}
|
|
87023
87064
|
function findMostOverlappyType(source, unionTarget) {
|
|
87024
87065
|
let bestMatch;
|
|
87025
|
-
if (!(source.flags & (
|
|
87066
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
87026
87067
|
let matchingCount = 0;
|
|
87027
87068
|
for (const target of unionTarget.types) {
|
|
87028
|
-
if (!(target.flags & (
|
|
87069
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
87029
87070
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
87030
87071
|
if (overlap.flags & 4194304 /* Index */) {
|
|
87031
87072
|
return target;
|
|
@@ -87043,7 +87084,7 @@ function createTypeChecker(host) {
|
|
|
87043
87084
|
}
|
|
87044
87085
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
87045
87086
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
87046
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
87087
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
87047
87088
|
if (!(result.flags & 131072 /* Never */)) {
|
|
87048
87089
|
return result;
|
|
87049
87090
|
}
|
|
@@ -141429,7 +141470,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141429
141470
|
quotePreference,
|
|
141430
141471
|
defaultImport,
|
|
141431
141472
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
141432
|
-
namespaceLikeImport
|
|
141473
|
+
namespaceLikeImport,
|
|
141474
|
+
compilerOptions
|
|
141433
141475
|
);
|
|
141434
141476
|
newDeclarations = combine(newDeclarations, declarations);
|
|
141435
141477
|
});
|
|
@@ -142091,7 +142133,14 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
142091
142133
|
insertImports(
|
|
142092
142134
|
changes,
|
|
142093
142135
|
sourceFile,
|
|
142094
|
-
getDeclarations(
|
|
142136
|
+
getDeclarations(
|
|
142137
|
+
moduleSpecifier,
|
|
142138
|
+
quotePreference,
|
|
142139
|
+
defaultImport,
|
|
142140
|
+
namedImports,
|
|
142141
|
+
namespaceLikeImport,
|
|
142142
|
+
compilerOptions
|
|
142143
|
+
),
|
|
142095
142144
|
/*blankLineBetween*/
|
|
142096
142145
|
true,
|
|
142097
142146
|
preferences
|
|
@@ -142273,11 +142322,11 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
|
|
|
142273
142322
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
142274
142323
|
return addAsTypeOnly === 2 /* Required */;
|
|
142275
142324
|
}
|
|
142276
|
-
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
|
|
142325
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
|
|
142277
142326
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
142278
142327
|
let statements;
|
|
142279
142328
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
142280
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
|
|
142329
|
+
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
142281
142330
|
statements = combine(statements, makeImport(
|
|
142282
142331
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
142283
142332
|
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
|
|
@@ -151187,7 +151236,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
|
|
|
151187
151236
|
function getApparentProperties(type, node, checker) {
|
|
151188
151237
|
if (!type.isUnion())
|
|
151189
151238
|
return type.getApparentProperties();
|
|
151190
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags &
|
|
151239
|
+
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
151191
151240
|
}
|
|
151192
151241
|
function containsNonPublicProperties(props) {
|
|
151193
151242
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -155610,6 +155659,7 @@ var jsDocTagNames = [
|
|
|
155610
155659
|
"module",
|
|
155611
155660
|
"name",
|
|
155612
155661
|
"namespace",
|
|
155662
|
+
"overload",
|
|
155613
155663
|
"override",
|
|
155614
155664
|
"package",
|
|
155615
155665
|
"param",
|