@typescript-deploys/pr-build 5.0.0-pr-52679-5 → 5.0.0-pr-52737-7
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 +148 -87
- package/lib/tsserver.js +168 -104
- package/lib/tsserverlibrary.d.ts +8 -5
- package/lib/tsserverlibrary.js +168 -104
- package/lib/typescript.d.ts +8 -5
- package/lib/typescript.js +168 -104
- 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 || {});
|
|
@@ -45990,7 +45991,7 @@ function createTypeChecker(host) {
|
|
|
45990
45991
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
45991
45992
|
}
|
|
45992
45993
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
45993
|
-
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
|
|
45994
45995
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
45995
45996
|
}
|
|
45996
45997
|
function getExportsOfSymbol(symbol) {
|
|
@@ -50189,8 +50190,8 @@ function createTypeChecker(host) {
|
|
|
50189
50190
|
const t = types[i];
|
|
50190
50191
|
flags |= t.flags;
|
|
50191
50192
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
50192
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
50193
|
-
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);
|
|
50194
50195
|
if (baseType.flags & 1048576 /* Union */) {
|
|
50195
50196
|
const count = baseType.types.length;
|
|
50196
50197
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -50474,6 +50475,8 @@ function createTypeChecker(host) {
|
|
|
50474
50475
|
return !!target.baseTypesResolved;
|
|
50475
50476
|
case 8 /* WriteType */:
|
|
50476
50477
|
return !!getSymbolLinks(target).writeType;
|
|
50478
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
50479
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
50477
50480
|
}
|
|
50478
50481
|
return Debug.assertNever(propertyName);
|
|
50479
50482
|
}
|
|
@@ -52065,8 +52068,8 @@ function createTypeChecker(host) {
|
|
|
52065
52068
|
}
|
|
52066
52069
|
return links.declaredType;
|
|
52067
52070
|
}
|
|
52068
|
-
function
|
|
52069
|
-
return type.flags &
|
|
52071
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
52072
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
52070
52073
|
}
|
|
52071
52074
|
function getDeclaredTypeOfEnum(symbol) {
|
|
52072
52075
|
const links = getSymbolLinks(symbol);
|
|
@@ -52079,7 +52082,7 @@ function createTypeChecker(host) {
|
|
|
52079
52082
|
if (hasBindableName(member)) {
|
|
52080
52083
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
52081
52084
|
const value = getEnumMemberValue(member);
|
|
52082
|
-
const memberType = value !== void 0 ?
|
|
52085
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
52083
52086
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
52084
52087
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
52085
52088
|
}
|
|
@@ -52093,7 +52096,7 @@ function createTypeChecker(host) {
|
|
|
52093
52096
|
symbol,
|
|
52094
52097
|
/*aliasTypeArguments*/
|
|
52095
52098
|
void 0
|
|
52096
|
-
) :
|
|
52099
|
+
) : createComputedEnumType(symbol);
|
|
52097
52100
|
if (enumType.flags & 1048576 /* Union */) {
|
|
52098
52101
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
52099
52102
|
enumType.symbol = symbol;
|
|
@@ -52102,6 +52105,15 @@ function createTypeChecker(host) {
|
|
|
52102
52105
|
}
|
|
52103
52106
|
return links.declaredType;
|
|
52104
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
|
+
}
|
|
52105
52117
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
52106
52118
|
const links = getSymbolLinks(symbol);
|
|
52107
52119
|
if (!links.declaredType) {
|
|
@@ -55790,7 +55802,7 @@ function createTypeChecker(host) {
|
|
|
55790
55802
|
orderedRemoveItemAt(typeSet, 1);
|
|
55791
55803
|
}
|
|
55792
55804
|
}
|
|
55793
|
-
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 */) {
|
|
55794
55806
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
55795
55807
|
}
|
|
55796
55808
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -55921,7 +55933,7 @@ function createTypeChecker(host) {
|
|
|
55921
55933
|
type = undefinedType;
|
|
55922
55934
|
}
|
|
55923
55935
|
if (!typeSet.has(type.id.toString())) {
|
|
55924
|
-
if (type.flags &
|
|
55936
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
55925
55937
|
includes |= 67108864 /* NonPrimitive */;
|
|
55926
55938
|
}
|
|
55927
55939
|
typeSet.set(type.id.toString(), type);
|
|
@@ -56197,7 +56209,7 @@ function createTypeChecker(host) {
|
|
|
56197
56209
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
56198
56210
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
56199
56211
|
function isDistributive(type) {
|
|
56200
|
-
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;
|
|
56201
56213
|
}
|
|
56202
56214
|
}
|
|
56203
56215
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -57294,7 +57306,7 @@ function createTypeChecker(host) {
|
|
|
57294
57306
|
return type;
|
|
57295
57307
|
}
|
|
57296
57308
|
function getFreshTypeOfLiteralType(type) {
|
|
57297
|
-
if (type.flags &
|
|
57309
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
57298
57310
|
if (!type.freshType) {
|
|
57299
57311
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
57300
57312
|
freshType.freshType = freshType;
|
|
@@ -57305,10 +57317,10 @@ function createTypeChecker(host) {
|
|
|
57305
57317
|
return type;
|
|
57306
57318
|
}
|
|
57307
57319
|
function getRegularTypeOfLiteralType(type) {
|
|
57308
|
-
return type.flags &
|
|
57320
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
57309
57321
|
}
|
|
57310
57322
|
function isFreshLiteralType(type) {
|
|
57311
|
-
return !!(type.flags &
|
|
57323
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
57312
57324
|
}
|
|
57313
57325
|
function getStringLiteralType(value) {
|
|
57314
57326
|
let type;
|
|
@@ -57987,13 +57999,13 @@ function createTypeChecker(host) {
|
|
|
57987
57999
|
return type;
|
|
57988
58000
|
}
|
|
57989
58001
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
57990
|
-
return type.flags & (
|
|
58002
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
57991
58003
|
}
|
|
57992
58004
|
function getPermissiveInstantiation(type) {
|
|
57993
|
-
return type.flags & (
|
|
58005
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
57994
58006
|
}
|
|
57995
58007
|
function getRestrictiveInstantiation(type) {
|
|
57996
|
-
if (type.flags & (
|
|
58008
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
57997
58009
|
return type;
|
|
57998
58010
|
}
|
|
57999
58011
|
if (type.restrictiveInstantiation) {
|
|
@@ -58573,7 +58585,7 @@ function createTypeChecker(host) {
|
|
|
58573
58585
|
}
|
|
58574
58586
|
}
|
|
58575
58587
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58576
|
-
if (target.flags & (
|
|
58588
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58577
58589
|
return false;
|
|
58578
58590
|
if (isTupleLikeType(source)) {
|
|
58579
58591
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -58622,7 +58634,7 @@ function createTypeChecker(host) {
|
|
|
58622
58634
|
}
|
|
58623
58635
|
}
|
|
58624
58636
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
58625
|
-
if (target.flags & (
|
|
58637
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
58626
58638
|
return false;
|
|
58627
58639
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
58628
58640
|
}
|
|
@@ -58645,16 +58657,24 @@ function createTypeChecker(host) {
|
|
|
58645
58657
|
void 0
|
|
58646
58658
|
) !== 0 /* False */;
|
|
58647
58659
|
}
|
|
58648
|
-
function
|
|
58649
|
-
|
|
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;
|
|
58650
58667
|
}
|
|
58651
58668
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
58652
58669
|
if (source === target) {
|
|
58653
58670
|
return -1 /* True */;
|
|
58654
58671
|
}
|
|
58655
|
-
if (
|
|
58672
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
58656
58673
|
return -1 /* True */;
|
|
58657
58674
|
}
|
|
58675
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
58676
|
+
return 0 /* False */;
|
|
58677
|
+
}
|
|
58658
58678
|
const targetCount = getParameterCount(target);
|
|
58659
58679
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
58660
58680
|
if (sourceHasMoreParameters) {
|
|
@@ -58872,7 +58892,9 @@ function createTypeChecker(host) {
|
|
|
58872
58892
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
58873
58893
|
const s = source.flags;
|
|
58874
58894
|
const t = target.flags;
|
|
58875
|
-
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 */))
|
|
58876
58898
|
return true;
|
|
58877
58899
|
if (t & 131072 /* Never */)
|
|
58878
58900
|
return false;
|
|
@@ -59269,7 +59291,7 @@ function createTypeChecker(host) {
|
|
|
59269
59291
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
59270
59292
|
}
|
|
59271
59293
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
59272
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
59294
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
59273
59295
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
59274
59296
|
return -1 /* True */;
|
|
59275
59297
|
}
|
|
@@ -59333,7 +59355,7 @@ function createTypeChecker(host) {
|
|
|
59333
59355
|
return 0 /* False */;
|
|
59334
59356
|
}
|
|
59335
59357
|
}
|
|
59336
|
-
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));
|
|
59337
59359
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
59338
59360
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
59339
59361
|
if (reportErrors2) {
|
|
@@ -59395,7 +59417,7 @@ function createTypeChecker(host) {
|
|
|
59395
59417
|
maybeSuppress = !!errorInfo;
|
|
59396
59418
|
}
|
|
59397
59419
|
}
|
|
59398
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
59420
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
59399
59421
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
59400
59422
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
59401
59423
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -59541,15 +59563,15 @@ function createTypeChecker(host) {
|
|
|
59541
59563
|
}
|
|
59542
59564
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
59543
59565
|
if (source2.flags & 1048576 /* Union */) {
|
|
59544
|
-
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);
|
|
59545
59567
|
}
|
|
59546
59568
|
if (target2.flags & 1048576 /* Union */) {
|
|
59547
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
59569
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
59548
59570
|
}
|
|
59549
59571
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
59550
59572
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
59551
59573
|
}
|
|
59552
|
-
if (relation === comparableRelation && target2.flags &
|
|
59574
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
59553
59575
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
59554
59576
|
if (constraints !== source2.types) {
|
|
59555
59577
|
source2 = getIntersectionType(constraints);
|
|
@@ -60442,7 +60464,7 @@ function createTypeChecker(host) {
|
|
|
60442
60464
|
}
|
|
60443
60465
|
return 0 /* False */;
|
|
60444
60466
|
}
|
|
60445
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
60467
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
60446
60468
|
if (relation !== identityRelation) {
|
|
60447
60469
|
source2 = getApparentType(source2);
|
|
60448
60470
|
sourceFlags = source2.flags;
|
|
@@ -61112,10 +61134,11 @@ function createTypeChecker(host) {
|
|
|
61112
61134
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
61113
61135
|
}
|
|
61114
61136
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
61137
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
61115
61138
|
return compareSignaturesRelated(
|
|
61116
61139
|
erase ? getErasedSignature(source2) : source2,
|
|
61117
61140
|
erase ? getErasedSignature(target2) : target2,
|
|
61118
|
-
|
|
61141
|
+
checkMode,
|
|
61119
61142
|
reportErrors2,
|
|
61120
61143
|
reportError,
|
|
61121
61144
|
incompatibleReporter,
|
|
@@ -61240,7 +61263,7 @@ function createTypeChecker(host) {
|
|
|
61240
61263
|
if (sourceInfo) {
|
|
61241
61264
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
61242
61265
|
}
|
|
61243
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61266
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
61244
61267
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
61245
61268
|
}
|
|
61246
61269
|
if (reportErrors2) {
|
|
@@ -61785,10 +61808,10 @@ function createTypeChecker(host) {
|
|
|
61785
61808
|
return void 0;
|
|
61786
61809
|
}
|
|
61787
61810
|
function isNeitherUnitTypeNorNever(type) {
|
|
61788
|
-
return !(type.flags & (
|
|
61811
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
61789
61812
|
}
|
|
61790
61813
|
function isUnitType(type) {
|
|
61791
|
-
return !!(type.flags &
|
|
61814
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
61792
61815
|
}
|
|
61793
61816
|
function isUnitLikeType(type) {
|
|
61794
61817
|
const t = getBaseConstraintOrType(type);
|
|
@@ -61801,15 +61824,18 @@ function createTypeChecker(host) {
|
|
|
61801
61824
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
61802
61825
|
}
|
|
61803
61826
|
function getBaseTypeOfLiteralType(type) {
|
|
61804
|
-
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;
|
|
61805
61828
|
}
|
|
61806
61829
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
61807
61830
|
var _a2;
|
|
61808
61831
|
const key = `B${getTypeId(type)}`;
|
|
61809
61832
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
61810
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
|
+
}
|
|
61811
61837
|
function getWidenedLiteralType(type) {
|
|
61812
|
-
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;
|
|
61813
61839
|
}
|
|
61814
61840
|
function getWidenedUniqueESSymbolType(type) {
|
|
61815
61841
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -62342,8 +62368,8 @@ function createTypeChecker(host) {
|
|
|
62342
62368
|
}
|
|
62343
62369
|
return false;
|
|
62344
62370
|
}
|
|
62345
|
-
function isTypeParameterAtTopLevel(type,
|
|
62346
|
-
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)));
|
|
62347
62373
|
}
|
|
62348
62374
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
62349
62375
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -62437,7 +62463,7 @@ function createTypeChecker(host) {
|
|
|
62437
62463
|
yield targetProp;
|
|
62438
62464
|
} else if (matchDiscriminantProperties) {
|
|
62439
62465
|
const targetType = getTypeOfSymbol(targetProp);
|
|
62440
|
-
if (targetType.flags &
|
|
62466
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
62441
62467
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
62442
62468
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
62443
62469
|
yield targetProp;
|
|
@@ -62498,10 +62524,10 @@ function createTypeChecker(host) {
|
|
|
62498
62524
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
62499
62525
|
}
|
|
62500
62526
|
function isMemberOfStringMapping(source, target) {
|
|
62501
|
-
if (target.flags &
|
|
62527
|
+
if (target.flags & 1 /* Any */) {
|
|
62502
62528
|
return true;
|
|
62503
62529
|
}
|
|
62504
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
62530
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
62505
62531
|
return isTypeAssignableTo(source, target);
|
|
62506
62532
|
}
|
|
62507
62533
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -63040,6 +63066,7 @@ function createTypeChecker(host) {
|
|
|
63040
63066
|
if (getObjectFlags(target) & 32 /* Mapped */ && !target.declaration.nameType) {
|
|
63041
63067
|
const constraintType = getConstraintTypeFromMappedType(target);
|
|
63042
63068
|
if (inferToMappedType(source, target, constraintType)) {
|
|
63069
|
+
inferFromMappedProperties(source, target);
|
|
63043
63070
|
return;
|
|
63044
63071
|
}
|
|
63045
63072
|
}
|
|
@@ -63140,6 +63167,19 @@ function createTypeChecker(host) {
|
|
|
63140
63167
|
}
|
|
63141
63168
|
}
|
|
63142
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
|
+
}
|
|
63143
63183
|
function inferFromSignatures(source, target, kind) {
|
|
63144
63184
|
const sourceSignatures = getSignaturesOfType(source, kind);
|
|
63145
63185
|
const targetSignatures = getSignaturesOfType(target, kind);
|
|
@@ -63196,7 +63236,7 @@ function createTypeChecker(host) {
|
|
|
63196
63236
|
}
|
|
63197
63237
|
function hasPrimitiveConstraint(type) {
|
|
63198
63238
|
const constraint = getConstraintOfTypeParameter(type);
|
|
63199
|
-
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 */);
|
|
63200
63240
|
}
|
|
63201
63241
|
function isObjectLiteralType(type) {
|
|
63202
63242
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -63678,7 +63718,7 @@ function createTypeChecker(host) {
|
|
|
63678
63718
|
return 83886079 /* UnknownFacts */;
|
|
63679
63719
|
}
|
|
63680
63720
|
function getIntersectionTypeFacts(type) {
|
|
63681
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
63721
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
63682
63722
|
let oredFacts = 0 /* None */;
|
|
63683
63723
|
let andedFacts = 134217727 /* All */;
|
|
63684
63724
|
for (const t of type.types) {
|
|
@@ -63877,7 +63917,7 @@ function createTypeChecker(host) {
|
|
|
63877
63917
|
}
|
|
63878
63918
|
return true;
|
|
63879
63919
|
}
|
|
63880
|
-
if (source.flags &
|
|
63920
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
63881
63921
|
return true;
|
|
63882
63922
|
}
|
|
63883
63923
|
return containsType(target.types, source);
|
|
@@ -64941,7 +64981,7 @@ function createTypeChecker(host) {
|
|
|
64941
64981
|
}
|
|
64942
64982
|
if (assumeTrue) {
|
|
64943
64983
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
64944
|
-
if (valueType.flags & (
|
|
64984
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
64945
64985
|
return valueType;
|
|
64946
64986
|
}
|
|
64947
64987
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -64991,7 +65031,7 @@ function createTypeChecker(host) {
|
|
|
64991
65031
|
let groundClauseTypes;
|
|
64992
65032
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
64993
65033
|
const t = clauseTypes[i];
|
|
64994
|
-
if (t.flags & (
|
|
65034
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
64995
65035
|
if (groundClauseTypes !== void 0) {
|
|
64996
65036
|
groundClauseTypes.push(t);
|
|
64997
65037
|
}
|
|
@@ -65139,18 +65179,29 @@ function createTypeChecker(host) {
|
|
|
65139
65179
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
65140
65180
|
}
|
|
65141
65181
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
65142
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65143
65182
|
if (!assumeTrue) {
|
|
65144
|
-
|
|
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));
|
|
65145
65195
|
}
|
|
65146
65196
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
65147
65197
|
return candidate;
|
|
65148
65198
|
}
|
|
65199
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
65149
65200
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
65150
65201
|
const narrowedType = mapType(candidate, (c) => {
|
|
65151
65202
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
65152
65203
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
65153
|
-
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);
|
|
65154
65205
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
65155
65206
|
});
|
|
65156
65207
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -65306,15 +65357,25 @@ function createTypeChecker(host) {
|
|
|
65306
65357
|
function isConstVariable(symbol) {
|
|
65307
65358
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
65308
65359
|
}
|
|
65309
|
-
function
|
|
65310
|
-
|
|
65311
|
-
|
|
65312
|
-
|
|
65313
|
-
|
|
65314
|
-
|
|
65315
|
-
|
|
65316
|
-
|
|
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;
|
|
65317
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;
|
|
65318
65379
|
}
|
|
65319
65380
|
function isConstraintPosition(type, node) {
|
|
65320
65381
|
const parent = node.parent;
|
|
@@ -68480,7 +68541,7 @@ function createTypeChecker(host) {
|
|
|
68480
68541
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
68481
68542
|
let errorInfo;
|
|
68482
68543
|
let relatedInfo;
|
|
68483
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
68544
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
68484
68545
|
for (const subtype of containingType.types) {
|
|
68485
68546
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
68486
68547
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -69077,7 +69138,7 @@ function createTypeChecker(host) {
|
|
|
69077
69138
|
} else {
|
|
69078
69139
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
69079
69140
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
69080
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
69141
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
69081
69142
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
69082
69143
|
flags.push(1 /* Required */);
|
|
69083
69144
|
}
|
|
@@ -72327,7 +72388,7 @@ function createTypeChecker(host) {
|
|
|
72327
72388
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
72328
72389
|
return silentNeverType;
|
|
72329
72390
|
}
|
|
72330
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
72391
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
72331
72392
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
72332
72393
|
}
|
|
72333
72394
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -72852,8 +72913,8 @@ function createTypeChecker(host) {
|
|
|
72852
72913
|
case 32 /* LessThanEqualsToken */:
|
|
72853
72914
|
case 33 /* GreaterThanEqualsToken */:
|
|
72854
72915
|
if (checkForDisallowedESSymbolOperand(operator)) {
|
|
72855
|
-
leftType =
|
|
72856
|
-
rightType =
|
|
72916
|
+
leftType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(leftType, left));
|
|
72917
|
+
rightType = getBaseTypeOfLiteralTypeForComparison(checkNonNullType(rightType, right));
|
|
72857
72918
|
reportOperatorErrorUnless((left2, right2) => {
|
|
72858
72919
|
if (isTypeAny(left2) || isTypeAny(right2)) {
|
|
72859
72920
|
return true;
|
|
@@ -72913,7 +72974,7 @@ function createTypeChecker(host) {
|
|
|
72913
72974
|
return leftType;
|
|
72914
72975
|
} else {
|
|
72915
72976
|
checkAssignmentOperator(rightType);
|
|
72916
|
-
return
|
|
72977
|
+
return rightType;
|
|
72917
72978
|
}
|
|
72918
72979
|
case 27 /* CommaToken */:
|
|
72919
72980
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -74846,7 +74907,7 @@ function createTypeChecker(host) {
|
|
|
74846
74907
|
))) {
|
|
74847
74908
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
74848
74909
|
}
|
|
74849
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74910
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74850
74911
|
return void 0;
|
|
74851
74912
|
}
|
|
74852
74913
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74898,7 +74959,7 @@ function createTypeChecker(host) {
|
|
|
74898
74959
|
return awaitedType || errorType;
|
|
74899
74960
|
}
|
|
74900
74961
|
function isThenableType(type) {
|
|
74901
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
74962
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
74902
74963
|
return false;
|
|
74903
74964
|
}
|
|
74904
74965
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -74947,7 +75008,7 @@ function createTypeChecker(host) {
|
|
|
74947
75008
|
return awaitedType;
|
|
74948
75009
|
}
|
|
74949
75010
|
}
|
|
74950
|
-
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.");
|
|
74951
75012
|
return type;
|
|
74952
75013
|
}
|
|
74953
75014
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -80296,7 +80357,7 @@ function createTypeChecker(host) {
|
|
|
80296
80357
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
80297
80358
|
}
|
|
80298
80359
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
80299
|
-
var _a2
|
|
80360
|
+
var _a2;
|
|
80300
80361
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
80301
80362
|
if (!typeName)
|
|
80302
80363
|
return 0 /* Unknown */;
|
|
@@ -80328,7 +80389,7 @@ function createTypeChecker(host) {
|
|
|
80328
80389
|
location
|
|
80329
80390
|
);
|
|
80330
80391
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
80331
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
80392
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
80332
80393
|
const typeSymbol = resolveEntityName(
|
|
80333
80394
|
typeName,
|
|
80334
80395
|
788968 /* Type */,
|
|
@@ -80479,7 +80540,7 @@ function createTypeChecker(host) {
|
|
|
80479
80540
|
return false;
|
|
80480
80541
|
}
|
|
80481
80542
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
80482
|
-
const enumResult = type.flags &
|
|
80543
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
80483
80544
|
type.symbol,
|
|
80484
80545
|
111551 /* Value */,
|
|
80485
80546
|
enclosing,
|
|
@@ -82040,7 +82101,7 @@ function createTypeChecker(host) {
|
|
|
82040
82101
|
}
|
|
82041
82102
|
function isSimpleLiteralEnumReference(expr) {
|
|
82042
82103
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
82043
|
-
return !!(checkExpressionCached(expr).flags &
|
|
82104
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
82044
82105
|
}
|
|
82045
82106
|
}
|
|
82046
82107
|
function checkAmbientInitializer(node) {
|
|
@@ -82442,10 +82503,10 @@ function createTypeChecker(host) {
|
|
|
82442
82503
|
}
|
|
82443
82504
|
function findMostOverlappyType(source, unionTarget) {
|
|
82444
82505
|
let bestMatch;
|
|
82445
|
-
if (!(source.flags & (
|
|
82506
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82446
82507
|
let matchingCount = 0;
|
|
82447
82508
|
for (const target of unionTarget.types) {
|
|
82448
|
-
if (!(target.flags & (
|
|
82509
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
82449
82510
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
82450
82511
|
if (overlap.flags & 4194304 /* Index */) {
|
|
82451
82512
|
return target;
|
|
@@ -82463,7 +82524,7 @@ function createTypeChecker(host) {
|
|
|
82463
82524
|
}
|
|
82464
82525
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
82465
82526
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
82466
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
82527
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
82467
82528
|
if (!(result.flags & 131072 /* Never */)) {
|
|
82468
82529
|
return result;
|
|
82469
82530
|
}
|
|
@@ -87041,7 +87102,7 @@ function transformTypeScript(context) {
|
|
|
87041
87102
|
return node;
|
|
87042
87103
|
}
|
|
87043
87104
|
function tryGetConstEnumValue(node) {
|
|
87044
|
-
if (compilerOptions
|
|
87105
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
87045
87106
|
return void 0;
|
|
87046
87107
|
}
|
|
87047
87108
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -103371,7 +103432,7 @@ function transformECMAScriptModule(context) {
|
|
|
103371
103432
|
if (node.isDeclarationFile) {
|
|
103372
103433
|
return node;
|
|
103373
103434
|
}
|
|
103374
|
-
if (isExternalModule(node) || compilerOptions
|
|
103435
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
103375
103436
|
currentSourceFile = node;
|
|
103376
103437
|
importRequireStatements = void 0;
|
|
103377
103438
|
let result = updateExternalModule(node);
|
|
@@ -103578,7 +103639,7 @@ function transformECMAScriptModule(context) {
|
|
|
103578
103639
|
}
|
|
103579
103640
|
function onEmitNode(hint, node, emitCallback) {
|
|
103580
103641
|
if (isSourceFile(node)) {
|
|
103581
|
-
if ((isExternalModule(node) || compilerOptions
|
|
103642
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
103582
103643
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
103583
103644
|
}
|
|
103584
103645
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -114172,7 +114233,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114172
114233
|
let imports;
|
|
114173
114234
|
let moduleAugmentations;
|
|
114174
114235
|
let ambientModules;
|
|
114175
|
-
if ((options
|
|
114236
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
114176
114237
|
if (options.importHelpers) {
|
|
114177
114238
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
114178
114239
|
}
|
|
@@ -114893,12 +114954,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
114893
114954
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
114894
114955
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
114895
114956
|
}
|
|
114896
|
-
if (options.isolatedModules) {
|
|
114957
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
114897
114958
|
if (options.out) {
|
|
114898
|
-
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");
|
|
114899
114960
|
}
|
|
114900
114961
|
if (options.outFile) {
|
|
114901
|
-
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");
|
|
114902
114963
|
}
|
|
114903
114964
|
}
|
|
114904
114965
|
if (options.inlineSourceMap) {
|
|
@@ -116305,7 +116366,7 @@ var BuilderState;
|
|
|
116305
116366
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
116306
116367
|
}
|
|
116307
116368
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
116308
|
-
if (compilerOptions && (compilerOptions
|
|
116369
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
116309
116370
|
return [sourceFileWithUpdatedShape];
|
|
116310
116371
|
}
|
|
116311
116372
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -116718,7 +116779,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
116718
116779
|
return;
|
|
116719
116780
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
116720
116781
|
return;
|
|
116721
|
-
if (state.compilerOptions
|
|
116782
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
116722
116783
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
116723
116784
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
116724
116785
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|