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/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.0";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230216`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4477,13 +4477,14 @@ ${lanes.join("\n")}
|
|
|
4477
4477
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
4478
4478
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
4479
4479
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
4480
|
-
TypeFlags2[TypeFlags2["Unit"] =
|
|
4480
|
+
TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
|
|
4481
|
+
TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
|
|
4481
4482
|
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
4482
4483
|
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
|
|
4483
4484
|
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
4484
4485
|
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
4485
4486
|
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
|
|
4486
|
-
TypeFlags2[TypeFlags2["Primitive"] =
|
|
4487
|
+
TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
|
|
4487
4488
|
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
|
|
4488
4489
|
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
|
|
4489
4490
|
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
|
|
@@ -29413,7 +29414,6 @@ ${lanes.join("\n")}
|
|
|
29413
29414
|
return canFollowExportModifier();
|
|
29414
29415
|
case 88 /* DefaultKeyword */:
|
|
29415
29416
|
return nextTokenCanFollowDefaultKeyword();
|
|
29416
|
-
case 127 /* AccessorKeyword */:
|
|
29417
29417
|
case 124 /* StaticKeyword */:
|
|
29418
29418
|
case 137 /* GetKeyword */:
|
|
29419
29419
|
case 151 /* SetKeyword */:
|
|
@@ -45179,15 +45179,14 @@ ${lanes.join("\n")}
|
|
|
45179
45179
|
getTypeOfPropertyOfContextualType,
|
|
45180
45180
|
getFullyQualifiedName,
|
|
45181
45181
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
45182
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
45182
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
45183
45183
|
call,
|
|
45184
45184
|
candidatesOutArray,
|
|
45185
45185
|
/*argumentCount*/
|
|
45186
45186
|
void 0,
|
|
45187
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
45188
|
-
|
|
45189
|
-
),
|
|
45190
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
45187
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
45188
|
+
)),
|
|
45189
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
45191
45190
|
getExpandedParameters,
|
|
45192
45191
|
hasEffectiveRestParameter,
|
|
45193
45192
|
containsArgumentsReference,
|
|
@@ -45381,32 +45380,41 @@ ${lanes.join("\n")}
|
|
|
45381
45380
|
getMemberOverrideModifierStatus,
|
|
45382
45381
|
isTypeParameterPossiblyReferenced
|
|
45383
45382
|
};
|
|
45384
|
-
function
|
|
45383
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
45385
45384
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
45386
45385
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
45386
|
+
if (containingCall) {
|
|
45387
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
45388
|
+
}
|
|
45389
|
+
const result = fn();
|
|
45390
|
+
if (containingCall) {
|
|
45391
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
45392
|
+
}
|
|
45393
|
+
return result;
|
|
45394
|
+
}
|
|
45395
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
45396
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
45387
45397
|
if (containingCall) {
|
|
45388
45398
|
let toMarkSkip = node;
|
|
45389
45399
|
do {
|
|
45390
45400
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
45391
45401
|
toMarkSkip = toMarkSkip.parent;
|
|
45392
45402
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45393
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
45394
45403
|
}
|
|
45395
|
-
const result = fn
|
|
45404
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45396
45405
|
if (containingCall) {
|
|
45397
45406
|
let toMarkSkip = node;
|
|
45398
45407
|
do {
|
|
45399
45408
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
45400
45409
|
toMarkSkip = toMarkSkip.parent;
|
|
45401
45410
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45402
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
45403
45411
|
}
|
|
45404
45412
|
return result;
|
|
45405
45413
|
}
|
|
45406
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
45414
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
45407
45415
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
45408
45416
|
apparentArgumentCount = argumentCount;
|
|
45409
|
-
const res = !node ? void 0 :
|
|
45417
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
45410
45418
|
apparentArgumentCount = void 0;
|
|
45411
45419
|
return res;
|
|
45412
45420
|
}
|
|
@@ -48368,7 +48376,7 @@ ${lanes.join("\n")}
|
|
|
48368
48376
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
48369
48377
|
}
|
|
48370
48378
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
48371
|
-
return !(resolvedExternalModuleType.flags &
|
|
48379
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
48372
48380
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
48373
48381
|
}
|
|
48374
48382
|
function getExportsOfSymbol(symbol) {
|
|
@@ -52567,8 +52575,8 @@ ${lanes.join("\n")}
|
|
|
52567
52575
|
const t = types[i];
|
|
52568
52576
|
flags |= t.flags;
|
|
52569
52577
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
52570
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
52571
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
52578
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
52579
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
52572
52580
|
if (baseType.flags & 1048576 /* Union */) {
|
|
52573
52581
|
const count = baseType.types.length;
|
|
52574
52582
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -54445,8 +54453,8 @@ ${lanes.join("\n")}
|
|
|
54445
54453
|
}
|
|
54446
54454
|
return links.declaredType;
|
|
54447
54455
|
}
|
|
54448
|
-
function
|
|
54449
|
-
return type.flags &
|
|
54456
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
54457
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
54450
54458
|
}
|
|
54451
54459
|
function getDeclaredTypeOfEnum(symbol) {
|
|
54452
54460
|
const links = getSymbolLinks(symbol);
|
|
@@ -54459,7 +54467,7 @@ ${lanes.join("\n")}
|
|
|
54459
54467
|
if (hasBindableName(member)) {
|
|
54460
54468
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
54461
54469
|
const value = getEnumMemberValue(member);
|
|
54462
|
-
const memberType = value !== void 0 ?
|
|
54470
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
54463
54471
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
54464
54472
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
54465
54473
|
}
|
|
@@ -54473,7 +54481,7 @@ ${lanes.join("\n")}
|
|
|
54473
54481
|
symbol,
|
|
54474
54482
|
/*aliasTypeArguments*/
|
|
54475
54483
|
void 0
|
|
54476
|
-
) :
|
|
54484
|
+
) : createComputedEnumType(symbol);
|
|
54477
54485
|
if (enumType.flags & 1048576 /* Union */) {
|
|
54478
54486
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
54479
54487
|
enumType.symbol = symbol;
|
|
@@ -54482,6 +54490,15 @@ ${lanes.join("\n")}
|
|
|
54482
54490
|
}
|
|
54483
54491
|
return links.declaredType;
|
|
54484
54492
|
}
|
|
54493
|
+
function createComputedEnumType(symbol) {
|
|
54494
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
54495
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
54496
|
+
regularType.regularType = regularType;
|
|
54497
|
+
regularType.freshType = freshType;
|
|
54498
|
+
freshType.regularType = regularType;
|
|
54499
|
+
freshType.freshType = freshType;
|
|
54500
|
+
return regularType;
|
|
54501
|
+
}
|
|
54485
54502
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
54486
54503
|
const links = getSymbolLinks(symbol);
|
|
54487
54504
|
if (!links.declaredType) {
|
|
@@ -58170,7 +58187,7 @@ ${lanes.join("\n")}
|
|
|
58170
58187
|
orderedRemoveItemAt(typeSet, 1);
|
|
58171
58188
|
}
|
|
58172
58189
|
}
|
|
58173
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
58190
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
58174
58191
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
58175
58192
|
}
|
|
58176
58193
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -58301,7 +58318,7 @@ ${lanes.join("\n")}
|
|
|
58301
58318
|
type = undefinedType;
|
|
58302
58319
|
}
|
|
58303
58320
|
if (!typeSet.has(type.id.toString())) {
|
|
58304
|
-
if (type.flags &
|
|
58321
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
58305
58322
|
includes |= 67108864 /* NonPrimitive */;
|
|
58306
58323
|
}
|
|
58307
58324
|
typeSet.set(type.id.toString(), type);
|
|
@@ -58577,7 +58594,7 @@ ${lanes.join("\n")}
|
|
|
58577
58594
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
58578
58595
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
58579
58596
|
function isDistributive(type) {
|
|
58580
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
58597
|
+
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;
|
|
58581
58598
|
}
|
|
58582
58599
|
}
|
|
58583
58600
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -59674,7 +59691,7 @@ ${lanes.join("\n")}
|
|
|
59674
59691
|
return type;
|
|
59675
59692
|
}
|
|
59676
59693
|
function getFreshTypeOfLiteralType(type) {
|
|
59677
|
-
if (type.flags &
|
|
59694
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
59678
59695
|
if (!type.freshType) {
|
|
59679
59696
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
59680
59697
|
freshType.freshType = freshType;
|
|
@@ -59685,10 +59702,10 @@ ${lanes.join("\n")}
|
|
|
59685
59702
|
return type;
|
|
59686
59703
|
}
|
|
59687
59704
|
function getRegularTypeOfLiteralType(type) {
|
|
59688
|
-
return type.flags &
|
|
59705
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
59689
59706
|
}
|
|
59690
59707
|
function isFreshLiteralType(type) {
|
|
59691
|
-
return !!(type.flags &
|
|
59708
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
59692
59709
|
}
|
|
59693
59710
|
function getStringLiteralType(value) {
|
|
59694
59711
|
let type;
|
|
@@ -60367,13 +60384,13 @@ ${lanes.join("\n")}
|
|
|
60367
60384
|
return type;
|
|
60368
60385
|
}
|
|
60369
60386
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
60370
|
-
return type.flags & (
|
|
60387
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
60371
60388
|
}
|
|
60372
60389
|
function getPermissiveInstantiation(type) {
|
|
60373
|
-
return type.flags & (
|
|
60390
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
60374
60391
|
}
|
|
60375
60392
|
function getRestrictiveInstantiation(type) {
|
|
60376
|
-
if (type.flags & (
|
|
60393
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
60377
60394
|
return type;
|
|
60378
60395
|
}
|
|
60379
60396
|
if (type.restrictiveInstantiation) {
|
|
@@ -60953,7 +60970,7 @@ ${lanes.join("\n")}
|
|
|
60953
60970
|
}
|
|
60954
60971
|
}
|
|
60955
60972
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
60956
|
-
if (target.flags & (
|
|
60973
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
60957
60974
|
return false;
|
|
60958
60975
|
if (isTupleLikeType(source)) {
|
|
60959
60976
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -61002,7 +61019,7 @@ ${lanes.join("\n")}
|
|
|
61002
61019
|
}
|
|
61003
61020
|
}
|
|
61004
61021
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
61005
|
-
if (target.flags & (
|
|
61022
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
61006
61023
|
return false;
|
|
61007
61024
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
61008
61025
|
}
|
|
@@ -61025,16 +61042,24 @@ ${lanes.join("\n")}
|
|
|
61025
61042
|
void 0
|
|
61026
61043
|
) !== 0 /* False */;
|
|
61027
61044
|
}
|
|
61028
|
-
function
|
|
61029
|
-
|
|
61045
|
+
function isTopSignature(s) {
|
|
61046
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
61047
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
61048
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
61049
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
61050
|
+
}
|
|
61051
|
+
return false;
|
|
61030
61052
|
}
|
|
61031
61053
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
61032
61054
|
if (source === target) {
|
|
61033
61055
|
return -1 /* True */;
|
|
61034
61056
|
}
|
|
61035
|
-
if (
|
|
61057
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
61036
61058
|
return -1 /* True */;
|
|
61037
61059
|
}
|
|
61060
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
61061
|
+
return 0 /* False */;
|
|
61062
|
+
}
|
|
61038
61063
|
const targetCount = getParameterCount(target);
|
|
61039
61064
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
61040
61065
|
if (sourceHasMoreParameters) {
|
|
@@ -61252,7 +61277,9 @@ ${lanes.join("\n")}
|
|
|
61252
61277
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
61253
61278
|
const s = source.flags;
|
|
61254
61279
|
const t = target.flags;
|
|
61255
|
-
if (t &
|
|
61280
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
61281
|
+
return true;
|
|
61282
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
61256
61283
|
return true;
|
|
61257
61284
|
if (t & 131072 /* Never */)
|
|
61258
61285
|
return false;
|
|
@@ -61649,7 +61676,7 @@ ${lanes.join("\n")}
|
|
|
61649
61676
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
61650
61677
|
}
|
|
61651
61678
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
61652
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
61679
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
61653
61680
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
61654
61681
|
return -1 /* True */;
|
|
61655
61682
|
}
|
|
@@ -61713,7 +61740,7 @@ ${lanes.join("\n")}
|
|
|
61713
61740
|
return 0 /* False */;
|
|
61714
61741
|
}
|
|
61715
61742
|
}
|
|
61716
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
61743
|
+
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));
|
|
61717
61744
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
61718
61745
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
61719
61746
|
if (reportErrors2) {
|
|
@@ -61775,7 +61802,7 @@ ${lanes.join("\n")}
|
|
|
61775
61802
|
maybeSuppress = !!errorInfo;
|
|
61776
61803
|
}
|
|
61777
61804
|
}
|
|
61778
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
61805
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
61779
61806
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
61780
61807
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
61781
61808
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -61921,15 +61948,15 @@ ${lanes.join("\n")}
|
|
|
61921
61948
|
}
|
|
61922
61949
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
61923
61950
|
if (source2.flags & 1048576 /* Union */) {
|
|
61924
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
61951
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
61925
61952
|
}
|
|
61926
61953
|
if (target2.flags & 1048576 /* Union */) {
|
|
61927
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
61954
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
61928
61955
|
}
|
|
61929
61956
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
61930
61957
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
61931
61958
|
}
|
|
61932
|
-
if (relation === comparableRelation && target2.flags &
|
|
61959
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
61933
61960
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
61934
61961
|
if (constraints !== source2.types) {
|
|
61935
61962
|
source2 = getIntersectionType(constraints);
|
|
@@ -62822,7 +62849,7 @@ ${lanes.join("\n")}
|
|
|
62822
62849
|
}
|
|
62823
62850
|
return 0 /* False */;
|
|
62824
62851
|
}
|
|
62825
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
62852
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
62826
62853
|
if (relation !== identityRelation) {
|
|
62827
62854
|
source2 = getApparentType(source2);
|
|
62828
62855
|
sourceFlags = source2.flags;
|
|
@@ -63492,10 +63519,11 @@ ${lanes.join("\n")}
|
|
|
63492
63519
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
63493
63520
|
}
|
|
63494
63521
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63522
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
63495
63523
|
return compareSignaturesRelated(
|
|
63496
63524
|
erase ? getErasedSignature(source2) : source2,
|
|
63497
63525
|
erase ? getErasedSignature(target2) : target2,
|
|
63498
|
-
|
|
63526
|
+
checkMode,
|
|
63499
63527
|
reportErrors2,
|
|
63500
63528
|
reportError,
|
|
63501
63529
|
incompatibleReporter,
|
|
@@ -63620,7 +63648,7 @@ ${lanes.join("\n")}
|
|
|
63620
63648
|
if (sourceInfo) {
|
|
63621
63649
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
63622
63650
|
}
|
|
63623
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63651
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63624
63652
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63625
63653
|
}
|
|
63626
63654
|
if (reportErrors2) {
|
|
@@ -64165,10 +64193,10 @@ ${lanes.join("\n")}
|
|
|
64165
64193
|
return void 0;
|
|
64166
64194
|
}
|
|
64167
64195
|
function isNeitherUnitTypeNorNever(type) {
|
|
64168
|
-
return !(type.flags & (
|
|
64196
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
64169
64197
|
}
|
|
64170
64198
|
function isUnitType(type) {
|
|
64171
|
-
return !!(type.flags &
|
|
64199
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
64172
64200
|
}
|
|
64173
64201
|
function isUnitLikeType(type) {
|
|
64174
64202
|
const t = getBaseConstraintOrType(type);
|
|
@@ -64181,7 +64209,7 @@ ${lanes.join("\n")}
|
|
|
64181
64209
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
64182
64210
|
}
|
|
64183
64211
|
function getBaseTypeOfLiteralType(type) {
|
|
64184
|
-
return type.flags &
|
|
64212
|
+
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;
|
|
64185
64213
|
}
|
|
64186
64214
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
64187
64215
|
var _a2;
|
|
@@ -64189,7 +64217,7 @@ ${lanes.join("\n")}
|
|
|
64189
64217
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
64190
64218
|
}
|
|
64191
64219
|
function getWidenedLiteralType(type) {
|
|
64192
|
-
return type.flags &
|
|
64220
|
+
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;
|
|
64193
64221
|
}
|
|
64194
64222
|
function getWidenedUniqueESSymbolType(type) {
|
|
64195
64223
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -64722,8 +64750,8 @@ ${lanes.join("\n")}
|
|
|
64722
64750
|
}
|
|
64723
64751
|
return false;
|
|
64724
64752
|
}
|
|
64725
|
-
function isTypeParameterAtTopLevel(type,
|
|
64726
|
-
return !!(type ===
|
|
64753
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
64754
|
+
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)));
|
|
64727
64755
|
}
|
|
64728
64756
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
64729
64757
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -64817,7 +64845,7 @@ ${lanes.join("\n")}
|
|
|
64817
64845
|
yield targetProp;
|
|
64818
64846
|
} else if (matchDiscriminantProperties) {
|
|
64819
64847
|
const targetType = getTypeOfSymbol(targetProp);
|
|
64820
|
-
if (targetType.flags &
|
|
64848
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
64821
64849
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
64822
64850
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
64823
64851
|
yield targetProp;
|
|
@@ -65576,7 +65604,7 @@ ${lanes.join("\n")}
|
|
|
65576
65604
|
}
|
|
65577
65605
|
function hasPrimitiveConstraint(type) {
|
|
65578
65606
|
const constraint = getConstraintOfTypeParameter(type);
|
|
65579
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
65607
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
65580
65608
|
}
|
|
65581
65609
|
function isObjectLiteralType2(type) {
|
|
65582
65610
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -66058,7 +66086,7 @@ ${lanes.join("\n")}
|
|
|
66058
66086
|
return 83886079 /* UnknownFacts */;
|
|
66059
66087
|
}
|
|
66060
66088
|
function getIntersectionTypeFacts(type) {
|
|
66061
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
66089
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
66062
66090
|
let oredFacts = 0 /* None */;
|
|
66063
66091
|
let andedFacts = 134217727 /* All */;
|
|
66064
66092
|
for (const t of type.types) {
|
|
@@ -66257,7 +66285,7 @@ ${lanes.join("\n")}
|
|
|
66257
66285
|
}
|
|
66258
66286
|
return true;
|
|
66259
66287
|
}
|
|
66260
|
-
if (source.flags &
|
|
66288
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
66261
66289
|
return true;
|
|
66262
66290
|
}
|
|
66263
66291
|
return containsType(target.types, source);
|
|
@@ -67321,7 +67349,7 @@ ${lanes.join("\n")}
|
|
|
67321
67349
|
}
|
|
67322
67350
|
if (assumeTrue) {
|
|
67323
67351
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
67324
|
-
if (valueType.flags & (
|
|
67352
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
67325
67353
|
return valueType;
|
|
67326
67354
|
}
|
|
67327
67355
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -67371,7 +67399,7 @@ ${lanes.join("\n")}
|
|
|
67371
67399
|
let groundClauseTypes;
|
|
67372
67400
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
67373
67401
|
const t = clauseTypes[i];
|
|
67374
|
-
if (t.flags & (
|
|
67402
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
67375
67403
|
if (groundClauseTypes !== void 0) {
|
|
67376
67404
|
groundClauseTypes.push(t);
|
|
67377
67405
|
}
|
|
@@ -67519,18 +67547,29 @@ ${lanes.join("\n")}
|
|
|
67519
67547
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
67520
67548
|
}
|
|
67521
67549
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
67522
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
67523
67550
|
if (!assumeTrue) {
|
|
67524
|
-
|
|
67551
|
+
if (checkDerived) {
|
|
67552
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
67553
|
+
}
|
|
67554
|
+
const trueType2 = getNarrowedType(
|
|
67555
|
+
type,
|
|
67556
|
+
candidate,
|
|
67557
|
+
/*assumeTrue*/
|
|
67558
|
+
true,
|
|
67559
|
+
/*checkDerived*/
|
|
67560
|
+
false
|
|
67561
|
+
);
|
|
67562
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
67525
67563
|
}
|
|
67526
67564
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
67527
67565
|
return candidate;
|
|
67528
67566
|
}
|
|
67567
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
67529
67568
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
67530
67569
|
const narrowedType = mapType(candidate, (c) => {
|
|
67531
67570
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67532
67571
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
67533
|
-
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);
|
|
67572
|
+
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);
|
|
67534
67573
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67535
67574
|
});
|
|
67536
67575
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -70870,7 +70909,7 @@ ${lanes.join("\n")}
|
|
|
70870
70909
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
70871
70910
|
let errorInfo;
|
|
70872
70911
|
let relatedInfo;
|
|
70873
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
70912
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
70874
70913
|
for (const subtype of containingType.types) {
|
|
70875
70914
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
70876
70915
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -71467,7 +71506,7 @@ ${lanes.join("\n")}
|
|
|
71467
71506
|
} else {
|
|
71468
71507
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
71469
71508
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
71470
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
71509
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
71471
71510
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
71472
71511
|
flags.push(1 /* Required */);
|
|
71473
71512
|
}
|
|
@@ -74717,7 +74756,7 @@ ${lanes.join("\n")}
|
|
|
74717
74756
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
74718
74757
|
return silentNeverType;
|
|
74719
74758
|
}
|
|
74720
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
74759
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
74721
74760
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
74722
74761
|
}
|
|
74723
74762
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -75303,7 +75342,7 @@ ${lanes.join("\n")}
|
|
|
75303
75342
|
return leftType;
|
|
75304
75343
|
} else {
|
|
75305
75344
|
checkAssignmentOperator(rightType);
|
|
75306
|
-
return
|
|
75345
|
+
return rightType;
|
|
75307
75346
|
}
|
|
75308
75347
|
case 27 /* CommaToken */:
|
|
75309
75348
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -77236,7 +77275,7 @@ ${lanes.join("\n")}
|
|
|
77236
77275
|
))) {
|
|
77237
77276
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
77238
77277
|
}
|
|
77239
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
77278
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
77240
77279
|
return void 0;
|
|
77241
77280
|
}
|
|
77242
77281
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -77288,7 +77327,7 @@ ${lanes.join("\n")}
|
|
|
77288
77327
|
return awaitedType || errorType;
|
|
77289
77328
|
}
|
|
77290
77329
|
function isThenableType(type) {
|
|
77291
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
77330
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
77292
77331
|
return false;
|
|
77293
77332
|
}
|
|
77294
77333
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -77337,7 +77376,7 @@ ${lanes.join("\n")}
|
|
|
77337
77376
|
return awaitedType;
|
|
77338
77377
|
}
|
|
77339
77378
|
}
|
|
77340
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77379
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77341
77380
|
return type;
|
|
77342
77381
|
}
|
|
77343
77382
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -82686,7 +82725,7 @@ ${lanes.join("\n")}
|
|
|
82686
82725
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
82687
82726
|
}
|
|
82688
82727
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
82689
|
-
var _a2
|
|
82728
|
+
var _a2;
|
|
82690
82729
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
82691
82730
|
if (!typeName)
|
|
82692
82731
|
return 0 /* Unknown */;
|
|
@@ -82718,7 +82757,7 @@ ${lanes.join("\n")}
|
|
|
82718
82757
|
location
|
|
82719
82758
|
);
|
|
82720
82759
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
82721
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
82760
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
82722
82761
|
const typeSymbol = resolveEntityName(
|
|
82723
82762
|
typeName,
|
|
82724
82763
|
788968 /* Type */,
|
|
@@ -82869,7 +82908,7 @@ ${lanes.join("\n")}
|
|
|
82869
82908
|
return false;
|
|
82870
82909
|
}
|
|
82871
82910
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
82872
|
-
const enumResult = type.flags &
|
|
82911
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
82873
82912
|
type.symbol,
|
|
82874
82913
|
111551 /* Value */,
|
|
82875
82914
|
enclosing,
|
|
@@ -84430,7 +84469,7 @@ ${lanes.join("\n")}
|
|
|
84430
84469
|
}
|
|
84431
84470
|
function isSimpleLiteralEnumReference(expr) {
|
|
84432
84471
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
84433
|
-
return !!(checkExpressionCached(expr).flags &
|
|
84472
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
84434
84473
|
}
|
|
84435
84474
|
}
|
|
84436
84475
|
function checkAmbientInitializer(node) {
|
|
@@ -84832,10 +84871,10 @@ ${lanes.join("\n")}
|
|
|
84832
84871
|
}
|
|
84833
84872
|
function findMostOverlappyType(source, unionTarget) {
|
|
84834
84873
|
let bestMatch;
|
|
84835
|
-
if (!(source.flags & (
|
|
84874
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
84836
84875
|
let matchingCount = 0;
|
|
84837
84876
|
for (const target of unionTarget.types) {
|
|
84838
|
-
if (!(target.flags & (
|
|
84877
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
84839
84878
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
84840
84879
|
if (overlap.flags & 4194304 /* Index */) {
|
|
84841
84880
|
return target;
|
|
@@ -84853,7 +84892,7 @@ ${lanes.join("\n")}
|
|
|
84853
84892
|
}
|
|
84854
84893
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
84855
84894
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
84856
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
84895
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
84857
84896
|
if (!(result.flags & 131072 /* Never */)) {
|
|
84858
84897
|
return result;
|
|
84859
84898
|
}
|
|
@@ -85053,6 +85092,7 @@ ${lanes.join("\n")}
|
|
|
85053
85092
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
85054
85093
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
85055
85094
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
85095
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
85056
85096
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
85057
85097
|
return SignatureCheckMode3;
|
|
85058
85098
|
})(SignatureCheckMode || {});
|
|
@@ -139982,7 +140022,8 @@ ${lanes.join("\n")}
|
|
|
139982
140022
|
quotePreference,
|
|
139983
140023
|
defaultImport,
|
|
139984
140024
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
139985
|
-
namespaceLikeImport
|
|
140025
|
+
namespaceLikeImport,
|
|
140026
|
+
compilerOptions
|
|
139986
140027
|
);
|
|
139987
140028
|
newDeclarations = combine(newDeclarations, declarations);
|
|
139988
140029
|
});
|
|
@@ -140644,7 +140685,14 @@ ${lanes.join("\n")}
|
|
|
140644
140685
|
insertImports(
|
|
140645
140686
|
changes,
|
|
140646
140687
|
sourceFile,
|
|
140647
|
-
getDeclarations(
|
|
140688
|
+
getDeclarations(
|
|
140689
|
+
moduleSpecifier,
|
|
140690
|
+
quotePreference,
|
|
140691
|
+
defaultImport,
|
|
140692
|
+
namedImports,
|
|
140693
|
+
namespaceLikeImport,
|
|
140694
|
+
compilerOptions
|
|
140695
|
+
),
|
|
140648
140696
|
/*blankLineBetween*/
|
|
140649
140697
|
true,
|
|
140650
140698
|
preferences
|
|
@@ -140826,11 +140874,11 @@ ${lanes.join("\n")}
|
|
|
140826
140874
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
140827
140875
|
return addAsTypeOnly === 2 /* Required */;
|
|
140828
140876
|
}
|
|
140829
|
-
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
|
|
140877
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
|
|
140830
140878
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
140831
140879
|
let statements;
|
|
140832
140880
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
140833
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
|
|
140881
|
+
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 */);
|
|
140834
140882
|
statements = combine(statements, makeImport(
|
|
140835
140883
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
140836
140884
|
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
|
|
@@ -145780,13 +145828,7 @@ ${lanes.join("\n")}
|
|
|
145780
145828
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
145781
145829
|
if (length(signatures)) {
|
|
145782
145830
|
const type = checker.getUnionType(map(signatures, checker.getReturnTypeOfSignature));
|
|
145783
|
-
return checker.typeToTypeNode(
|
|
145784
|
-
type,
|
|
145785
|
-
enclosingDeclaration,
|
|
145786
|
-
/*flags*/
|
|
145787
|
-
void 0,
|
|
145788
|
-
getNoopSymbolTrackerWithResolver(context)
|
|
145789
|
-
);
|
|
145831
|
+
return checker.typeToTypeNode(type, enclosingDeclaration, 1 /* NoTruncation */, getNoopSymbolTrackerWithResolver(context));
|
|
145790
145832
|
}
|
|
145791
145833
|
}
|
|
145792
145834
|
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
@@ -150220,7 +150262,7 @@ ${lanes.join("\n")}
|
|
|
150220
150262
|
function getApparentProperties(type, node, checker) {
|
|
150221
150263
|
if (!type.isUnion())
|
|
150222
150264
|
return type.getApparentProperties();
|
|
150223
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags &
|
|
150265
|
+
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()))));
|
|
150224
150266
|
}
|
|
150225
150267
|
function containsNonPublicProperties(props) {
|
|
150226
150268
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -155108,6 +155150,7 @@ ${lanes.join("\n")}
|
|
|
155108
155150
|
"module",
|
|
155109
155151
|
"name",
|
|
155110
155152
|
"namespace",
|
|
155153
|
+
"overload",
|
|
155111
155154
|
"override",
|
|
155112
155155
|
"package",
|
|
155113
155156
|
"param",
|