@typescript-deploys/pr-build 5.0.0-pr-52728-5 → 5.0.0-pr-52737-4
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 +168 -102
- package/lib/tsserver.js +188 -119
- package/lib/tsserverlibrary.d.ts +8 -5
- package/lib/tsserverlibrary.js +188 -119
- package/lib/typescript.d.ts +8 -5
- package/lib/typescript.js +188 -119
- package/lib/typingsInstaller.js +9 -5
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -3748,13 +3748,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3748
3748
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3749
3749
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3750
3750
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
3751
|
-
TypeFlags2[TypeFlags2["Unit"] =
|
|
3751
|
+
TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
|
|
3752
|
+
TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
|
|
3752
3753
|
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
3753
3754
|
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
|
|
3754
3755
|
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
3755
3756
|
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
3756
3757
|
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
|
|
3757
|
-
TypeFlags2[TypeFlags2["Primitive"] =
|
|
3758
|
+
TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
|
|
3758
3759
|
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
|
|
3759
3760
|
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
|
|
3760
3761
|
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
|
|
@@ -12158,7 +12159,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
12158
12159
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
12159
12160
|
}
|
|
12160
12161
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
12161
|
-
return isExternalModule(node) || compilerOptions
|
|
12162
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
12162
12163
|
}
|
|
12163
12164
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
12164
12165
|
switch (node.scriptKind) {
|
|
@@ -12179,7 +12180,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
|
12179
12180
|
if (startsWithUseStrict(node.statements)) {
|
|
12180
12181
|
return true;
|
|
12181
12182
|
}
|
|
12182
|
-
if (isExternalModule(node) || compilerOptions
|
|
12183
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
12183
12184
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
12184
12185
|
return true;
|
|
12185
12186
|
}
|
|
@@ -16235,7 +16236,7 @@ function getEmitDeclarations(compilerOptions) {
|
|
|
16235
16236
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
16236
16237
|
}
|
|
16237
16238
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
16238
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
16239
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
16239
16240
|
}
|
|
16240
16241
|
function isIncrementalCompilation(options) {
|
|
16241
16242
|
return !!(options.incremental || options.composite);
|
|
@@ -26987,7 +26988,6 @@ var Parser;
|
|
|
26987
26988
|
return canFollowExportModifier();
|
|
26988
26989
|
case 88 /* DefaultKeyword */:
|
|
26989
26990
|
return nextTokenCanFollowDefaultKeyword();
|
|
26990
|
-
case 127 /* AccessorKeyword */:
|
|
26991
26991
|
case 124 /* StaticKeyword */:
|
|
26992
26992
|
case 137 /* GetKeyword */:
|
|
26993
26993
|
case 151 /* SetKeyword */:
|
|
@@ -42519,6 +42519,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
42519
42519
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
42520
42520
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
42521
42521
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
42522
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
42522
42523
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
42523
42524
|
return SignatureCheckMode3;
|
|
42524
42525
|
})(SignatureCheckMode || {});
|
|
@@ -42584,7 +42585,6 @@ function createTypeChecker(host) {
|
|
|
42584
42585
|
let inlineLevel = 0;
|
|
42585
42586
|
let currentNode;
|
|
42586
42587
|
let varianceTypeParameter;
|
|
42587
|
-
let isInferencePartiallyBlocked = false;
|
|
42588
42588
|
const emptySymbols = createSymbolTable();
|
|
42589
42589
|
const arrayVariances = [1 /* Covariant */];
|
|
42590
42590
|
const compilerOptions = host.getCompilerOptions();
|
|
@@ -42794,15 +42794,14 @@ function createTypeChecker(host) {
|
|
|
42794
42794
|
getTypeOfPropertyOfContextualType,
|
|
42795
42795
|
getFullyQualifiedName,
|
|
42796
42796
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
42797
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
42797
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
42798
42798
|
call,
|
|
42799
42799
|
candidatesOutArray,
|
|
42800
42800
|
/*argumentCount*/
|
|
42801
42801
|
void 0,
|
|
42802
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
42803
|
-
|
|
42804
|
-
),
|
|
42805
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
42802
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
42803
|
+
)),
|
|
42804
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
42806
42805
|
getExpandedParameters,
|
|
42807
42806
|
hasEffectiveRestParameter,
|
|
42808
42807
|
containsArgumentsReference,
|
|
@@ -42996,34 +42995,41 @@ function createTypeChecker(host) {
|
|
|
42996
42995
|
getMemberOverrideModifierStatus,
|
|
42997
42996
|
isTypeParameterPossiblyReferenced
|
|
42998
42997
|
};
|
|
42999
|
-
function
|
|
42998
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
43000
42999
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
43001
43000
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
43001
|
+
if (containingCall) {
|
|
43002
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
43003
|
+
}
|
|
43004
|
+
const result = fn();
|
|
43005
|
+
if (containingCall) {
|
|
43006
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
43007
|
+
}
|
|
43008
|
+
return result;
|
|
43009
|
+
}
|
|
43010
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
43011
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
43002
43012
|
if (containingCall) {
|
|
43003
43013
|
let toMarkSkip = node;
|
|
43004
43014
|
do {
|
|
43005
43015
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
43006
43016
|
toMarkSkip = toMarkSkip.parent;
|
|
43007
43017
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43008
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
43009
43018
|
}
|
|
43010
|
-
|
|
43011
|
-
const result = fn();
|
|
43012
|
-
isInferencePartiallyBlocked = false;
|
|
43019
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
43013
43020
|
if (containingCall) {
|
|
43014
43021
|
let toMarkSkip = node;
|
|
43015
43022
|
do {
|
|
43016
43023
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
43017
43024
|
toMarkSkip = toMarkSkip.parent;
|
|
43018
43025
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
43019
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
43020
43026
|
}
|
|
43021
43027
|
return result;
|
|
43022
43028
|
}
|
|
43023
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
43029
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
43024
43030
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
43025
43031
|
apparentArgumentCount = argumentCount;
|
|
43026
|
-
const res = !node ? void 0 :
|
|
43032
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
43027
43033
|
apparentArgumentCount = void 0;
|
|
43028
43034
|
return res;
|
|
43029
43035
|
}
|
|
@@ -45985,7 +45991,7 @@ function createTypeChecker(host) {
|
|
|
45985
45991
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
45986
45992
|
}
|
|
45987
45993
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
45988
|
-
return !(resolvedExternalModuleType.flags &
|
|
45994
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
45989
45995
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
45990
45996
|
}
|
|
45991
45997
|
function getExportsOfSymbol(symbol) {
|
|
@@ -50184,8 +50190,8 @@ function createTypeChecker(host) {
|
|
|
50184
50190
|
const t = types[i];
|
|
50185
50191
|
flags |= t.flags;
|
|
50186
50192
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
50187
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
50188
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
50193
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
50194
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
50189
50195
|
if (baseType.flags & 1048576 /* Union */) {
|
|
50190
50196
|
const count = baseType.types.length;
|
|
50191
50197
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -50469,6 +50475,8 @@ function createTypeChecker(host) {
|
|
|
50469
50475
|
return !!target.baseTypesResolved;
|
|
50470
50476
|
case 8 /* WriteType */:
|
|
50471
50477
|
return !!getSymbolLinks(target).writeType;
|
|
50478
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
50479
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
50472
50480
|
}
|
|
50473
50481
|
return Debug.assertNever(propertyName);
|
|
50474
50482
|
}
|
|
@@ -52060,8 +52068,8 @@ function createTypeChecker(host) {
|
|
|
52060
52068
|
}
|
|
52061
52069
|
return links.declaredType;
|
|
52062
52070
|
}
|
|
52063
|
-
function
|
|
52064
|
-
return type.flags &
|
|
52071
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
52072
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
52065
52073
|
}
|
|
52066
52074
|
function getDeclaredTypeOfEnum(symbol) {
|
|
52067
52075
|
const links = getSymbolLinks(symbol);
|
|
@@ -52074,7 +52082,7 @@ function createTypeChecker(host) {
|
|
|
52074
52082
|
if (hasBindableName(member)) {
|
|
52075
52083
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
52076
52084
|
const value = getEnumMemberValue(member);
|
|
52077
|
-
const memberType = value !== void 0 ?
|
|
52085
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
52078
52086
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
52079
52087
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
52080
52088
|
}
|
|
@@ -52088,7 +52096,7 @@ function createTypeChecker(host) {
|
|
|
52088
52096
|
symbol,
|
|
52089
52097
|
/*aliasTypeArguments*/
|
|
52090
52098
|
void 0
|
|
52091
|
-
) :
|
|
52099
|
+
) : createComputedEnumType(symbol);
|
|
52092
52100
|
if (enumType.flags & 1048576 /* Union */) {
|
|
52093
52101
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
52094
52102
|
enumType.symbol = symbol;
|
|
@@ -52097,6 +52105,15 @@ function createTypeChecker(host) {
|
|
|
52097
52105
|
}
|
|
52098
52106
|
return links.declaredType;
|
|
52099
52107
|
}
|
|
52108
|
+
function createComputedEnumType(symbol) {
|
|
52109
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
52110
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
52111
|
+
regularType.regularType = regularType;
|
|
52112
|
+
regularType.freshType = freshType;
|
|
52113
|
+
freshType.regularType = regularType;
|
|
52114
|
+
freshType.freshType = freshType;
|
|
52115
|
+
return regularType;
|
|
52116
|
+
}
|
|
52100
52117
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
52101
52118
|
const links = getSymbolLinks(symbol);
|
|
52102
52119
|
if (!links.declaredType) {
|
|
@@ -55785,7 +55802,7 @@ function createTypeChecker(host) {
|
|
|
55785
55802
|
orderedRemoveItemAt(typeSet, 1);
|
|
55786
55803
|
}
|
|
55787
55804
|
}
|
|
55788
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55805
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
55789
55806
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55790
55807
|
}
|
|
55791
55808
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -55916,7 +55933,7 @@ function createTypeChecker(host) {
|
|
|
55916
55933
|
type = undefinedType;
|
|
55917
55934
|
}
|
|
55918
55935
|
if (!typeSet.has(type.id.toString())) {
|
|
55919
|
-
if (type.flags &
|
|
55936
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
55920
55937
|
includes |= 67108864 /* NonPrimitive */;
|
|
55921
55938
|
}
|
|
55922
55939
|
typeSet.set(type.id.toString(), type);
|
|
@@ -56192,7 +56209,7 @@ function createTypeChecker(host) {
|
|
|
56192
56209
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
56193
56210
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
56194
56211
|
function isDistributive(type) {
|
|
56195
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
56212
|
+
return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
|
|
56196
56213
|
}
|
|
56197
56214
|
}
|
|
56198
56215
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -57289,7 +57306,7 @@ function createTypeChecker(host) {
|
|
|
57289
57306
|
return type;
|
|
57290
57307
|
}
|
|
57291
57308
|
function getFreshTypeOfLiteralType(type) {
|
|
57292
|
-
if (type.flags &
|
|
57309
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
57293
57310
|
if (!type.freshType) {
|
|
57294
57311
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
57295
57312
|
freshType.freshType = freshType;
|
|
@@ -57300,10 +57317,10 @@ function createTypeChecker(host) {
|
|
|
57300
57317
|
return type;
|
|
57301
57318
|
}
|
|
57302
57319
|
function getRegularTypeOfLiteralType(type) {
|
|
57303
|
-
return type.flags &
|
|
57320
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
57304
57321
|
}
|
|
57305
57322
|
function isFreshLiteralType(type) {
|
|
57306
|
-
return !!(type.flags &
|
|
57323
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
57307
57324
|
}
|
|
57308
57325
|
function getStringLiteralType(value) {
|
|
57309
57326
|
let type;
|
|
@@ -57982,13 +57999,13 @@ function createTypeChecker(host) {
|
|
|
57982
57999
|
return type;
|
|
57983
58000
|
}
|
|
57984
58001
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
57985
|
-
return type.flags & (
|
|
58002
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
57986
58003
|
}
|
|
57987
58004
|
function getPermissiveInstantiation(type) {
|
|
57988
|
-
return type.flags & (
|
|
58005
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
57989
58006
|
}
|
|
57990
58007
|
function getRestrictiveInstantiation(type) {
|
|
57991
|
-
if (type.flags & (
|
|
58008
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
57992
58009
|
return type;
|
|
57993
58010
|
}
|
|
57994
58011
|
if (type.restrictiveInstantiation) {
|
|
@@ -58568,7 +58585,7 @@ function createTypeChecker(host) {
|
|
|
58568
58585
|
}
|
|
58569
58586
|
}
|
|
58570
58587
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58571
|
-
if (target.flags & (
|
|
58588
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58572
58589
|
return false;
|
|
58573
58590
|
if (isTupleLikeType(source)) {
|
|
58574
58591
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -58617,7 +58634,7 @@ function createTypeChecker(host) {
|
|
|
58617
58634
|
}
|
|
58618
58635
|
}
|
|
58619
58636
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58620
|
-
if (target.flags & (
|
|
58637
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58621
58638
|
return false;
|
|
58622
58639
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
58623
58640
|
}
|
|
@@ -58640,16 +58657,24 @@ function createTypeChecker(host) {
|
|
|
58640
58657
|
void 0
|
|
58641
58658
|
) !== 0 /* False */;
|
|
58642
58659
|
}
|
|
58643
|
-
function
|
|
58644
|
-
|
|
58660
|
+
function isTopSignature(s) {
|
|
58661
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
58662
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
58663
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
58664
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
58665
|
+
}
|
|
58666
|
+
return false;
|
|
58645
58667
|
}
|
|
58646
58668
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
58647
58669
|
if (source === target) {
|
|
58648
58670
|
return -1 /* True */;
|
|
58649
58671
|
}
|
|
58650
|
-
if (
|
|
58672
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
58651
58673
|
return -1 /* True */;
|
|
58652
58674
|
}
|
|
58675
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
58676
|
+
return 0 /* False */;
|
|
58677
|
+
}
|
|
58653
58678
|
const targetCount = getParameterCount(target);
|
|
58654
58679
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
58655
58680
|
if (sourceHasMoreParameters) {
|
|
@@ -58867,7 +58892,9 @@ function createTypeChecker(host) {
|
|
|
58867
58892
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
58868
58893
|
const s = source.flags;
|
|
58869
58894
|
const t = target.flags;
|
|
58870
|
-
if (t &
|
|
58895
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
58896
|
+
return true;
|
|
58897
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
58871
58898
|
return true;
|
|
58872
58899
|
if (t & 131072 /* Never */)
|
|
58873
58900
|
return false;
|
|
@@ -59264,7 +59291,7 @@ function createTypeChecker(host) {
|
|
|
59264
59291
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
59265
59292
|
}
|
|
59266
59293
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
59267
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
59294
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
59268
59295
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
59269
59296
|
return -1 /* True */;
|
|
59270
59297
|
}
|
|
@@ -59328,7 +59355,7 @@ function createTypeChecker(host) {
|
|
|
59328
59355
|
return 0 /* False */;
|
|
59329
59356
|
}
|
|
59330
59357
|
}
|
|
59331
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
59358
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
|
|
59332
59359
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
59333
59360
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
59334
59361
|
if (reportErrors2) {
|
|
@@ -59390,7 +59417,7 @@ function createTypeChecker(host) {
|
|
|
59390
59417
|
maybeSuppress = !!errorInfo;
|
|
59391
59418
|
}
|
|
59392
59419
|
}
|
|
59393
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
59420
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
59394
59421
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
59395
59422
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
59396
59423
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -59536,15 +59563,15 @@ function createTypeChecker(host) {
|
|
|
59536
59563
|
}
|
|
59537
59564
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
59538
59565
|
if (source2.flags & 1048576 /* Union */) {
|
|
59539
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
59566
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
59540
59567
|
}
|
|
59541
59568
|
if (target2.flags & 1048576 /* Union */) {
|
|
59542
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
59569
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
59543
59570
|
}
|
|
59544
59571
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
59545
59572
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
59546
59573
|
}
|
|
59547
|
-
if (relation === comparableRelation && target2.flags &
|
|
59574
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
59548
59575
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
59549
59576
|
if (constraints !== source2.types) {
|
|
59550
59577
|
source2 = getIntersectionType(constraints);
|
|
@@ -60437,7 +60464,7 @@ function createTypeChecker(host) {
|
|
|
60437
60464
|
}
|
|
60438
60465
|
return 0 /* False */;
|
|
60439
60466
|
}
|
|
60440
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
60467
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
60441
60468
|
if (relation !== identityRelation) {
|
|
60442
60469
|
source2 = getApparentType(source2);
|
|
60443
60470
|
sourceFlags = source2.flags;
|
|
@@ -61107,10 +61134,11 @@ function createTypeChecker(host) {
|
|
|
61107
61134
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
61108
61135
|
}
|
|
61109
61136
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
61137
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
61110
61138
|
return compareSignaturesRelated(
|
|
61111
61139
|
erase ? getErasedSignature(source2) : source2,
|
|
61112
61140
|
erase ? getErasedSignature(target2) : target2,
|
|
61113
|
-
|
|
61141
|
+
checkMode,
|
|
61114
61142
|
reportErrors2,
|
|
61115
61143
|
reportError,
|
|
61116
61144
|
incompatibleReporter,
|
|
@@ -61235,7 +61263,7 @@ function createTypeChecker(host) {
|
|
|
61235
61263
|
if (sourceInfo) {
|
|
61236
61264
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
61237
61265
|
}
|
|
61238
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61266
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61239
61267
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
61240
61268
|
}
|
|
61241
61269
|
if (reportErrors2) {
|
|
@@ -61780,10 +61808,10 @@ function createTypeChecker(host) {
|
|
|
61780
61808
|
return void 0;
|
|
61781
61809
|
}
|
|
61782
61810
|
function isNeitherUnitTypeNorNever(type) {
|
|
61783
|
-
return !(type.flags & (
|
|
61811
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
61784
61812
|
}
|
|
61785
61813
|
function isUnitType(type) {
|
|
61786
|
-
return !!(type.flags &
|
|
61814
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
61787
61815
|
}
|
|
61788
61816
|
function isUnitLikeType(type) {
|
|
61789
61817
|
const t = getBaseConstraintOrType(type);
|
|
@@ -61796,15 +61824,18 @@ function createTypeChecker(host) {
|
|
|
61796
61824
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
61797
61825
|
}
|
|
61798
61826
|
function getBaseTypeOfLiteralType(type) {
|
|
61799
|
-
return type.flags &
|
|
61827
|
+
return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
|
|
61800
61828
|
}
|
|
61801
61829
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
61802
61830
|
var _a2;
|
|
61803
61831
|
const key = `B${getTypeId(type)}`;
|
|
61804
61832
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
61805
61833
|
}
|
|
61834
|
+
function getBaseTypeOfLiteralTypeForComparison(type) {
|
|
61835
|
+
return type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & (256 /* NumberLiteral */ | 32 /* Enum */) ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getBaseTypeOfLiteralTypeForComparison) : type;
|
|
61836
|
+
}
|
|
61806
61837
|
function getWidenedLiteralType(type) {
|
|
61807
|
-
return type.flags &
|
|
61838
|
+
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;
|
|
61808
61839
|
}
|
|
61809
61840
|
function getWidenedUniqueESSymbolType(type) {
|
|
61810
61841
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -62337,8 +62368,8 @@ function createTypeChecker(host) {
|
|
|
62337
62368
|
}
|
|
62338
62369
|
return false;
|
|
62339
62370
|
}
|
|
62340
|
-
function isTypeParameterAtTopLevel(type,
|
|
62341
|
-
return !!(type ===
|
|
62371
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
62372
|
+
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)));
|
|
62342
62373
|
}
|
|
62343
62374
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
62344
62375
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -62432,7 +62463,7 @@ function createTypeChecker(host) {
|
|
|
62432
62463
|
yield targetProp;
|
|
62433
62464
|
} else if (matchDiscriminantProperties) {
|
|
62434
62465
|
const targetType = getTypeOfSymbol(targetProp);
|
|
62435
|
-
if (targetType.flags &
|
|
62466
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
62436
62467
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
62437
62468
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
62438
62469
|
yield targetProp;
|
|
@@ -62493,10 +62524,10 @@ function createTypeChecker(host) {
|
|
|
62493
62524
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
62494
62525
|
}
|
|
62495
62526
|
function isMemberOfStringMapping(source, target) {
|
|
62496
|
-
if (target.flags &
|
|
62527
|
+
if (target.flags & 1 /* Any */) {
|
|
62497
62528
|
return true;
|
|
62498
62529
|
}
|
|
62499
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
62530
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
62500
62531
|
return isTypeAssignableTo(source, target);
|
|
62501
62532
|
}
|
|
62502
62533
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -63035,6 +63066,7 @@ function createTypeChecker(host) {
|
|
|
63035
63066
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
63036
63067
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
63037
63068
|
if (inferToMappedType(source, target, constraintType)) {
|
|
63069
|
+
inferFromMappedProperties(source, target);
|
|
63038
63070
|
return;
|
|
63039
63071
|
}
|
|
63040
63072
|
}
|
|
@@ -63135,6 +63167,19 @@ function createTypeChecker(host) {
|
|
|
63135
63167
|
}
|
|
63136
63168
|
}
|
|
63137
63169
|
}
|
|
63170
|
+
function inferFromMappedProperties(source, target) {
|
|
63171
|
+
const properties = getPropertiesOfObjectType(source);
|
|
63172
|
+
for (const sourceProp of properties) {
|
|
63173
|
+
if (!some(sourceProp.declarations, hasSkipDirectInferenceFlag)) {
|
|
63174
|
+
const sourcePropType = getTypeOfSymbol(sourceProp);
|
|
63175
|
+
if (!couldContainTypeVariables(sourcePropType)) {
|
|
63176
|
+
continue;
|
|
63177
|
+
}
|
|
63178
|
+
const targetPropType = substituteIndexedMappedType(target, getStringLiteralType(unescapeLeadingUnderscores(sourceProp.escapedName)));
|
|
63179
|
+
inferFromTypes(sourcePropType, targetPropType);
|
|
63180
|
+
}
|
|
63181
|
+
}
|
|
63182
|
+
}
|
|
63138
63183
|
function inferFromSignatures(source, target, kind) {
|
|
63139
63184
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
63140
63185
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -63191,7 +63236,7 @@ function createTypeChecker(host) {
|
|
|
63191
63236
|
}
|
|
63192
63237
|
function hasPrimitiveConstraint(type) {
|
|
63193
63238
|
const constraint = getConstraintOfTypeParameter(type);
|
|
63194
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
63239
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
63195
63240
|
}
|
|
63196
63241
|
function isObjectLiteralType(type) {
|
|
63197
63242
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -63673,7 +63718,7 @@ function createTypeChecker(host) {
|
|
|
63673
63718
|
return 83886079 /* UnknownFacts */;
|
|
63674
63719
|
}
|
|
63675
63720
|
function getIntersectionTypeFacts(type) {
|
|
63676
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
63721
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
63677
63722
|
let oredFacts = 0 /* None */;
|
|
63678
63723
|
let andedFacts = 134217727 /* All */;
|
|
63679
63724
|
for (const t of type.types) {
|
|
@@ -63872,7 +63917,7 @@ function createTypeChecker(host) {
|
|
|
63872
63917
|
}
|
|
63873
63918
|
return true;
|
|
63874
63919
|
}
|
|
63875
|
-
if (source.flags &
|
|
63920
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
63876
63921
|
return true;
|
|
63877
63922
|
}
|
|
63878
63923
|
return containsType(target.types, source);
|
|
@@ -64936,7 +64981,7 @@ function createTypeChecker(host) {
|
|
|
64936
64981
|
}
|
|
64937
64982
|
if (assumeTrue) {
|
|
64938
64983
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
64939
|
-
if (valueType.flags & (
|
|
64984
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
64940
64985
|
return valueType;
|
|
64941
64986
|
}
|
|
64942
64987
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -64986,7 +65031,7 @@ function createTypeChecker(host) {
|
|
|
64986
65031
|
let groundClauseTypes;
|
|
64987
65032
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
64988
65033
|
const t = clauseTypes[i];
|
|
64989
|
-
if (t.flags & (
|
|
65034
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
64990
65035
|
if (groundClauseTypes !== void 0) {
|
|
64991
65036
|
groundClauseTypes.push(t);
|
|
64992
65037
|
}
|
|
@@ -65134,18 +65179,29 @@ function createTypeChecker(host) {
|
|
|
65134
65179
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
65135
65180
|
}
|
|
65136
65181
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
65137
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65138
65182
|
if (!assumeTrue) {
|
|
65139
|
-
|
|
65183
|
+
if (checkDerived) {
|
|
65184
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
65185
|
+
}
|
|
65186
|
+
const trueType2 = getNarrowedType(
|
|
65187
|
+
type,
|
|
65188
|
+
candidate,
|
|
65189
|
+
/*assumeTrue*/
|
|
65190
|
+
true,
|
|
65191
|
+
/*checkDerived*/
|
|
65192
|
+
false
|
|
65193
|
+
);
|
|
65194
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
65140
65195
|
}
|
|
65141
65196
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
65142
65197
|
return candidate;
|
|
65143
65198
|
}
|
|
65199
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65144
65200
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
65145
65201
|
const narrowedType = mapType(candidate, (c) => {
|
|
65146
65202
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65147
65203
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65148
|
-
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);
|
|
65204
|
+
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);
|
|
65149
65205
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65150
65206
|
});
|
|
65151
65207
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -65301,15 +65357,25 @@ function createTypeChecker(host) {
|
|
|
65301
65357
|
function isConstVariable(symbol) {
|
|
65302
65358
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
65303
65359
|
}
|
|
65304
|
-
function
|
|
65305
|
-
|
|
65306
|
-
|
|
65307
|
-
|
|
65308
|
-
|
|
65309
|
-
|
|
65310
|
-
|
|
65311
|
-
|
|
65360
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
65361
|
+
const links = getNodeLinks(declaration);
|
|
65362
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
65363
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
65364
|
+
reportCircularityError(declaration.symbol);
|
|
65365
|
+
return true;
|
|
65366
|
+
}
|
|
65367
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
65368
|
+
if (!popTypeResolution()) {
|
|
65369
|
+
reportCircularityError(declaration.symbol);
|
|
65370
|
+
return true;
|
|
65371
|
+
}
|
|
65372
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
65312
65373
|
}
|
|
65374
|
+
return links.parameterInitializerContainsUndefined;
|
|
65375
|
+
}
|
|
65376
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
65377
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
65378
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
65313
65379
|
}
|
|
65314
65380
|
function isConstraintPosition(type, node) {
|
|
65315
65381
|
const parent = node.parent;
|
|
@@ -68475,7 +68541,7 @@ function createTypeChecker(host) {
|
|
|
68475
68541
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
68476
68542
|
let errorInfo;
|
|
68477
68543
|
let relatedInfo;
|
|
68478
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
68544
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
68479
68545
|
for (const subtype of containingType.types) {
|
|
68480
68546
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
68481
68547
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -69072,7 +69138,7 @@ function createTypeChecker(host) {
|
|
|
69072
69138
|
} else {
|
|
69073
69139
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69074
69140
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
69075
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
69141
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
69076
69142
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
69077
69143
|
flags.push(1 /* Required */);
|
|
69078
69144
|
}
|
|
@@ -69606,7 +69672,7 @@ function createTypeChecker(host) {
|
|
|
69606
69672
|
const isTaggedTemplate = node.kind === 212 /* TaggedTemplateExpression */;
|
|
69607
69673
|
const isDecorator2 = node.kind === 167 /* Decorator */;
|
|
69608
69674
|
const isJsxOpeningOrSelfClosingElement = isJsxOpeningLikeElement(node);
|
|
69609
|
-
const reportErrors2 = !
|
|
69675
|
+
const reportErrors2 = !candidatesOutArray;
|
|
69610
69676
|
let typeArguments;
|
|
69611
69677
|
if (!isDecorator2 && !isSuperCall(node)) {
|
|
69612
69678
|
typeArguments = node.typeArguments;
|
|
@@ -72322,7 +72388,7 @@ function createTypeChecker(host) {
|
|
|
72322
72388
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
72323
72389
|
return silentNeverType;
|
|
72324
72390
|
}
|
|
72325
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
72391
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
72326
72392
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
72327
72393
|
}
|
|
72328
72394
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -72847,8 +72913,8 @@ function createTypeChecker(host) {
|
|
|
72847
72913
|
case 32 /* LessThanEqualsToken */:
|
|
72848
72914
|
case 33 /* GreaterThanEqualsToken */:
|
|
72849
72915
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
72850
|
-
leftType =
|
|
72851
|
-
rightType =
|
|
72916
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
72917
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
72852
72918
|
reportOperatorErrorUnless((left2, right2) => {
|
|
72853
72919
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
72854
72920
|
return true;
|
|
@@ -72908,7 +72974,7 @@ function createTypeChecker(host) {
|
|
|
72908
72974
|
return leftType;
|
|
72909
72975
|
} else {
|
|
72910
72976
|
checkAssignmentOperator(rightType);
|
|
72911
|
-
return
|
|
72977
|
+
return rightType;
|
|
72912
72978
|
}
|
|
72913
72979
|
case 27 /* CommaToken */:
|
|
72914
72980
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -74841,7 +74907,7 @@ function createTypeChecker(host) {
|
|
|
74841
74907
|
))) {
|
|
74842
74908
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
74843
74909
|
}
|
|
74844
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74910
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74845
74911
|
return void 0;
|
|
74846
74912
|
}
|
|
74847
74913
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74893,7 +74959,7 @@ function createTypeChecker(host) {
|
|
|
74893
74959
|
return awaitedType || errorType;
|
|
74894
74960
|
}
|
|
74895
74961
|
function isThenableType(type) {
|
|
74896
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74962
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74897
74963
|
return false;
|
|
74898
74964
|
}
|
|
74899
74965
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74942,7 +75008,7 @@ function createTypeChecker(host) {
|
|
|
74942
75008
|
return awaitedType;
|
|
74943
75009
|
}
|
|
74944
75010
|
}
|
|
74945
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
75011
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
74946
75012
|
return type;
|
|
74947
75013
|
}
|
|
74948
75014
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -80291,7 +80357,7 @@ function createTypeChecker(host) {
|
|
|
80291
80357
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
80292
80358
|
}
|
|
80293
80359
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
80294
|
-
var _a2
|
|
80360
|
+
var _a2;
|
|
80295
80361
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
80296
80362
|
if (!typeName)
|
|
80297
80363
|
return 0 /* Unknown */;
|
|
@@ -80323,7 +80389,7 @@ function createTypeChecker(host) {
|
|
|
80323
80389
|
location
|
|
80324
80390
|
);
|
|
80325
80391
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
80326
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
80392
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
80327
80393
|
const typeSymbol = resolveEntityName(
|
|
80328
80394
|
typeName,
|
|
80329
80395
|
788968 /* Type */,
|
|
@@ -80474,7 +80540,7 @@ function createTypeChecker(host) {
|
|
|
80474
80540
|
return false;
|
|
80475
80541
|
}
|
|
80476
80542
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
80477
|
-
const enumResult = type.flags &
|
|
80543
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
80478
80544
|
type.symbol,
|
|
80479
80545
|
111551 /* Value */,
|
|
80480
80546
|
enclosing,
|
|
@@ -82035,7 +82101,7 @@ function createTypeChecker(host) {
|
|
|
82035
82101
|
}
|
|
82036
82102
|
function isSimpleLiteralEnumReference(expr) {
|
|
82037
82103
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
82038
|
-
return !!(checkExpressionCached(expr).flags &
|
|
82104
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
82039
82105
|
}
|
|
82040
82106
|
}
|
|
82041
82107
|
function checkAmbientInitializer(node) {
|
|
@@ -82437,10 +82503,10 @@ function createTypeChecker(host) {
|
|
|
82437
82503
|
}
|
|
82438
82504
|
function findMostOverlappyType(source, unionTarget) {
|
|
82439
82505
|
let bestMatch;
|
|
82440
|
-
if (!(source.flags & (
|
|
82506
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82441
82507
|
let matchingCount = 0;
|
|
82442
82508
|
for (const target of unionTarget.types) {
|
|
82443
|
-
if (!(target.flags & (
|
|
82509
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82444
82510
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
82445
82511
|
if (overlap.flags & 4194304 /* Index */) {
|
|
82446
82512
|
return target;
|
|
@@ -82458,7 +82524,7 @@ function createTypeChecker(host) {
|
|
|
82458
82524
|
}
|
|
82459
82525
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
82460
82526
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
82461
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
82527
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
82462
82528
|
if (!(result.flags & 131072 /* Never */)) {
|
|
82463
82529
|
return result;
|
|
82464
82530
|
}
|
|
@@ -87036,7 +87102,7 @@ function transformTypeScript(context) {
|
|
|
87036
87102
|
return node;
|
|
87037
87103
|
}
|
|
87038
87104
|
function tryGetConstEnumValue(node) {
|
|
87039
|
-
if (compilerOptions
|
|
87105
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
87040
87106
|
return void 0;
|
|
87041
87107
|
}
|
|
87042
87108
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -103366,7 +103432,7 @@ function transformECMAScriptModule(context) {
|
|
|
103366
103432
|
if (node.isDeclarationFile) {
|
|
103367
103433
|
return node;
|
|
103368
103434
|
}
|
|
103369
|
-
if (isExternalModule(node) || compilerOptions
|
|
103435
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
103370
103436
|
currentSourceFile = node;
|
|
103371
103437
|
importRequireStatements = void 0;
|
|
103372
103438
|
let result = updateExternalModule(node);
|
|
@@ -103573,7 +103639,7 @@ function transformECMAScriptModule(context) {
|
|
|
103573
103639
|
}
|
|
103574
103640
|
function onEmitNode(hint, node, emitCallback) {
|
|
103575
103641
|
if (isSourceFile(node)) {
|
|
103576
|
-
if ((isExternalModule(node) || compilerOptions
|
|
103642
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
103577
103643
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
103578
103644
|
}
|
|
103579
103645
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -114167,7 +114233,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114167
114233
|
let imports;
|
|
114168
114234
|
let moduleAugmentations;
|
|
114169
114235
|
let ambientModules;
|
|
114170
|
-
if ((options
|
|
114236
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
114171
114237
|
if (options.importHelpers) {
|
|
114172
114238
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
114173
114239
|
}
|
|
@@ -114888,12 +114954,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114888
114954
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
114889
114955
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
114890
114956
|
}
|
|
114891
|
-
if (options.isolatedModules) {
|
|
114957
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
114892
114958
|
if (options.out) {
|
|
114893
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
114959
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
114894
114960
|
}
|
|
114895
114961
|
if (options.outFile) {
|
|
114896
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
114962
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
114897
114963
|
}
|
|
114898
114964
|
}
|
|
114899
114965
|
if (options.inlineSourceMap) {
|
|
@@ -116300,7 +116366,7 @@ var BuilderState;
|
|
|
116300
116366
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
116301
116367
|
}
|
|
116302
116368
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
116303
|
-
if (compilerOptions && (compilerOptions
|
|
116369
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
116304
116370
|
return [sourceFileWithUpdatedShape];
|
|
116305
116371
|
}
|
|
116306
116372
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -116713,7 +116779,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
116713
116779
|
return;
|
|
116714
116780
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
116715
116781
|
return;
|
|
116716
|
-
if (state.compilerOptions
|
|
116782
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
116717
116783
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
116718
116784
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
116719
116785
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|