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/typescript.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.20230215`;
|
|
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";
|
|
@@ -45179,15 +45180,14 @@ ${lanes.join("\n")}
|
|
|
45179
45180
|
getTypeOfPropertyOfContextualType,
|
|
45180
45181
|
getFullyQualifiedName,
|
|
45181
45182
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
45182
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
45183
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
45183
45184
|
call,
|
|
45184
45185
|
candidatesOutArray,
|
|
45185
45186
|
/*argumentCount*/
|
|
45186
45187
|
void 0,
|
|
45187
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
45188
|
-
|
|
45189
|
-
),
|
|
45190
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
45188
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
45189
|
+
)),
|
|
45190
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
45191
45191
|
getExpandedParameters,
|
|
45192
45192
|
hasEffectiveRestParameter,
|
|
45193
45193
|
containsArgumentsReference,
|
|
@@ -45381,32 +45381,41 @@ ${lanes.join("\n")}
|
|
|
45381
45381
|
getMemberOverrideModifierStatus,
|
|
45382
45382
|
isTypeParameterPossiblyReferenced
|
|
45383
45383
|
};
|
|
45384
|
-
function
|
|
45384
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
45385
45385
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
45386
45386
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
45387
|
+
if (containingCall) {
|
|
45388
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
45389
|
+
}
|
|
45390
|
+
const result = fn();
|
|
45391
|
+
if (containingCall) {
|
|
45392
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
45393
|
+
}
|
|
45394
|
+
return result;
|
|
45395
|
+
}
|
|
45396
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
45397
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
45387
45398
|
if (containingCall) {
|
|
45388
45399
|
let toMarkSkip = node;
|
|
45389
45400
|
do {
|
|
45390
45401
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
45391
45402
|
toMarkSkip = toMarkSkip.parent;
|
|
45392
45403
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45393
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
45394
45404
|
}
|
|
45395
|
-
const result = fn
|
|
45405
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
45396
45406
|
if (containingCall) {
|
|
45397
45407
|
let toMarkSkip = node;
|
|
45398
45408
|
do {
|
|
45399
45409
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
45400
45410
|
toMarkSkip = toMarkSkip.parent;
|
|
45401
45411
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
45402
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
45403
45412
|
}
|
|
45404
45413
|
return result;
|
|
45405
45414
|
}
|
|
45406
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
45415
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
45407
45416
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
45408
45417
|
apparentArgumentCount = argumentCount;
|
|
45409
|
-
const res = !node ? void 0 :
|
|
45418
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
45410
45419
|
apparentArgumentCount = void 0;
|
|
45411
45420
|
return res;
|
|
45412
45421
|
}
|
|
@@ -48368,7 +48377,7 @@ ${lanes.join("\n")}
|
|
|
48368
48377
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
48369
48378
|
}
|
|
48370
48379
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
48371
|
-
return !(resolvedExternalModuleType.flags &
|
|
48380
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
48372
48381
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
48373
48382
|
}
|
|
48374
48383
|
function getExportsOfSymbol(symbol) {
|
|
@@ -52567,8 +52576,8 @@ ${lanes.join("\n")}
|
|
|
52567
52576
|
const t = types[i];
|
|
52568
52577
|
flags |= t.flags;
|
|
52569
52578
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
52570
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
52571
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
52579
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
52580
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
52572
52581
|
if (baseType.flags & 1048576 /* Union */) {
|
|
52573
52582
|
const count = baseType.types.length;
|
|
52574
52583
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -54445,8 +54454,8 @@ ${lanes.join("\n")}
|
|
|
54445
54454
|
}
|
|
54446
54455
|
return links.declaredType;
|
|
54447
54456
|
}
|
|
54448
|
-
function
|
|
54449
|
-
return type.flags &
|
|
54457
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
54458
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
54450
54459
|
}
|
|
54451
54460
|
function getDeclaredTypeOfEnum(symbol) {
|
|
54452
54461
|
const links = getSymbolLinks(symbol);
|
|
@@ -54459,7 +54468,7 @@ ${lanes.join("\n")}
|
|
|
54459
54468
|
if (hasBindableName(member)) {
|
|
54460
54469
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
54461
54470
|
const value = getEnumMemberValue(member);
|
|
54462
|
-
const memberType = value !== void 0 ?
|
|
54471
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
54463
54472
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
54464
54473
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
54465
54474
|
}
|
|
@@ -54473,7 +54482,7 @@ ${lanes.join("\n")}
|
|
|
54473
54482
|
symbol,
|
|
54474
54483
|
/*aliasTypeArguments*/
|
|
54475
54484
|
void 0
|
|
54476
|
-
) :
|
|
54485
|
+
) : createComputedEnumType(symbol);
|
|
54477
54486
|
if (enumType.flags & 1048576 /* Union */) {
|
|
54478
54487
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
54479
54488
|
enumType.symbol = symbol;
|
|
@@ -54482,6 +54491,15 @@ ${lanes.join("\n")}
|
|
|
54482
54491
|
}
|
|
54483
54492
|
return links.declaredType;
|
|
54484
54493
|
}
|
|
54494
|
+
function createComputedEnumType(symbol) {
|
|
54495
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
54496
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
54497
|
+
regularType.regularType = regularType;
|
|
54498
|
+
regularType.freshType = freshType;
|
|
54499
|
+
freshType.regularType = regularType;
|
|
54500
|
+
freshType.freshType = freshType;
|
|
54501
|
+
return regularType;
|
|
54502
|
+
}
|
|
54485
54503
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
54486
54504
|
const links = getSymbolLinks(symbol);
|
|
54487
54505
|
if (!links.declaredType) {
|
|
@@ -58170,7 +58188,7 @@ ${lanes.join("\n")}
|
|
|
58170
58188
|
orderedRemoveItemAt(typeSet, 1);
|
|
58171
58189
|
}
|
|
58172
58190
|
}
|
|
58173
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
58191
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
58174
58192
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
58175
58193
|
}
|
|
58176
58194
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -58301,7 +58319,7 @@ ${lanes.join("\n")}
|
|
|
58301
58319
|
type = undefinedType;
|
|
58302
58320
|
}
|
|
58303
58321
|
if (!typeSet.has(type.id.toString())) {
|
|
58304
|
-
if (type.flags &
|
|
58322
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
58305
58323
|
includes |= 67108864 /* NonPrimitive */;
|
|
58306
58324
|
}
|
|
58307
58325
|
typeSet.set(type.id.toString(), type);
|
|
@@ -58577,7 +58595,7 @@ ${lanes.join("\n")}
|
|
|
58577
58595
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
58578
58596
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
58579
58597
|
function isDistributive(type) {
|
|
58580
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
58598
|
+
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
58599
|
}
|
|
58582
58600
|
}
|
|
58583
58601
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -59674,7 +59692,7 @@ ${lanes.join("\n")}
|
|
|
59674
59692
|
return type;
|
|
59675
59693
|
}
|
|
59676
59694
|
function getFreshTypeOfLiteralType(type) {
|
|
59677
|
-
if (type.flags &
|
|
59695
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
59678
59696
|
if (!type.freshType) {
|
|
59679
59697
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
59680
59698
|
freshType.freshType = freshType;
|
|
@@ -59685,10 +59703,10 @@ ${lanes.join("\n")}
|
|
|
59685
59703
|
return type;
|
|
59686
59704
|
}
|
|
59687
59705
|
function getRegularTypeOfLiteralType(type) {
|
|
59688
|
-
return type.flags &
|
|
59706
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
59689
59707
|
}
|
|
59690
59708
|
function isFreshLiteralType(type) {
|
|
59691
|
-
return !!(type.flags &
|
|
59709
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
59692
59710
|
}
|
|
59693
59711
|
function getStringLiteralType(value) {
|
|
59694
59712
|
let type;
|
|
@@ -60367,13 +60385,13 @@ ${lanes.join("\n")}
|
|
|
60367
60385
|
return type;
|
|
60368
60386
|
}
|
|
60369
60387
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
60370
|
-
return type.flags & (
|
|
60388
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
60371
60389
|
}
|
|
60372
60390
|
function getPermissiveInstantiation(type) {
|
|
60373
|
-
return type.flags & (
|
|
60391
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
60374
60392
|
}
|
|
60375
60393
|
function getRestrictiveInstantiation(type) {
|
|
60376
|
-
if (type.flags & (
|
|
60394
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
60377
60395
|
return type;
|
|
60378
60396
|
}
|
|
60379
60397
|
if (type.restrictiveInstantiation) {
|
|
@@ -60953,7 +60971,7 @@ ${lanes.join("\n")}
|
|
|
60953
60971
|
}
|
|
60954
60972
|
}
|
|
60955
60973
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
60956
|
-
if (target.flags & (
|
|
60974
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
60957
60975
|
return false;
|
|
60958
60976
|
if (isTupleLikeType(source)) {
|
|
60959
60977
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -61002,7 +61020,7 @@ ${lanes.join("\n")}
|
|
|
61002
61020
|
}
|
|
61003
61021
|
}
|
|
61004
61022
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
61005
|
-
if (target.flags & (
|
|
61023
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
61006
61024
|
return false;
|
|
61007
61025
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
61008
61026
|
}
|
|
@@ -61025,16 +61043,24 @@ ${lanes.join("\n")}
|
|
|
61025
61043
|
void 0
|
|
61026
61044
|
) !== 0 /* False */;
|
|
61027
61045
|
}
|
|
61028
|
-
function
|
|
61029
|
-
|
|
61046
|
+
function isTopSignature(s) {
|
|
61047
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
61048
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
61049
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
61050
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
61051
|
+
}
|
|
61052
|
+
return false;
|
|
61030
61053
|
}
|
|
61031
61054
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
61032
61055
|
if (source === target) {
|
|
61033
61056
|
return -1 /* True */;
|
|
61034
61057
|
}
|
|
61035
|
-
if (
|
|
61058
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
61036
61059
|
return -1 /* True */;
|
|
61037
61060
|
}
|
|
61061
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
61062
|
+
return 0 /* False */;
|
|
61063
|
+
}
|
|
61038
61064
|
const targetCount = getParameterCount(target);
|
|
61039
61065
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
61040
61066
|
if (sourceHasMoreParameters) {
|
|
@@ -61252,7 +61278,9 @@ ${lanes.join("\n")}
|
|
|
61252
61278
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
61253
61279
|
const s = source.flags;
|
|
61254
61280
|
const t = target.flags;
|
|
61255
|
-
if (t &
|
|
61281
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
61282
|
+
return true;
|
|
61283
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
61256
61284
|
return true;
|
|
61257
61285
|
if (t & 131072 /* Never */)
|
|
61258
61286
|
return false;
|
|
@@ -61649,7 +61677,7 @@ ${lanes.join("\n")}
|
|
|
61649
61677
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
61650
61678
|
}
|
|
61651
61679
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
61652
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
61680
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
61653
61681
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
61654
61682
|
return -1 /* True */;
|
|
61655
61683
|
}
|
|
@@ -61713,7 +61741,7 @@ ${lanes.join("\n")}
|
|
|
61713
61741
|
return 0 /* False */;
|
|
61714
61742
|
}
|
|
61715
61743
|
}
|
|
61716
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
61744
|
+
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
61745
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
61718
61746
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
61719
61747
|
if (reportErrors2) {
|
|
@@ -61775,7 +61803,7 @@ ${lanes.join("\n")}
|
|
|
61775
61803
|
maybeSuppress = !!errorInfo;
|
|
61776
61804
|
}
|
|
61777
61805
|
}
|
|
61778
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
61806
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
61779
61807
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
61780
61808
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
61781
61809
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -61921,15 +61949,15 @@ ${lanes.join("\n")}
|
|
|
61921
61949
|
}
|
|
61922
61950
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
61923
61951
|
if (source2.flags & 1048576 /* Union */) {
|
|
61924
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
61952
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
61925
61953
|
}
|
|
61926
61954
|
if (target2.flags & 1048576 /* Union */) {
|
|
61927
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
61955
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
61928
61956
|
}
|
|
61929
61957
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
61930
61958
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
61931
61959
|
}
|
|
61932
|
-
if (relation === comparableRelation && target2.flags &
|
|
61960
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
61933
61961
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
61934
61962
|
if (constraints !== source2.types) {
|
|
61935
61963
|
source2 = getIntersectionType(constraints);
|
|
@@ -62822,7 +62850,7 @@ ${lanes.join("\n")}
|
|
|
62822
62850
|
}
|
|
62823
62851
|
return 0 /* False */;
|
|
62824
62852
|
}
|
|
62825
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
62853
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
62826
62854
|
if (relation !== identityRelation) {
|
|
62827
62855
|
source2 = getApparentType(source2);
|
|
62828
62856
|
sourceFlags = source2.flags;
|
|
@@ -63492,10 +63520,11 @@ ${lanes.join("\n")}
|
|
|
63492
63520
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
63493
63521
|
}
|
|
63494
63522
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
63523
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
63495
63524
|
return compareSignaturesRelated(
|
|
63496
63525
|
erase ? getErasedSignature(source2) : source2,
|
|
63497
63526
|
erase ? getErasedSignature(target2) : target2,
|
|
63498
|
-
|
|
63527
|
+
checkMode,
|
|
63499
63528
|
reportErrors2,
|
|
63500
63529
|
reportError,
|
|
63501
63530
|
incompatibleReporter,
|
|
@@ -63620,7 +63649,7 @@ ${lanes.join("\n")}
|
|
|
63620
63649
|
if (sourceInfo) {
|
|
63621
63650
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
63622
63651
|
}
|
|
63623
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63652
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
63624
63653
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
63625
63654
|
}
|
|
63626
63655
|
if (reportErrors2) {
|
|
@@ -64165,10 +64194,10 @@ ${lanes.join("\n")}
|
|
|
64165
64194
|
return void 0;
|
|
64166
64195
|
}
|
|
64167
64196
|
function isNeitherUnitTypeNorNever(type) {
|
|
64168
|
-
return !(type.flags & (
|
|
64197
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
64169
64198
|
}
|
|
64170
64199
|
function isUnitType(type) {
|
|
64171
|
-
return !!(type.flags &
|
|
64200
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
64172
64201
|
}
|
|
64173
64202
|
function isUnitLikeType(type) {
|
|
64174
64203
|
const t = getBaseConstraintOrType(type);
|
|
@@ -64181,7 +64210,7 @@ ${lanes.join("\n")}
|
|
|
64181
64210
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
64182
64211
|
}
|
|
64183
64212
|
function getBaseTypeOfLiteralType(type) {
|
|
64184
|
-
return type.flags &
|
|
64213
|
+
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
64214
|
}
|
|
64186
64215
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
64187
64216
|
var _a2;
|
|
@@ -64189,7 +64218,7 @@ ${lanes.join("\n")}
|
|
|
64189
64218
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
64190
64219
|
}
|
|
64191
64220
|
function getWidenedLiteralType(type) {
|
|
64192
|
-
return type.flags &
|
|
64221
|
+
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
64222
|
}
|
|
64194
64223
|
function getWidenedUniqueESSymbolType(type) {
|
|
64195
64224
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -64722,8 +64751,8 @@ ${lanes.join("\n")}
|
|
|
64722
64751
|
}
|
|
64723
64752
|
return false;
|
|
64724
64753
|
}
|
|
64725
|
-
function isTypeParameterAtTopLevel(type,
|
|
64726
|
-
return !!(type ===
|
|
64754
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
64755
|
+
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
64756
|
}
|
|
64728
64757
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
64729
64758
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -64817,7 +64846,7 @@ ${lanes.join("\n")}
|
|
|
64817
64846
|
yield targetProp;
|
|
64818
64847
|
} else if (matchDiscriminantProperties) {
|
|
64819
64848
|
const targetType = getTypeOfSymbol(targetProp);
|
|
64820
|
-
if (targetType.flags &
|
|
64849
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
64821
64850
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
64822
64851
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
64823
64852
|
yield targetProp;
|
|
@@ -65576,7 +65605,7 @@ ${lanes.join("\n")}
|
|
|
65576
65605
|
}
|
|
65577
65606
|
function hasPrimitiveConstraint(type) {
|
|
65578
65607
|
const constraint = getConstraintOfTypeParameter(type);
|
|
65579
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
65608
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
65580
65609
|
}
|
|
65581
65610
|
function isObjectLiteralType2(type) {
|
|
65582
65611
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -66058,7 +66087,7 @@ ${lanes.join("\n")}
|
|
|
66058
66087
|
return 83886079 /* UnknownFacts */;
|
|
66059
66088
|
}
|
|
66060
66089
|
function getIntersectionTypeFacts(type) {
|
|
66061
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
66090
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
66062
66091
|
let oredFacts = 0 /* None */;
|
|
66063
66092
|
let andedFacts = 134217727 /* All */;
|
|
66064
66093
|
for (const t of type.types) {
|
|
@@ -66257,7 +66286,7 @@ ${lanes.join("\n")}
|
|
|
66257
66286
|
}
|
|
66258
66287
|
return true;
|
|
66259
66288
|
}
|
|
66260
|
-
if (source.flags &
|
|
66289
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
66261
66290
|
return true;
|
|
66262
66291
|
}
|
|
66263
66292
|
return containsType(target.types, source);
|
|
@@ -67321,7 +67350,7 @@ ${lanes.join("\n")}
|
|
|
67321
67350
|
}
|
|
67322
67351
|
if (assumeTrue) {
|
|
67323
67352
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
67324
|
-
if (valueType.flags & (
|
|
67353
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
67325
67354
|
return valueType;
|
|
67326
67355
|
}
|
|
67327
67356
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -67371,7 +67400,7 @@ ${lanes.join("\n")}
|
|
|
67371
67400
|
let groundClauseTypes;
|
|
67372
67401
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
67373
67402
|
const t = clauseTypes[i];
|
|
67374
|
-
if (t.flags & (
|
|
67403
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
67375
67404
|
if (groundClauseTypes !== void 0) {
|
|
67376
67405
|
groundClauseTypes.push(t);
|
|
67377
67406
|
}
|
|
@@ -67519,18 +67548,29 @@ ${lanes.join("\n")}
|
|
|
67519
67548
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
67520
67549
|
}
|
|
67521
67550
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
67522
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
67523
67551
|
if (!assumeTrue) {
|
|
67524
|
-
|
|
67552
|
+
if (checkDerived) {
|
|
67553
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
67554
|
+
}
|
|
67555
|
+
const trueType2 = getNarrowedType(
|
|
67556
|
+
type,
|
|
67557
|
+
candidate,
|
|
67558
|
+
/*assumeTrue*/
|
|
67559
|
+
true,
|
|
67560
|
+
/*checkDerived*/
|
|
67561
|
+
false
|
|
67562
|
+
);
|
|
67563
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
67525
67564
|
}
|
|
67526
67565
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
67527
67566
|
return candidate;
|
|
67528
67567
|
}
|
|
67568
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
67529
67569
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
67530
67570
|
const narrowedType = mapType(candidate, (c) => {
|
|
67531
67571
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
67532
67572
|
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);
|
|
67573
|
+
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
67574
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
67535
67575
|
});
|
|
67536
67576
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -70870,7 +70910,7 @@ ${lanes.join("\n")}
|
|
|
70870
70910
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
70871
70911
|
let errorInfo;
|
|
70872
70912
|
let relatedInfo;
|
|
70873
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
70913
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
70874
70914
|
for (const subtype of containingType.types) {
|
|
70875
70915
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
70876
70916
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -71467,7 +71507,7 @@ ${lanes.join("\n")}
|
|
|
71467
71507
|
} else {
|
|
71468
71508
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
71469
71509
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
71470
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
71510
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
71471
71511
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
71472
71512
|
flags.push(1 /* Required */);
|
|
71473
71513
|
}
|
|
@@ -74717,7 +74757,7 @@ ${lanes.join("\n")}
|
|
|
74717
74757
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
74718
74758
|
return silentNeverType;
|
|
74719
74759
|
}
|
|
74720
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
74760
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
74721
74761
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
74722
74762
|
}
|
|
74723
74763
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -75303,7 +75343,7 @@ ${lanes.join("\n")}
|
|
|
75303
75343
|
return leftType;
|
|
75304
75344
|
} else {
|
|
75305
75345
|
checkAssignmentOperator(rightType);
|
|
75306
|
-
return
|
|
75346
|
+
return rightType;
|
|
75307
75347
|
}
|
|
75308
75348
|
case 27 /* CommaToken */:
|
|
75309
75349
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -77236,7 +77276,7 @@ ${lanes.join("\n")}
|
|
|
77236
77276
|
))) {
|
|
77237
77277
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
77238
77278
|
}
|
|
77239
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
77279
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
77240
77280
|
return void 0;
|
|
77241
77281
|
}
|
|
77242
77282
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -77288,7 +77328,7 @@ ${lanes.join("\n")}
|
|
|
77288
77328
|
return awaitedType || errorType;
|
|
77289
77329
|
}
|
|
77290
77330
|
function isThenableType(type) {
|
|
77291
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
77331
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
77292
77332
|
return false;
|
|
77293
77333
|
}
|
|
77294
77334
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -77337,7 +77377,7 @@ ${lanes.join("\n")}
|
|
|
77337
77377
|
return awaitedType;
|
|
77338
77378
|
}
|
|
77339
77379
|
}
|
|
77340
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77380
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
77341
77381
|
return type;
|
|
77342
77382
|
}
|
|
77343
77383
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -82686,7 +82726,7 @@ ${lanes.join("\n")}
|
|
|
82686
82726
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
82687
82727
|
}
|
|
82688
82728
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
82689
|
-
var _a2
|
|
82729
|
+
var _a2;
|
|
82690
82730
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
82691
82731
|
if (!typeName)
|
|
82692
82732
|
return 0 /* Unknown */;
|
|
@@ -82718,7 +82758,7 @@ ${lanes.join("\n")}
|
|
|
82718
82758
|
location
|
|
82719
82759
|
);
|
|
82720
82760
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
82721
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
82761
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
82722
82762
|
const typeSymbol = resolveEntityName(
|
|
82723
82763
|
typeName,
|
|
82724
82764
|
788968 /* Type */,
|
|
@@ -82869,7 +82909,7 @@ ${lanes.join("\n")}
|
|
|
82869
82909
|
return false;
|
|
82870
82910
|
}
|
|
82871
82911
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
82872
|
-
const enumResult = type.flags &
|
|
82912
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
82873
82913
|
type.symbol,
|
|
82874
82914
|
111551 /* Value */,
|
|
82875
82915
|
enclosing,
|
|
@@ -84430,7 +84470,7 @@ ${lanes.join("\n")}
|
|
|
84430
84470
|
}
|
|
84431
84471
|
function isSimpleLiteralEnumReference(expr) {
|
|
84432
84472
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
84433
|
-
return !!(checkExpressionCached(expr).flags &
|
|
84473
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
84434
84474
|
}
|
|
84435
84475
|
}
|
|
84436
84476
|
function checkAmbientInitializer(node) {
|
|
@@ -84832,10 +84872,10 @@ ${lanes.join("\n")}
|
|
|
84832
84872
|
}
|
|
84833
84873
|
function findMostOverlappyType(source, unionTarget) {
|
|
84834
84874
|
let bestMatch;
|
|
84835
|
-
if (!(source.flags & (
|
|
84875
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
84836
84876
|
let matchingCount = 0;
|
|
84837
84877
|
for (const target of unionTarget.types) {
|
|
84838
|
-
if (!(target.flags & (
|
|
84878
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
84839
84879
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
84840
84880
|
if (overlap.flags & 4194304 /* Index */) {
|
|
84841
84881
|
return target;
|
|
@@ -84853,7 +84893,7 @@ ${lanes.join("\n")}
|
|
|
84853
84893
|
}
|
|
84854
84894
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
84855
84895
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
84856
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
84896
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
84857
84897
|
if (!(result.flags & 131072 /* Never */)) {
|
|
84858
84898
|
return result;
|
|
84859
84899
|
}
|
|
@@ -85053,6 +85093,7 @@ ${lanes.join("\n")}
|
|
|
85053
85093
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
85054
85094
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
85055
85095
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
85096
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
85056
85097
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
85057
85098
|
return SignatureCheckMode3;
|
|
85058
85099
|
})(SignatureCheckMode || {});
|
|
@@ -139996,7 +140037,8 @@ ${lanes.join("\n")}
|
|
|
139996
140037
|
quotePreference,
|
|
139997
140038
|
defaultImport,
|
|
139998
140039
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
139999
|
-
namespaceLikeImport
|
|
140040
|
+
namespaceLikeImport,
|
|
140041
|
+
compilerOptions
|
|
140000
140042
|
);
|
|
140001
140043
|
newDeclarations = combine(newDeclarations, declarations);
|
|
140002
140044
|
});
|
|
@@ -140658,7 +140700,14 @@ ${lanes.join("\n")}
|
|
|
140658
140700
|
insertImports(
|
|
140659
140701
|
changes,
|
|
140660
140702
|
sourceFile,
|
|
140661
|
-
getDeclarations(
|
|
140703
|
+
getDeclarations(
|
|
140704
|
+
moduleSpecifier,
|
|
140705
|
+
quotePreference,
|
|
140706
|
+
defaultImport,
|
|
140707
|
+
namedImports,
|
|
140708
|
+
namespaceLikeImport,
|
|
140709
|
+
compilerOptions
|
|
140710
|
+
),
|
|
140662
140711
|
/*blankLineBetween*/
|
|
140663
140712
|
true,
|
|
140664
140713
|
preferences
|
|
@@ -140840,11 +140889,11 @@ ${lanes.join("\n")}
|
|
|
140840
140889
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
140841
140890
|
return addAsTypeOnly === 2 /* Required */;
|
|
140842
140891
|
}
|
|
140843
|
-
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
|
|
140892
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
|
|
140844
140893
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
140845
140894
|
let statements;
|
|
140846
140895
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
140847
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
|
|
140896
|
+
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 */);
|
|
140848
140897
|
statements = combine(statements, makeImport(
|
|
140849
140898
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
140850
140899
|
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
|
|
@@ -150234,7 +150283,7 @@ ${lanes.join("\n")}
|
|
|
150234
150283
|
function getApparentProperties(type, node, checker) {
|
|
150235
150284
|
if (!type.isUnion())
|
|
150236
150285
|
return type.getApparentProperties();
|
|
150237
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags &
|
|
150286
|
+
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()))));
|
|
150238
150287
|
}
|
|
150239
150288
|
function containsNonPublicProperties(props) {
|
|
150240
150289
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -155122,6 +155171,7 @@ ${lanes.join("\n")}
|
|
|
155122
155171
|
"module",
|
|
155123
155172
|
"name",
|
|
155124
155173
|
"namespace",
|
|
155174
|
+
"overload",
|
|
155125
155175
|
"override",
|
|
155126
155176
|
"package",
|
|
155127
155177
|
"param",
|