typescript 5.0.0-dev.20230213 → 5.0.0-dev.20230215
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +155 -96
- package/lib/tsserver.js +174 -106
- package/lib/tsserverlibrary.d.ts +8 -5
- package/lib/tsserverlibrary.js +174 -106
- package/lib/typescript.d.ts +8 -5
- package/lib/typescript.js +174 -106
- package/lib/typingsInstaller.js +10 -5
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -2287,7 +2287,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2287
2287
|
|
|
2288
2288
|
// src/compiler/corePublic.ts
|
|
2289
2289
|
var versionMajorMinor = "5.0";
|
|
2290
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2290
|
+
var version = `${versionMajorMinor}.0-dev.20230215`;
|
|
2291
2291
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2292
2292
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2293
2293
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6671,13 +6671,14 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6671
6671
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
6672
6672
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
6673
6673
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
6674
|
-
TypeFlags2[TypeFlags2["Unit"] =
|
|
6674
|
+
TypeFlags2[TypeFlags2["Unit"] = 109472] = "Unit";
|
|
6675
|
+
TypeFlags2[TypeFlags2["Freshable"] = 2976] = "Freshable";
|
|
6675
6676
|
TypeFlags2[TypeFlags2["StringOrNumberLiteral"] = 384] = "StringOrNumberLiteral";
|
|
6676
6677
|
TypeFlags2[TypeFlags2["StringOrNumberLiteralOrUnique"] = 8576] = "StringOrNumberLiteralOrUnique";
|
|
6677
6678
|
TypeFlags2[TypeFlags2["DefinitelyFalsy"] = 117632] = "DefinitelyFalsy";
|
|
6678
6679
|
TypeFlags2[TypeFlags2["PossiblyFalsy"] = 117724] = "PossiblyFalsy";
|
|
6679
6680
|
TypeFlags2[TypeFlags2["Intrinsic"] = 67359327] = "Intrinsic";
|
|
6680
|
-
TypeFlags2[TypeFlags2["Primitive"] =
|
|
6681
|
+
TypeFlags2[TypeFlags2["Primitive"] = 134348796] = "Primitive";
|
|
6681
6682
|
TypeFlags2[TypeFlags2["StringLike"] = 402653316] = "StringLike";
|
|
6682
6683
|
TypeFlags2[TypeFlags2["NumberLike"] = 296] = "NumberLike";
|
|
6683
6684
|
TypeFlags2[TypeFlags2["BigIntLike"] = 2112] = "BigIntLike";
|
|
@@ -15847,7 +15848,7 @@ function isCommonJSContainingModuleKind(kind) {
|
|
|
15847
15848
|
return kind === 1 /* CommonJS */ || kind === 100 /* Node16 */ || kind === 199 /* NodeNext */;
|
|
15848
15849
|
}
|
|
15849
15850
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15850
|
-
return isExternalModule(node) || compilerOptions
|
|
15851
|
+
return isExternalModule(node) || getIsolatedModules(compilerOptions) || isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator;
|
|
15851
15852
|
}
|
|
15852
15853
|
function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
15853
15854
|
switch (node.scriptKind) {
|
|
@@ -15868,7 +15869,7 @@ function isEffectiveStrictModeSourceFile(node, compilerOptions) {
|
|
|
15868
15869
|
if (startsWithUseStrict(node.statements)) {
|
|
15869
15870
|
return true;
|
|
15870
15871
|
}
|
|
15871
|
-
if (isExternalModule(node) || compilerOptions
|
|
15872
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
15872
15873
|
if (getEmitModuleKind(compilerOptions) >= 5 /* ES2015 */) {
|
|
15873
15874
|
return true;
|
|
15874
15875
|
}
|
|
@@ -20299,7 +20300,7 @@ function getEmitDeclarations(compilerOptions) {
|
|
|
20299
20300
|
return !!(compilerOptions.declaration || compilerOptions.composite);
|
|
20300
20301
|
}
|
|
20301
20302
|
function shouldPreserveConstEnums(compilerOptions) {
|
|
20302
|
-
return !!(compilerOptions.preserveConstEnums || compilerOptions
|
|
20303
|
+
return !!(compilerOptions.preserveConstEnums || getIsolatedModules(compilerOptions));
|
|
20303
20304
|
}
|
|
20304
20305
|
function isIncrementalCompilation(options) {
|
|
20305
20306
|
return !!(options.incremental || options.composite);
|
|
@@ -47095,6 +47096,7 @@ var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
|
|
|
47095
47096
|
SignatureCheckMode3[SignatureCheckMode3["StrictCallback"] = 2] = "StrictCallback";
|
|
47096
47097
|
SignatureCheckMode3[SignatureCheckMode3["IgnoreReturnTypes"] = 4] = "IgnoreReturnTypes";
|
|
47097
47098
|
SignatureCheckMode3[SignatureCheckMode3["StrictArity"] = 8] = "StrictArity";
|
|
47099
|
+
SignatureCheckMode3[SignatureCheckMode3["StrictTopSignature"] = 16] = "StrictTopSignature";
|
|
47098
47100
|
SignatureCheckMode3[SignatureCheckMode3["Callback"] = 3] = "Callback";
|
|
47099
47101
|
return SignatureCheckMode3;
|
|
47100
47102
|
})(SignatureCheckMode || {});
|
|
@@ -47369,15 +47371,14 @@ function createTypeChecker(host) {
|
|
|
47369
47371
|
getTypeOfPropertyOfContextualType,
|
|
47370
47372
|
getFullyQualifiedName,
|
|
47371
47373
|
getResolvedSignature: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */),
|
|
47372
|
-
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => getResolvedSignatureWorker(
|
|
47374
|
+
getResolvedSignatureForStringLiteralCompletions: (call, editingArgument, candidatesOutArray) => runWithInferenceBlockedFromSourceNode(editingArgument, () => getResolvedSignatureWorker(
|
|
47373
47375
|
call,
|
|
47374
47376
|
candidatesOutArray,
|
|
47375
47377
|
/*argumentCount*/
|
|
47376
47378
|
void 0,
|
|
47377
|
-
32 /* IsForStringLiteralArgumentCompletions
|
|
47378
|
-
|
|
47379
|
-
),
|
|
47380
|
-
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */),
|
|
47379
|
+
32 /* IsForStringLiteralArgumentCompletions */
|
|
47380
|
+
)),
|
|
47381
|
+
getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
|
|
47381
47382
|
getExpandedParameters,
|
|
47382
47383
|
hasEffectiveRestParameter,
|
|
47383
47384
|
containsArgumentsReference,
|
|
@@ -47571,32 +47572,41 @@ function createTypeChecker(host) {
|
|
|
47571
47572
|
getMemberOverrideModifierStatus,
|
|
47572
47573
|
isTypeParameterPossiblyReferenced
|
|
47573
47574
|
};
|
|
47574
|
-
function
|
|
47575
|
+
function runWithoutResolvedSignatureCaching(node, fn) {
|
|
47575
47576
|
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
47576
47577
|
const containingCallResolvedSignature = containingCall && getNodeLinks(containingCall).resolvedSignature;
|
|
47578
|
+
if (containingCall) {
|
|
47579
|
+
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
47580
|
+
}
|
|
47581
|
+
const result = fn();
|
|
47582
|
+
if (containingCall) {
|
|
47583
|
+
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47584
|
+
}
|
|
47585
|
+
return result;
|
|
47586
|
+
}
|
|
47587
|
+
function runWithInferenceBlockedFromSourceNode(node, fn) {
|
|
47588
|
+
const containingCall = findAncestor(node, isCallLikeExpression);
|
|
47577
47589
|
if (containingCall) {
|
|
47578
47590
|
let toMarkSkip = node;
|
|
47579
47591
|
do {
|
|
47580
47592
|
getNodeLinks(toMarkSkip).skipDirectInference = true;
|
|
47581
47593
|
toMarkSkip = toMarkSkip.parent;
|
|
47582
47594
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47583
|
-
getNodeLinks(containingCall).resolvedSignature = void 0;
|
|
47584
47595
|
}
|
|
47585
|
-
const result = fn
|
|
47596
|
+
const result = runWithoutResolvedSignatureCaching(node, fn);
|
|
47586
47597
|
if (containingCall) {
|
|
47587
47598
|
let toMarkSkip = node;
|
|
47588
47599
|
do {
|
|
47589
47600
|
getNodeLinks(toMarkSkip).skipDirectInference = void 0;
|
|
47590
47601
|
toMarkSkip = toMarkSkip.parent;
|
|
47591
47602
|
} while (toMarkSkip && toMarkSkip !== containingCall);
|
|
47592
|
-
getNodeLinks(containingCall).resolvedSignature = containingCallResolvedSignature;
|
|
47593
47603
|
}
|
|
47594
47604
|
return result;
|
|
47595
47605
|
}
|
|
47596
|
-
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode
|
|
47606
|
+
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47597
47607
|
const node = getParseTreeNode(nodeIn, isCallLikeExpression);
|
|
47598
47608
|
apparentArgumentCount = argumentCount;
|
|
47599
|
-
const res = !node ? void 0 :
|
|
47609
|
+
const res = !node ? void 0 : getResolvedSignature(node, candidatesOutArray, checkMode);
|
|
47600
47610
|
apparentArgumentCount = void 0;
|
|
47601
47611
|
return res;
|
|
47602
47612
|
}
|
|
@@ -50558,7 +50568,7 @@ function createTypeChecker(host) {
|
|
|
50558
50568
|
return shouldTreatPropertiesOfExternalModuleAsExports(type) ? getPropertyOfType(type, memberName) : void 0;
|
|
50559
50569
|
}
|
|
50560
50570
|
function shouldTreatPropertiesOfExternalModuleAsExports(resolvedExternalModuleType) {
|
|
50561
|
-
return !(resolvedExternalModuleType.flags &
|
|
50571
|
+
return !(resolvedExternalModuleType.flags & 134348796 /* Primitive */ || getObjectFlags(resolvedExternalModuleType) & 1 /* Class */ || // `isArrayOrTupleLikeType` is too expensive to use in this auto-imports hot path
|
|
50562
50572
|
isArrayType(resolvedExternalModuleType) || isTupleType(resolvedExternalModuleType));
|
|
50563
50573
|
}
|
|
50564
50574
|
function getExportsOfSymbol(symbol) {
|
|
@@ -54757,8 +54767,8 @@ function createTypeChecker(host) {
|
|
|
54757
54767
|
const t = types[i];
|
|
54758
54768
|
flags |= t.flags;
|
|
54759
54769
|
if (!(t.flags & 98304 /* Nullable */)) {
|
|
54760
|
-
if (t.flags & (512 /* BooleanLiteral */ |
|
|
54761
|
-
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType :
|
|
54770
|
+
if (t.flags & (512 /* BooleanLiteral */ | 1056 /* EnumLike */)) {
|
|
54771
|
+
const baseType = t.flags & 512 /* BooleanLiteral */ ? booleanType : getBaseTypeOfEnumLikeType(t);
|
|
54762
54772
|
if (baseType.flags & 1048576 /* Union */) {
|
|
54763
54773
|
const count = baseType.types.length;
|
|
54764
54774
|
if (i + count <= types.length && getRegularTypeOfLiteralType(types[i + count - 1]) === getRegularTypeOfLiteralType(baseType.types[count - 1])) {
|
|
@@ -55042,6 +55052,8 @@ function createTypeChecker(host) {
|
|
|
55042
55052
|
return !!target.baseTypesResolved;
|
|
55043
55053
|
case 8 /* WriteType */:
|
|
55044
55054
|
return !!getSymbolLinks(target).writeType;
|
|
55055
|
+
case 9 /* ParameterInitializerContainsUndefined */:
|
|
55056
|
+
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
55045
55057
|
}
|
|
55046
55058
|
return Debug.assertNever(propertyName);
|
|
55047
55059
|
}
|
|
@@ -56633,8 +56645,8 @@ function createTypeChecker(host) {
|
|
|
56633
56645
|
}
|
|
56634
56646
|
return links.declaredType;
|
|
56635
56647
|
}
|
|
56636
|
-
function
|
|
56637
|
-
return type.flags &
|
|
56648
|
+
function getBaseTypeOfEnumLikeType(type) {
|
|
56649
|
+
return type.flags & 1056 /* EnumLike */ && type.symbol.flags & 8 /* EnumMember */ ? getDeclaredTypeOfSymbol(getParentOfSymbol(type.symbol)) : type;
|
|
56638
56650
|
}
|
|
56639
56651
|
function getDeclaredTypeOfEnum(symbol) {
|
|
56640
56652
|
const links = getSymbolLinks(symbol);
|
|
@@ -56647,7 +56659,7 @@ function createTypeChecker(host) {
|
|
|
56647
56659
|
if (hasBindableName(member)) {
|
|
56648
56660
|
const memberSymbol = getSymbolOfDeclaration(member);
|
|
56649
56661
|
const value = getEnumMemberValue(member);
|
|
56650
|
-
const memberType = value !== void 0 ?
|
|
56662
|
+
const memberType = getFreshTypeOfLiteralType(value !== void 0 ? getEnumLiteralType(value, getSymbolId(symbol), memberSymbol) : createComputedEnumType(memberSymbol));
|
|
56651
56663
|
getSymbolLinks(memberSymbol).declaredType = memberType;
|
|
56652
56664
|
memberTypeList.push(getRegularTypeOfLiteralType(memberType));
|
|
56653
56665
|
}
|
|
@@ -56661,7 +56673,7 @@ function createTypeChecker(host) {
|
|
|
56661
56673
|
symbol,
|
|
56662
56674
|
/*aliasTypeArguments*/
|
|
56663
56675
|
void 0
|
|
56664
|
-
) :
|
|
56676
|
+
) : createComputedEnumType(symbol);
|
|
56665
56677
|
if (enumType.flags & 1048576 /* Union */) {
|
|
56666
56678
|
enumType.flags |= 1024 /* EnumLiteral */;
|
|
56667
56679
|
enumType.symbol = symbol;
|
|
@@ -56670,6 +56682,15 @@ function createTypeChecker(host) {
|
|
|
56670
56682
|
}
|
|
56671
56683
|
return links.declaredType;
|
|
56672
56684
|
}
|
|
56685
|
+
function createComputedEnumType(symbol) {
|
|
56686
|
+
const regularType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
56687
|
+
const freshType = createTypeWithSymbol(32 /* Enum */, symbol);
|
|
56688
|
+
regularType.regularType = regularType;
|
|
56689
|
+
regularType.freshType = freshType;
|
|
56690
|
+
freshType.regularType = regularType;
|
|
56691
|
+
freshType.freshType = freshType;
|
|
56692
|
+
return regularType;
|
|
56693
|
+
}
|
|
56673
56694
|
function getDeclaredTypeOfEnumMember(symbol) {
|
|
56674
56695
|
const links = getSymbolLinks(symbol);
|
|
56675
56696
|
if (!links.declaredType) {
|
|
@@ -60358,7 +60379,7 @@ function createTypeChecker(host) {
|
|
|
60358
60379
|
orderedRemoveItemAt(typeSet, 1);
|
|
60359
60380
|
}
|
|
60360
60381
|
}
|
|
60361
|
-
if (includes & (2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
60382
|
+
if (includes & (32 /* Enum */ | 2944 /* Literal */ | 8192 /* UniqueESSymbol */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) || includes & 16384 /* Void */ && includes & 32768 /* Undefined */) {
|
|
60362
60383
|
removeRedundantLiteralTypes(typeSet, includes, !!(unionReduction & 2 /* Subtype */));
|
|
60363
60384
|
}
|
|
60364
60385
|
if (includes & 128 /* StringLiteral */ && includes & 134217728 /* TemplateLiteral */) {
|
|
@@ -60489,7 +60510,7 @@ function createTypeChecker(host) {
|
|
|
60489
60510
|
type = undefinedType;
|
|
60490
60511
|
}
|
|
60491
60512
|
if (!typeSet.has(type.id.toString())) {
|
|
60492
|
-
if (type.flags &
|
|
60513
|
+
if (type.flags & 109472 /* Unit */ && includes & 109472 /* Unit */) {
|
|
60493
60514
|
includes |= 67108864 /* NonPrimitive */;
|
|
60494
60515
|
}
|
|
60495
60516
|
typeSet.set(type.id.toString(), type);
|
|
@@ -60765,7 +60786,7 @@ function createTypeChecker(host) {
|
|
|
60765
60786
|
const typeVariable = getTypeParameterFromMappedType(mappedType);
|
|
60766
60787
|
return isDistributive(getNameTypeFromMappedType(mappedType) || typeVariable);
|
|
60767
60788
|
function isDistributive(type) {
|
|
60768
|
-
return type.flags & (3 /* AnyOrUnknown */ |
|
|
60789
|
+
return type.flags & (3 /* AnyOrUnknown */ | 134348796 /* Primitive */ | 131072 /* Never */ | 262144 /* TypeParameter */ | 524288 /* Object */ | 67108864 /* NonPrimitive */) ? true : type.flags & 16777216 /* Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* UnionOrIntersection */ | 134217728 /* TemplateLiteral */) ? every(type.types, isDistributive) : type.flags & 8388608 /* IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : type.flags & 33554432 /* Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* StringMapping */ ? isDistributive(type.type) : false;
|
|
60769
60790
|
}
|
|
60770
60791
|
}
|
|
60771
60792
|
function getLiteralTypeFromPropertyName(name) {
|
|
@@ -61862,7 +61883,7 @@ function createTypeChecker(host) {
|
|
|
61862
61883
|
return type;
|
|
61863
61884
|
}
|
|
61864
61885
|
function getFreshTypeOfLiteralType(type) {
|
|
61865
|
-
if (type.flags &
|
|
61886
|
+
if (type.flags & 2976 /* Freshable */) {
|
|
61866
61887
|
if (!type.freshType) {
|
|
61867
61888
|
const freshType = createLiteralType(type.flags, type.value, type.symbol, type);
|
|
61868
61889
|
freshType.freshType = freshType;
|
|
@@ -61873,10 +61894,10 @@ function createTypeChecker(host) {
|
|
|
61873
61894
|
return type;
|
|
61874
61895
|
}
|
|
61875
61896
|
function getRegularTypeOfLiteralType(type) {
|
|
61876
|
-
return type.flags &
|
|
61897
|
+
return type.flags & 2976 /* Freshable */ ? type.regularType : type.flags & 1048576 /* Union */ ? type.regularType || (type.regularType = mapType(type, getRegularTypeOfLiteralType)) : type;
|
|
61877
61898
|
}
|
|
61878
61899
|
function isFreshLiteralType(type) {
|
|
61879
|
-
return !!(type.flags &
|
|
61900
|
+
return !!(type.flags & 2976 /* Freshable */) && type.freshType === type;
|
|
61880
61901
|
}
|
|
61881
61902
|
function getStringLiteralType(value) {
|
|
61882
61903
|
let type;
|
|
@@ -62555,13 +62576,13 @@ function createTypeChecker(host) {
|
|
|
62555
62576
|
return type;
|
|
62556
62577
|
}
|
|
62557
62578
|
function getUniqueLiteralFilledInstantiation(type) {
|
|
62558
|
-
return type.flags & (
|
|
62579
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
62559
62580
|
}
|
|
62560
62581
|
function getPermissiveInstantiation(type) {
|
|
62561
|
-
return type.flags & (
|
|
62582
|
+
return type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type : type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
62562
62583
|
}
|
|
62563
62584
|
function getRestrictiveInstantiation(type) {
|
|
62564
|
-
if (type.flags & (
|
|
62585
|
+
if (type.flags & (134348796 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */)) {
|
|
62565
62586
|
return type;
|
|
62566
62587
|
}
|
|
62567
62588
|
if (type.restrictiveInstantiation) {
|
|
@@ -63141,7 +63162,7 @@ function createTypeChecker(host) {
|
|
|
63141
63162
|
}
|
|
63142
63163
|
}
|
|
63143
63164
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
63144
|
-
if (target.flags & (
|
|
63165
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
63145
63166
|
return false;
|
|
63146
63167
|
if (isTupleLikeType(source)) {
|
|
63147
63168
|
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
@@ -63190,7 +63211,7 @@ function createTypeChecker(host) {
|
|
|
63190
63211
|
}
|
|
63191
63212
|
}
|
|
63192
63213
|
function elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
63193
|
-
if (target.flags & (
|
|
63214
|
+
if (target.flags & (134348796 /* Primitive */ | 131072 /* Never */))
|
|
63194
63215
|
return false;
|
|
63195
63216
|
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation, containingMessageChain, errorOutputContainer);
|
|
63196
63217
|
}
|
|
@@ -63213,16 +63234,24 @@ function createTypeChecker(host) {
|
|
|
63213
63234
|
void 0
|
|
63214
63235
|
) !== 0 /* False */;
|
|
63215
63236
|
}
|
|
63216
|
-
function
|
|
63217
|
-
|
|
63237
|
+
function isTopSignature(s) {
|
|
63238
|
+
if (!s.typeParameters && (!s.thisParameter || isTypeAny(getTypeOfParameter(s.thisParameter))) && s.parameters.length === 1 && signatureHasRestParameter(s)) {
|
|
63239
|
+
const paramType = getTypeOfParameter(s.parameters[0]);
|
|
63240
|
+
const restType = isArrayType(paramType) ? getTypeArguments(paramType)[0] : paramType;
|
|
63241
|
+
return !!(restType.flags & (1 /* Any */ | 131072 /* Never */) && getReturnTypeOfSignature(s).flags & 3 /* AnyOrUnknown */);
|
|
63242
|
+
}
|
|
63243
|
+
return false;
|
|
63218
63244
|
}
|
|
63219
63245
|
function compareSignaturesRelated(source, target, checkMode, reportErrors2, errorReporter, incompatibleErrorReporter, compareTypes, reportUnreliableMarkers) {
|
|
63220
63246
|
if (source === target) {
|
|
63221
63247
|
return -1 /* True */;
|
|
63222
63248
|
}
|
|
63223
|
-
if (
|
|
63249
|
+
if (!(checkMode & 16 /* StrictTopSignature */ && isTopSignature(source)) && isTopSignature(target)) {
|
|
63224
63250
|
return -1 /* True */;
|
|
63225
63251
|
}
|
|
63252
|
+
if (checkMode & 16 /* StrictTopSignature */ && isTopSignature(source) && !isTopSignature(target)) {
|
|
63253
|
+
return 0 /* False */;
|
|
63254
|
+
}
|
|
63226
63255
|
const targetCount = getParameterCount(target);
|
|
63227
63256
|
const sourceHasMoreParameters = !hasEffectiveRestParameter(target) && (checkMode & 8 /* StrictArity */ ? hasEffectiveRestParameter(source) || getParameterCount(source) > targetCount : getMinArgumentCount(source) > targetCount);
|
|
63228
63257
|
if (sourceHasMoreParameters) {
|
|
@@ -63440,7 +63469,9 @@ function createTypeChecker(host) {
|
|
|
63440
63469
|
function isSimpleTypeRelatedTo(source, target, relation, errorReporter) {
|
|
63441
63470
|
const s = source.flags;
|
|
63442
63471
|
const t = target.flags;
|
|
63443
|
-
if (t &
|
|
63472
|
+
if (t & 1 /* Any */ || s & 131072 /* Never */ || source === wildcardType)
|
|
63473
|
+
return true;
|
|
63474
|
+
if (t & 2 /* Unknown */ && !(relation === strictSubtypeRelation && s & 1 /* Any */))
|
|
63444
63475
|
return true;
|
|
63445
63476
|
if (t & 131072 /* Never */)
|
|
63446
63477
|
return false;
|
|
@@ -63837,7 +63868,7 @@ function createTypeChecker(host) {
|
|
|
63837
63868
|
return isRelatedTo(source2, target2, 3 /* Both */, reportErrors2);
|
|
63838
63869
|
}
|
|
63839
63870
|
function isRelatedTo(originalSource, originalTarget, recursionFlags = 3 /* Both */, reportErrors2 = false, headMessage2, intersectionState = 0 /* None */) {
|
|
63840
|
-
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags &
|
|
63871
|
+
if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 134348796 /* Primitive */) {
|
|
63841
63872
|
if (relation === comparableRelation && !(originalTarget.flags & 131072 /* Never */) && isSimpleTypeRelatedTo(originalTarget, originalSource, relation) || isSimpleTypeRelatedTo(originalSource, originalTarget, relation, reportErrors2 ? reportError : void 0)) {
|
|
63842
63873
|
return -1 /* True */;
|
|
63843
63874
|
}
|
|
@@ -63901,7 +63932,7 @@ function createTypeChecker(host) {
|
|
|
63901
63932
|
return 0 /* False */;
|
|
63902
63933
|
}
|
|
63903
63934
|
}
|
|
63904
|
-
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (
|
|
63935
|
+
const isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source2)) && !(intersectionState & 2 /* Target */) && source2.flags & (134348796 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source2 !== globalObjectType && target2.flags & (524288 /* Object */ | 2097152 /* Intersection */) && isWeakType(target2) && (getPropertiesOfType(source2).length > 0 || typeHasCallOrConstructSignatures2(source2));
|
|
63905
63936
|
const isComparingJsxAttributes = !!(getObjectFlags(source2) & 2048 /* JsxAttributes */);
|
|
63906
63937
|
if (isPerformingCommonPropertyChecks && !hasCommonProperties(source2, target2, isComparingJsxAttributes)) {
|
|
63907
63938
|
if (reportErrors2) {
|
|
@@ -63963,7 +63994,7 @@ function createTypeChecker(host) {
|
|
|
63963
63994
|
maybeSuppress = !!errorInfo;
|
|
63964
63995
|
}
|
|
63965
63996
|
}
|
|
63966
|
-
if (source2.flags & 524288 /* Object */ && target2.flags &
|
|
63997
|
+
if (source2.flags & 524288 /* Object */ && target2.flags & 134348796 /* Primitive */) {
|
|
63967
63998
|
tryElaborateErrorsForPrimitivesAndObjects(source2, target2);
|
|
63968
63999
|
} else if (source2.symbol && source2.flags & 524288 /* Object */ && globalObjectType === source2) {
|
|
63969
64000
|
reportError(Diagnostics.The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead);
|
|
@@ -64109,15 +64140,15 @@ function createTypeChecker(host) {
|
|
|
64109
64140
|
}
|
|
64110
64141
|
function unionOrIntersectionRelatedTo(source2, target2, reportErrors2, intersectionState) {
|
|
64111
64142
|
if (source2.flags & 1048576 /* Union */) {
|
|
64112
|
-
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags &
|
|
64143
|
+
return relation === comparableRelation ? someTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState) : eachTypeRelatedToType(source2, target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */), intersectionState);
|
|
64113
64144
|
}
|
|
64114
64145
|
if (target2.flags & 1048576 /* Union */) {
|
|
64115
|
-
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags &
|
|
64146
|
+
return typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source2), target2, reportErrors2 && !(source2.flags & 134348796 /* Primitive */) && !(target2.flags & 134348796 /* Primitive */));
|
|
64116
64147
|
}
|
|
64117
64148
|
if (target2.flags & 2097152 /* Intersection */) {
|
|
64118
64149
|
return typeRelatedToEachType(source2, target2, reportErrors2, 2 /* Target */);
|
|
64119
64150
|
}
|
|
64120
|
-
if (relation === comparableRelation && target2.flags &
|
|
64151
|
+
if (relation === comparableRelation && target2.flags & 134348796 /* Primitive */) {
|
|
64121
64152
|
const constraints = sameMap(source2.types, (t) => t.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t);
|
|
64122
64153
|
if (constraints !== source2.types) {
|
|
64123
64154
|
source2 = getIntersectionType(constraints);
|
|
@@ -65010,7 +65041,7 @@ function createTypeChecker(host) {
|
|
|
65010
65041
|
}
|
|
65011
65042
|
return 0 /* False */;
|
|
65012
65043
|
}
|
|
65013
|
-
const sourceIsPrimitive = !!(sourceFlags &
|
|
65044
|
+
const sourceIsPrimitive = !!(sourceFlags & 134348796 /* Primitive */);
|
|
65014
65045
|
if (relation !== identityRelation) {
|
|
65015
65046
|
source2 = getApparentType(source2);
|
|
65016
65047
|
sourceFlags = source2.flags;
|
|
@@ -65680,10 +65711,11 @@ function createTypeChecker(host) {
|
|
|
65680
65711
|
return (source2, target2) => reportIncompatibleError(Diagnostics.Construct_signature_return_types_0_and_1_are_incompatible, typeToString(source2), typeToString(target2));
|
|
65681
65712
|
}
|
|
65682
65713
|
function signatureRelatedTo(source2, target2, erase, reportErrors2, intersectionState, incompatibleReporter) {
|
|
65714
|
+
const checkMode = relation === subtypeRelation ? 16 /* StrictTopSignature */ : relation === strictSubtypeRelation ? 16 /* StrictTopSignature */ | 8 /* StrictArity */ : 0 /* None */;
|
|
65683
65715
|
return compareSignaturesRelated(
|
|
65684
65716
|
erase ? getErasedSignature(source2) : source2,
|
|
65685
65717
|
erase ? getErasedSignature(target2) : target2,
|
|
65686
|
-
|
|
65718
|
+
checkMode,
|
|
65687
65719
|
reportErrors2,
|
|
65688
65720
|
reportError,
|
|
65689
65721
|
incompatibleReporter,
|
|
@@ -65808,7 +65840,7 @@ function createTypeChecker(host) {
|
|
|
65808
65840
|
if (sourceInfo) {
|
|
65809
65841
|
return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors2, intersectionState);
|
|
65810
65842
|
}
|
|
65811
|
-
if (!(intersectionState & 1 /* Source */) && isObjectTypeWithInferableIndex(source2)) {
|
|
65843
|
+
if (!(intersectionState & 1 /* Source */) && (relation !== strictSubtypeRelation || getObjectFlags(source2) & 8192 /* FreshLiteral */) && isObjectTypeWithInferableIndex(source2)) {
|
|
65812
65844
|
return membersRelatedToIndexInfo(source2, targetInfo, reportErrors2, intersectionState);
|
|
65813
65845
|
}
|
|
65814
65846
|
if (reportErrors2) {
|
|
@@ -66353,10 +66385,10 @@ function createTypeChecker(host) {
|
|
|
66353
66385
|
return void 0;
|
|
66354
66386
|
}
|
|
66355
66387
|
function isNeitherUnitTypeNorNever(type) {
|
|
66356
|
-
return !(type.flags & (
|
|
66388
|
+
return !(type.flags & (109472 /* Unit */ | 131072 /* Never */));
|
|
66357
66389
|
}
|
|
66358
66390
|
function isUnitType(type) {
|
|
66359
|
-
return !!(type.flags &
|
|
66391
|
+
return !!(type.flags & 109472 /* Unit */);
|
|
66360
66392
|
}
|
|
66361
66393
|
function isUnitLikeType(type) {
|
|
66362
66394
|
const t = getBaseConstraintOrType(type);
|
|
@@ -66369,7 +66401,7 @@ function createTypeChecker(host) {
|
|
|
66369
66401
|
return type.flags & 16 /* Boolean */ ? true : type.flags & 1048576 /* Union */ ? type.flags & 1024 /* EnumLiteral */ ? true : every(type.types, isUnitType) : isUnitType(type);
|
|
66370
66402
|
}
|
|
66371
66403
|
function getBaseTypeOfLiteralType(type) {
|
|
66372
|
-
return type.flags &
|
|
66404
|
+
return type.flags & 1056 /* EnumLike */ ? getBaseTypeOfEnumLikeType(type) : type.flags & (128 /* StringLiteral */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */) ? stringType : type.flags & 256 /* NumberLiteral */ ? numberType : type.flags & 2048 /* BigIntLiteral */ ? bigintType : type.flags & 512 /* BooleanLiteral */ ? booleanType : type.flags & 1048576 /* Union */ ? getBaseTypeOfLiteralTypeUnion(type) : type;
|
|
66373
66405
|
}
|
|
66374
66406
|
function getBaseTypeOfLiteralTypeUnion(type) {
|
|
66375
66407
|
var _a2;
|
|
@@ -66377,7 +66409,7 @@ function createTypeChecker(host) {
|
|
|
66377
66409
|
return (_a2 = getCachedType(key)) != null ? _a2 : setCachedType(key, mapType(type, getBaseTypeOfLiteralType));
|
|
66378
66410
|
}
|
|
66379
66411
|
function getWidenedLiteralType(type) {
|
|
66380
|
-
return type.flags &
|
|
66412
|
+
return type.flags & 1056 /* EnumLike */ && isFreshLiteralType(type) ? getBaseTypeOfEnumLikeType(type) : type.flags & 128 /* StringLiteral */ && isFreshLiteralType(type) ? stringType : type.flags & 256 /* NumberLiteral */ && isFreshLiteralType(type) ? numberType : type.flags & 2048 /* BigIntLiteral */ && isFreshLiteralType(type) ? bigintType : type.flags & 512 /* BooleanLiteral */ && isFreshLiteralType(type) ? booleanType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedLiteralType) : type;
|
|
66381
66413
|
}
|
|
66382
66414
|
function getWidenedUniqueESSymbolType(type) {
|
|
66383
66415
|
return type.flags & 8192 /* UniqueESSymbol */ ? esSymbolType : type.flags & 1048576 /* Union */ ? mapType(type, getWidenedUniqueESSymbolType) : type;
|
|
@@ -66910,8 +66942,8 @@ function createTypeChecker(host) {
|
|
|
66910
66942
|
}
|
|
66911
66943
|
return false;
|
|
66912
66944
|
}
|
|
66913
|
-
function isTypeParameterAtTopLevel(type,
|
|
66914
|
-
return !!(type ===
|
|
66945
|
+
function isTypeParameterAtTopLevel(type, tp, depth = 0) {
|
|
66946
|
+
return !!(type === tp || type.flags & 3145728 /* UnionOrIntersection */ && some(type.types, (t) => isTypeParameterAtTopLevel(t, tp, depth)) || depth < 3 && type.flags & 16777216 /* Conditional */ && (isTypeParameterAtTopLevel(getTrueTypeFromConditionalType(type), tp, depth + 1) || isTypeParameterAtTopLevel(getFalseTypeFromConditionalType(type), tp, depth + 1)));
|
|
66915
66947
|
}
|
|
66916
66948
|
function isTypeParameterAtTopLevelInReturnType(signature, typeParameter) {
|
|
66917
66949
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
@@ -67005,7 +67037,7 @@ function createTypeChecker(host) {
|
|
|
67005
67037
|
yield targetProp;
|
|
67006
67038
|
} else if (matchDiscriminantProperties) {
|
|
67007
67039
|
const targetType = getTypeOfSymbol(targetProp);
|
|
67008
|
-
if (targetType.flags &
|
|
67040
|
+
if (targetType.flags & 109472 /* Unit */) {
|
|
67009
67041
|
const sourceType = getTypeOfSymbol(sourceProp);
|
|
67010
67042
|
if (!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) {
|
|
67011
67043
|
yield targetProp;
|
|
@@ -67066,10 +67098,10 @@ function createTypeChecker(host) {
|
|
|
67066
67098
|
return getBigIntLiteralType(parseValidBigInt(text));
|
|
67067
67099
|
}
|
|
67068
67100
|
function isMemberOfStringMapping(source, target) {
|
|
67069
|
-
if (target.flags &
|
|
67101
|
+
if (target.flags & 1 /* Any */) {
|
|
67070
67102
|
return true;
|
|
67071
67103
|
}
|
|
67072
|
-
if (target.flags & 134217728 /* TemplateLiteral */) {
|
|
67104
|
+
if (target.flags & (4 /* String */ | 134217728 /* TemplateLiteral */)) {
|
|
67073
67105
|
return isTypeAssignableTo(source, target);
|
|
67074
67106
|
}
|
|
67075
67107
|
if (target.flags & 268435456 /* StringMapping */) {
|
|
@@ -67764,7 +67796,7 @@ function createTypeChecker(host) {
|
|
|
67764
67796
|
}
|
|
67765
67797
|
function hasPrimitiveConstraint(type) {
|
|
67766
67798
|
const constraint = getConstraintOfTypeParameter(type);
|
|
67767
|
-
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint,
|
|
67799
|
+
return !!constraint && maybeTypeOfKind(constraint.flags & 16777216 /* Conditional */ ? getDefaultConstraintOfConditionalType(constraint) : constraint, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
67768
67800
|
}
|
|
67769
67801
|
function isObjectLiteralType2(type) {
|
|
67770
67802
|
return !!(getObjectFlags(type) & 128 /* ObjectLiteral */);
|
|
@@ -68246,7 +68278,7 @@ function createTypeChecker(host) {
|
|
|
68246
68278
|
return 83886079 /* UnknownFacts */;
|
|
68247
68279
|
}
|
|
68248
68280
|
function getIntersectionTypeFacts(type) {
|
|
68249
|
-
const ignoreObjects = maybeTypeOfKind(type,
|
|
68281
|
+
const ignoreObjects = maybeTypeOfKind(type, 134348796 /* Primitive */);
|
|
68250
68282
|
let oredFacts = 0 /* None */;
|
|
68251
68283
|
let andedFacts = 134217727 /* All */;
|
|
68252
68284
|
for (const t of type.types) {
|
|
@@ -68445,7 +68477,7 @@ function createTypeChecker(host) {
|
|
|
68445
68477
|
}
|
|
68446
68478
|
return true;
|
|
68447
68479
|
}
|
|
68448
|
-
if (source.flags &
|
|
68480
|
+
if (source.flags & 1056 /* EnumLike */ && getBaseTypeOfEnumLikeType(source) === target) {
|
|
68449
68481
|
return true;
|
|
68450
68482
|
}
|
|
68451
68483
|
return containsType(target.types, source);
|
|
@@ -69509,7 +69541,7 @@ function createTypeChecker(host) {
|
|
|
69509
69541
|
}
|
|
69510
69542
|
if (assumeTrue) {
|
|
69511
69543
|
if (!doubleEquals && (type.flags & 2 /* Unknown */ || someType(type, isEmptyAnonymousObjectType))) {
|
|
69512
|
-
if (valueType.flags & (
|
|
69544
|
+
if (valueType.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) {
|
|
69513
69545
|
return valueType;
|
|
69514
69546
|
}
|
|
69515
69547
|
if (valueType.flags & 524288 /* Object */) {
|
|
@@ -69559,7 +69591,7 @@ function createTypeChecker(host) {
|
|
|
69559
69591
|
let groundClauseTypes;
|
|
69560
69592
|
for (let i = 0; i < clauseTypes.length; i += 1) {
|
|
69561
69593
|
const t = clauseTypes[i];
|
|
69562
|
-
if (t.flags & (
|
|
69594
|
+
if (t.flags & (134348796 /* Primitive */ | 67108864 /* NonPrimitive */)) {
|
|
69563
69595
|
if (groundClauseTypes !== void 0) {
|
|
69564
69596
|
groundClauseTypes.push(t);
|
|
69565
69597
|
}
|
|
@@ -69707,18 +69739,29 @@ function createTypeChecker(host) {
|
|
|
69707
69739
|
return (_a3 = getCachedType(key2)) != null ? _a3 : setCachedType(key2, getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived));
|
|
69708
69740
|
}
|
|
69709
69741
|
function getNarrowedTypeWorker(type, candidate, assumeTrue, checkDerived) {
|
|
69710
|
-
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
69711
69742
|
if (!assumeTrue) {
|
|
69712
|
-
|
|
69743
|
+
if (checkDerived) {
|
|
69744
|
+
return filterType(type, (t) => !isTypeDerivedFrom(t, candidate));
|
|
69745
|
+
}
|
|
69746
|
+
const trueType2 = getNarrowedType(
|
|
69747
|
+
type,
|
|
69748
|
+
candidate,
|
|
69749
|
+
/*assumeTrue*/
|
|
69750
|
+
true,
|
|
69751
|
+
/*checkDerived*/
|
|
69752
|
+
false
|
|
69753
|
+
);
|
|
69754
|
+
return filterType(type, (t) => !isTypeSubsetOf(t, trueType2));
|
|
69713
69755
|
}
|
|
69714
69756
|
if (type.flags & 3 /* AnyOrUnknown */) {
|
|
69715
69757
|
return candidate;
|
|
69716
69758
|
}
|
|
69759
|
+
const isRelated = checkDerived ? isTypeDerivedFrom : isTypeSubtypeOf;
|
|
69717
69760
|
const keyPropertyName = type.flags & 1048576 /* Union */ ? getKeyPropertyName(type) : void 0;
|
|
69718
69761
|
const narrowedType = mapType(candidate, (c) => {
|
|
69719
69762
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
69720
69763
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
69721
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
69764
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeSubtypeOf(c, t) && !isTypeIdenticalTo(c, t) ? c : isTypeSubtypeOf(t, c) ? t : neverType);
|
|
69722
69765
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
69723
69766
|
});
|
|
69724
69767
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -69874,15 +69917,25 @@ function createTypeChecker(host) {
|
|
|
69874
69917
|
function isConstVariable(symbol) {
|
|
69875
69918
|
return symbol.flags & 3 /* Variable */ && (getDeclarationNodeFlagsFromSymbol(symbol) & 2 /* Const */) !== 0;
|
|
69876
69919
|
}
|
|
69877
|
-
function
|
|
69878
|
-
|
|
69879
|
-
|
|
69880
|
-
|
|
69881
|
-
|
|
69882
|
-
|
|
69883
|
-
|
|
69884
|
-
|
|
69920
|
+
function parameterInitializerContainsUndefined(declaration) {
|
|
69921
|
+
const links = getNodeLinks(declaration);
|
|
69922
|
+
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
69923
|
+
if (!pushTypeResolution(declaration, 9 /* ParameterInitializerContainsUndefined */)) {
|
|
69924
|
+
reportCircularityError(declaration.symbol);
|
|
69925
|
+
return true;
|
|
69926
|
+
}
|
|
69927
|
+
const containsUndefined = !!(getTypeFacts(checkDeclarationInitializer(declaration, 0 /* Normal */)) & 16777216 /* IsUndefined */);
|
|
69928
|
+
if (!popTypeResolution()) {
|
|
69929
|
+
reportCircularityError(declaration.symbol);
|
|
69930
|
+
return true;
|
|
69931
|
+
}
|
|
69932
|
+
links.parameterInitializerContainsUndefined = containsUndefined;
|
|
69885
69933
|
}
|
|
69934
|
+
return links.parameterInitializerContainsUndefined;
|
|
69935
|
+
}
|
|
69936
|
+
function removeOptionalityFromDeclaredType(declaredType, declaration) {
|
|
69937
|
+
const removeUndefined = strictNullChecks && declaration.kind === 166 /* Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* IsUndefined */ && !parameterInitializerContainsUndefined(declaration);
|
|
69938
|
+
return removeUndefined ? getTypeWithFacts(declaredType, 524288 /* NEUndefined */) : declaredType;
|
|
69886
69939
|
}
|
|
69887
69940
|
function isConstraintPosition(type, node) {
|
|
69888
69941
|
const parent2 = node.parent;
|
|
@@ -73048,7 +73101,7 @@ function createTypeChecker(host) {
|
|
|
73048
73101
|
function reportNonexistentProperty(propNode, containingType, isUncheckedJS) {
|
|
73049
73102
|
let errorInfo;
|
|
73050
73103
|
let relatedInfo;
|
|
73051
|
-
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags &
|
|
73104
|
+
if (!isPrivateIdentifier(propNode) && containingType.flags & 1048576 /* Union */ && !(containingType.flags & 134348796 /* Primitive */)) {
|
|
73052
73105
|
for (const subtype of containingType.types) {
|
|
73053
73106
|
if (!getPropertyOfType(subtype, propNode.escapedText) && !getApplicableIndexInfoForName(subtype, propNode.escapedText)) {
|
|
73054
73107
|
errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Property_0_does_not_exist_on_type_1, declarationNameToString(propNode), typeToString(subtype));
|
|
@@ -73645,7 +73698,7 @@ function createTypeChecker(host) {
|
|
|
73645
73698
|
} else {
|
|
73646
73699
|
const contextualType = getIndexedAccessType(restType, getNumberLiteralType(i - index), 256 /* Contextual */);
|
|
73647
73700
|
const argType = checkExpressionWithContextualType(arg, contextualType, context, checkMode);
|
|
73648
|
-
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType,
|
|
73701
|
+
const hasPrimitiveContextualType = inConstContext || maybeTypeOfKind(contextualType, 134348796 /* Primitive */ | 4194304 /* Index */ | 134217728 /* TemplateLiteral */ | 268435456 /* StringMapping */);
|
|
73649
73702
|
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
|
|
73650
73703
|
flags.push(1 /* Required */);
|
|
73651
73704
|
}
|
|
@@ -76895,7 +76948,7 @@ function createTypeChecker(host) {
|
|
|
76895
76948
|
if (leftType === silentNeverType || rightType === silentNeverType) {
|
|
76896
76949
|
return silentNeverType;
|
|
76897
76950
|
}
|
|
76898
|
-
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType,
|
|
76951
|
+
if (!isTypeAny(leftType) && allTypesAssignableToKind(leftType, 134348796 /* Primitive */)) {
|
|
76899
76952
|
error(left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter);
|
|
76900
76953
|
}
|
|
76901
76954
|
if (!(isTypeAny(rightType) || typeHasCallOrConstructSignatures2(rightType) || isTypeSubtypeOf(rightType, globalFunctionType))) {
|
|
@@ -77481,7 +77534,7 @@ function createTypeChecker(host) {
|
|
|
77481
77534
|
return leftType;
|
|
77482
77535
|
} else {
|
|
77483
77536
|
checkAssignmentOperator(rightType);
|
|
77484
|
-
return
|
|
77537
|
+
return rightType;
|
|
77485
77538
|
}
|
|
77486
77539
|
case 27 /* CommaToken */:
|
|
77487
77540
|
if (!compilerOptions.allowUnreachableCode && isSideEffectFree(left) && !isIndirectCall(left.parent)) {
|
|
@@ -79388,6 +79441,9 @@ function createTypeChecker(host) {
|
|
|
79388
79441
|
case 273 /* ImportSpecifier */:
|
|
79389
79442
|
case 79 /* Identifier */:
|
|
79390
79443
|
return 1 /* ExportValue */;
|
|
79444
|
+
case 170 /* MethodSignature */:
|
|
79445
|
+
case 168 /* PropertySignature */:
|
|
79446
|
+
return 2 /* ExportType */;
|
|
79391
79447
|
default:
|
|
79392
79448
|
return Debug.failBadSyntaxKind(d);
|
|
79393
79449
|
}
|
|
@@ -79411,7 +79467,7 @@ function createTypeChecker(host) {
|
|
|
79411
79467
|
))) {
|
|
79412
79468
|
return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0];
|
|
79413
79469
|
}
|
|
79414
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
79470
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
79415
79471
|
return void 0;
|
|
79416
79472
|
}
|
|
79417
79473
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -79463,7 +79519,7 @@ function createTypeChecker(host) {
|
|
|
79463
79519
|
return awaitedType || errorType;
|
|
79464
79520
|
}
|
|
79465
79521
|
function isThenableType(type) {
|
|
79466
|
-
if (allTypesAssignableToKind(getBaseConstraintOrType(type),
|
|
79522
|
+
if (allTypesAssignableToKind(getBaseConstraintOrType(type), 134348796 /* Primitive */ | 131072 /* Never */)) {
|
|
79467
79523
|
return false;
|
|
79468
79524
|
}
|
|
79469
79525
|
const thenFunction = getTypeOfPropertyOfType(type, "then");
|
|
@@ -79512,7 +79568,7 @@ function createTypeChecker(host) {
|
|
|
79512
79568
|
return awaitedType;
|
|
79513
79569
|
}
|
|
79514
79570
|
}
|
|
79515
|
-
Debug.assert(getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79571
|
+
Debug.assert(isAwaitedTypeInstantiation(type) || getPromisedTypeOfPromise(type) === void 0, "type provided should not be a non-generic 'promise'-like.");
|
|
79516
79572
|
return type;
|
|
79517
79573
|
}
|
|
79518
79574
|
function getAwaitedType(type, errorNode, diagnosticMessage, arg0) {
|
|
@@ -83771,6 +83827,8 @@ function createTypeChecker(host) {
|
|
|
83771
83827
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
83772
83828
|
links.deferredNodes || (links.deferredNodes = /* @__PURE__ */ new Set());
|
|
83773
83829
|
links.deferredNodes.add(node);
|
|
83830
|
+
} else {
|
|
83831
|
+
Debug.assert(!links.deferredNodes, "A type-checked file should have no deferred nodes.");
|
|
83774
83832
|
}
|
|
83775
83833
|
}
|
|
83776
83834
|
function checkDeferredNodes(context) {
|
|
@@ -83778,6 +83836,7 @@ function createTypeChecker(host) {
|
|
|
83778
83836
|
if (links.deferredNodes) {
|
|
83779
83837
|
links.deferredNodes.forEach(checkDeferredNode);
|
|
83780
83838
|
}
|
|
83839
|
+
links.deferredNodes = void 0;
|
|
83781
83840
|
}
|
|
83782
83841
|
function checkDeferredNode(node) {
|
|
83783
83842
|
var _a2, _b;
|
|
@@ -84858,7 +84917,7 @@ function createTypeChecker(host) {
|
|
|
84858
84917
|
return !!(type.flags & 524288 /* Object */) && getSignaturesOfType(type, 0 /* Call */).length > 0;
|
|
84859
84918
|
}
|
|
84860
84919
|
function getTypeReferenceSerializationKind(typeNameIn, location) {
|
|
84861
|
-
var _a2
|
|
84920
|
+
var _a2;
|
|
84862
84921
|
const typeName = getParseTreeNode(typeNameIn, isEntityName);
|
|
84863
84922
|
if (!typeName)
|
|
84864
84923
|
return 0 /* Unknown */;
|
|
@@ -84890,7 +84949,7 @@ function createTypeChecker(host) {
|
|
|
84890
84949
|
location
|
|
84891
84950
|
);
|
|
84892
84951
|
const resolvedSymbol = valueSymbol && valueSymbol.flags & 2097152 /* Alias */ ? resolveAlias(valueSymbol) : valueSymbol;
|
|
84893
|
-
isTypeOnly || (isTypeOnly = !!(
|
|
84952
|
+
isTypeOnly || (isTypeOnly = !!(valueSymbol && getTypeOnlyAliasDeclaration(valueSymbol, 111551 /* Value */)));
|
|
84894
84953
|
const typeSymbol = resolveEntityName(
|
|
84895
84954
|
typeName,
|
|
84896
84955
|
788968 /* Type */,
|
|
@@ -85041,7 +85100,7 @@ function createTypeChecker(host) {
|
|
|
85041
85100
|
return false;
|
|
85042
85101
|
}
|
|
85043
85102
|
function literalTypeToNode(type, enclosing, tracker) {
|
|
85044
|
-
const enumResult = type.flags &
|
|
85103
|
+
const enumResult = type.flags & 1056 /* EnumLike */ ? nodeBuilder.symbolToExpression(
|
|
85045
85104
|
type.symbol,
|
|
85046
85105
|
111551 /* Value */,
|
|
85047
85106
|
enclosing,
|
|
@@ -86602,7 +86661,7 @@ function createTypeChecker(host) {
|
|
|
86602
86661
|
}
|
|
86603
86662
|
function isSimpleLiteralEnumReference(expr) {
|
|
86604
86663
|
if ((isPropertyAccessExpression(expr) || isElementAccessExpression(expr) && isStringOrNumberLiteralExpression(expr.argumentExpression)) && isEntityNameExpression(expr.expression)) {
|
|
86605
|
-
return !!(checkExpressionCached(expr).flags &
|
|
86664
|
+
return !!(checkExpressionCached(expr).flags & 1056 /* EnumLike */);
|
|
86606
86665
|
}
|
|
86607
86666
|
}
|
|
86608
86667
|
function checkAmbientInitializer(node) {
|
|
@@ -87004,10 +87063,10 @@ function createTypeChecker(host) {
|
|
|
87004
87063
|
}
|
|
87005
87064
|
function findMostOverlappyType(source, unionTarget) {
|
|
87006
87065
|
let bestMatch;
|
|
87007
|
-
if (!(source.flags & (
|
|
87066
|
+
if (!(source.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
87008
87067
|
let matchingCount = 0;
|
|
87009
87068
|
for (const target of unionTarget.types) {
|
|
87010
|
-
if (!(target.flags & (
|
|
87069
|
+
if (!(target.flags & (134348796 /* Primitive */ | 406847488 /* InstantiablePrimitive */))) {
|
|
87011
87070
|
const overlap = getIntersectionType([getIndexType(source), getIndexType(target)]);
|
|
87012
87071
|
if (overlap.flags & 4194304 /* Index */) {
|
|
87013
87072
|
return target;
|
|
@@ -87025,7 +87084,7 @@ function createTypeChecker(host) {
|
|
|
87025
87084
|
}
|
|
87026
87085
|
function filterPrimitivesIfContainsNonPrimitive(type) {
|
|
87027
87086
|
if (maybeTypeOfKind(type, 67108864 /* NonPrimitive */)) {
|
|
87028
|
-
const result = filterType(type, (t) => !(t.flags &
|
|
87087
|
+
const result = filterType(type, (t) => !(t.flags & 134348796 /* Primitive */));
|
|
87029
87088
|
if (!(result.flags & 131072 /* Never */)) {
|
|
87030
87089
|
return result;
|
|
87031
87090
|
}
|
|
@@ -91774,7 +91833,7 @@ function transformTypeScript(context) {
|
|
|
91774
91833
|
return node;
|
|
91775
91834
|
}
|
|
91776
91835
|
function tryGetConstEnumValue(node) {
|
|
91777
|
-
if (compilerOptions
|
|
91836
|
+
if (getIsolatedModules(compilerOptions)) {
|
|
91778
91837
|
return void 0;
|
|
91779
91838
|
}
|
|
91780
91839
|
return isPropertyAccessExpression(node) || isElementAccessExpression(node) ? resolver.getConstantValue(node) : void 0;
|
|
@@ -108104,7 +108163,7 @@ function transformECMAScriptModule(context) {
|
|
|
108104
108163
|
if (node.isDeclarationFile) {
|
|
108105
108164
|
return node;
|
|
108106
108165
|
}
|
|
108107
|
-
if (isExternalModule(node) || compilerOptions
|
|
108166
|
+
if (isExternalModule(node) || getIsolatedModules(compilerOptions)) {
|
|
108108
108167
|
currentSourceFile = node;
|
|
108109
108168
|
importRequireStatements = void 0;
|
|
108110
108169
|
let result = updateExternalModule(node);
|
|
@@ -108311,7 +108370,7 @@ function transformECMAScriptModule(context) {
|
|
|
108311
108370
|
}
|
|
108312
108371
|
function onEmitNode(hint, node, emitCallback) {
|
|
108313
108372
|
if (isSourceFile(node)) {
|
|
108314
|
-
if ((isExternalModule(node) || compilerOptions
|
|
108373
|
+
if ((isExternalModule(node) || getIsolatedModules(compilerOptions)) && compilerOptions.importHelpers) {
|
|
108315
108374
|
helperNameSubstitutions = /* @__PURE__ */ new Map();
|
|
108316
108375
|
}
|
|
108317
108376
|
previousOnEmitNode(hint, node, emitCallback);
|
|
@@ -118970,7 +119029,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118970
119029
|
let imports;
|
|
118971
119030
|
let moduleAugmentations;
|
|
118972
119031
|
let ambientModules;
|
|
118973
|
-
if ((options
|
|
119032
|
+
if ((getIsolatedModules(options) || isExternalModuleFile) && !file.isDeclarationFile) {
|
|
118974
119033
|
if (options.importHelpers) {
|
|
118975
119034
|
imports = [createSyntheticImport(externalHelpersModuleNameText, file)];
|
|
118976
119035
|
}
|
|
@@ -119691,12 +119750,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119691
119750
|
if (options.exactOptionalPropertyTypes && !getStrictOptionValue(options, "strictNullChecks")) {
|
|
119692
119751
|
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "exactOptionalPropertyTypes", "strictNullChecks");
|
|
119693
119752
|
}
|
|
119694
|
-
if (options.isolatedModules) {
|
|
119753
|
+
if (options.isolatedModules || options.verbatimModuleSyntax) {
|
|
119695
119754
|
if (options.out) {
|
|
119696
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
|
|
119755
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
119697
119756
|
}
|
|
119698
119757
|
if (options.outFile) {
|
|
119699
|
-
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules");
|
|
119758
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", options.verbatimModuleSyntax ? "verbatimModuleSyntax" : "isolatedModules");
|
|
119700
119759
|
}
|
|
119701
119760
|
}
|
|
119702
119761
|
if (options.inlineSourceMap) {
|
|
@@ -121111,7 +121170,7 @@ var BuilderState;
|
|
|
121111
121170
|
return getAllFilesExcludingDefaultLibraryFile(state, programOfThisState, sourceFileWithUpdatedShape);
|
|
121112
121171
|
}
|
|
121113
121172
|
const compilerOptions = programOfThisState.getCompilerOptions();
|
|
121114
|
-
if (compilerOptions && (compilerOptions
|
|
121173
|
+
if (compilerOptions && (getIsolatedModules(compilerOptions) || outFile(compilerOptions))) {
|
|
121115
121174
|
return [sourceFileWithUpdatedShape];
|
|
121116
121175
|
}
|
|
121117
121176
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
@@ -121536,7 +121595,7 @@ function handleDtsMayChangeOfReferencingExportOfAffectedFile(state, affectedFile
|
|
|
121536
121595
|
return;
|
|
121537
121596
|
if (!isChangedSignature(state, affectedFile.resolvedPath))
|
|
121538
121597
|
return;
|
|
121539
|
-
if (state.compilerOptions
|
|
121598
|
+
if (getIsolatedModules(state.compilerOptions)) {
|
|
121540
121599
|
const seenFileNamesMap = /* @__PURE__ */ new Map();
|
|
121541
121600
|
seenFileNamesMap.set(affectedFile.resolvedPath, true);
|
|
121542
121601
|
const queue = BuilderState.getReferencedByPaths(state, affectedFile.resolvedPath);
|
|
@@ -141411,7 +141470,8 @@ function createImportAdderWorker(sourceFile, program, useAutoImportProvider, pre
|
|
|
141411
141470
|
quotePreference,
|
|
141412
141471
|
defaultImport,
|
|
141413
141472
|
namedImports && arrayFrom(namedImports.entries(), ([name, addAsTypeOnly]) => ({ addAsTypeOnly, name })),
|
|
141414
|
-
namespaceLikeImport
|
|
141473
|
+
namespaceLikeImport,
|
|
141474
|
+
compilerOptions
|
|
141415
141475
|
);
|
|
141416
141476
|
newDeclarations = combine(newDeclarations, declarations);
|
|
141417
141477
|
});
|
|
@@ -141589,7 +141649,7 @@ function getAddAsTypeOnly(isValidTypeOnlyUseSite, isForNewImportDeclaration, sym
|
|
|
141589
141649
|
if (isForNewImportDeclaration && compilerOptions.importsNotUsedAsValues === 2 /* Error */) {
|
|
141590
141650
|
return 2 /* Required */;
|
|
141591
141651
|
}
|
|
141592
|
-
if ((compilerOptions
|
|
141652
|
+
if (importNameElisionDisabled(compilerOptions) && (!(targetFlags & 111551 /* Value */) || !!checker.getTypeOnlyAliasDeclaration(symbol))) {
|
|
141593
141653
|
return 2 /* Required */;
|
|
141594
141654
|
}
|
|
141595
141655
|
return 1 /* Allowed */;
|
|
@@ -142073,7 +142133,14 @@ function codeActionForFixWorker(changes, sourceFile, symbolName2, fix, includeSy
|
|
|
142073
142133
|
insertImports(
|
|
142074
142134
|
changes,
|
|
142075
142135
|
sourceFile,
|
|
142076
|
-
getDeclarations(
|
|
142136
|
+
getDeclarations(
|
|
142137
|
+
moduleSpecifier,
|
|
142138
|
+
quotePreference,
|
|
142139
|
+
defaultImport,
|
|
142140
|
+
namedImports,
|
|
142141
|
+
namespaceLikeImport,
|
|
142142
|
+
compilerOptions
|
|
142143
|
+
),
|
|
142077
142144
|
/*blankLineBetween*/
|
|
142078
142145
|
true,
|
|
142079
142146
|
preferences
|
|
@@ -142097,7 +142164,7 @@ function getModuleSpecifierText(promotedDeclaration) {
|
|
|
142097
142164
|
return promotedDeclaration.kind === 268 /* ImportEqualsDeclaration */ ? ((_b = tryCast((_a2 = tryCast(promotedDeclaration.moduleReference, isExternalModuleReference)) == null ? void 0 : _a2.expression, isStringLiteralLike)) == null ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : cast(promotedDeclaration.parent.moduleSpecifier, isStringLiteral).text;
|
|
142098
142165
|
}
|
|
142099
142166
|
function promoteFromTypeOnly(changes, aliasDeclaration, compilerOptions, sourceFile, preferences) {
|
|
142100
|
-
const convertExistingToTypeOnly = compilerOptions
|
|
142167
|
+
const convertExistingToTypeOnly = importNameElisionDisabled(compilerOptions);
|
|
142101
142168
|
switch (aliasDeclaration.kind) {
|
|
142102
142169
|
case 273 /* ImportSpecifier */:
|
|
142103
142170
|
if (aliasDeclaration.isTypeOnly) {
|
|
@@ -142171,7 +142238,7 @@ function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImpor
|
|
|
142171
142238
|
}
|
|
142172
142239
|
const promoteFromTypeOnly2 = clause.isTypeOnly && some([defaultImport, ...namedImports], (i) => (i == null ? void 0 : i.addAsTypeOnly) === 4 /* NotAllowed */);
|
|
142173
142240
|
const existingSpecifiers = clause.namedBindings && ((_a2 = tryCast(clause.namedBindings, isNamedImports)) == null ? void 0 : _a2.elements);
|
|
142174
|
-
const convertExistingToTypeOnly = promoteFromTypeOnly2 && (compilerOptions
|
|
142241
|
+
const convertExistingToTypeOnly = promoteFromTypeOnly2 && importNameElisionDisabled(compilerOptions);
|
|
142175
142242
|
if (defaultImport) {
|
|
142176
142243
|
Debug.assert(!clause.name, "Cannot add a default import to an import clause that already has one");
|
|
142177
142244
|
changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), factory.createIdentifier(defaultImport.name), { suffix: ", " });
|
|
@@ -142255,11 +142322,11 @@ function getImportTypePrefix(moduleSpecifier, quotePreference) {
|
|
|
142255
142322
|
function needsTypeOnly({ addAsTypeOnly }) {
|
|
142256
142323
|
return addAsTypeOnly === 2 /* Required */;
|
|
142257
142324
|
}
|
|
142258
|
-
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport) {
|
|
142325
|
+
function getNewImports(moduleSpecifier, quotePreference, defaultImport, namedImports, namespaceLikeImport, compilerOptions) {
|
|
142259
142326
|
const quotedModuleSpecifier = makeStringLiteral(moduleSpecifier, quotePreference);
|
|
142260
142327
|
let statements;
|
|
142261
142328
|
if (defaultImport !== void 0 || (namedImports == null ? void 0 : namedImports.length)) {
|
|
142262
|
-
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly);
|
|
142329
|
+
const topLevelTypeOnly = (!defaultImport || needsTypeOnly(defaultImport)) && every(namedImports, needsTypeOnly) || compilerOptions.verbatimModuleSyntax && (defaultImport == null ? void 0 : defaultImport.addAsTypeOnly) !== 4 /* NotAllowed */ && !some(namedImports, (i) => i.addAsTypeOnly === 4 /* NotAllowed */);
|
|
142263
142330
|
statements = combine(statements, makeImport(
|
|
142264
142331
|
defaultImport && factory.createIdentifier(defaultImport.name),
|
|
142265
142332
|
namedImports == null ? void 0 : namedImports.map(({ addAsTypeOnly, name }) => factory.createImportSpecifier(
|
|
@@ -142856,7 +142923,7 @@ function tryGetExportDeclaration(sourceFile, isTypeOnly) {
|
|
|
142856
142923
|
}
|
|
142857
142924
|
function updateExport(changes, program, sourceFile, node, names) {
|
|
142858
142925
|
const namedExports = node.exportClause && isNamedExports(node.exportClause) ? node.exportClause.elements : factory.createNodeArray([]);
|
|
142859
|
-
const allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions()
|
|
142926
|
+
const allowTypeModifier = !node.isTypeOnly && !!(getIsolatedModules(program.getCompilerOptions()) || find(namedExports, (e) => e.isTypeOnly));
|
|
142860
142927
|
changes.replaceNode(
|
|
142861
142928
|
sourceFile,
|
|
142862
142929
|
node,
|
|
@@ -142888,7 +142955,7 @@ function createExport(changes, program, sourceFile, names) {
|
|
|
142888
142955
|
factory.createNamedExports(createExportSpecifiers(
|
|
142889
142956
|
names,
|
|
142890
142957
|
/*allowTypeModifier*/
|
|
142891
|
-
|
|
142958
|
+
getIsolatedModules(program.getCompilerOptions())
|
|
142892
142959
|
)),
|
|
142893
142960
|
/*moduleSpecifier*/
|
|
142894
142961
|
void 0,
|
|
@@ -151169,7 +151236,7 @@ function getPropertiesForObjectExpression(contextualType, completionsType, obj,
|
|
|
151169
151236
|
function getApparentProperties(type, node, checker) {
|
|
151170
151237
|
if (!type.isUnion())
|
|
151171
151238
|
return type.getApparentProperties();
|
|
151172
|
-
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags &
|
|
151239
|
+
return checker.getAllPossiblePropertiesOfTypes(filter(type.types, (memberType) => !(memberType.flags & 134348796 /* Primitive */ || checker.isArrayLikeType(memberType) || checker.isTypeInvalidDueToUnionDiscriminant(memberType, node) || typeHasCallOrConstructSignatures(memberType, checker) || memberType.isClass() && containsNonPublicProperties(memberType.getApparentProperties()))));
|
|
151173
151240
|
}
|
|
151174
151241
|
function containsNonPublicProperties(props) {
|
|
151175
151242
|
return some(props, (p) => !!(getDeclarationModifierFlagsFromSymbol(p) & 24 /* NonPublicAccessibilityModifier */));
|
|
@@ -155592,6 +155659,7 @@ var jsDocTagNames = [
|
|
|
155592
155659
|
"module",
|
|
155593
155660
|
"name",
|
|
155594
155661
|
"namespace",
|
|
155662
|
+
"overload",
|
|
155595
155663
|
"override",
|
|
155596
155664
|
"package",
|
|
155597
155665
|
"param",
|