typescript 4.8.0-dev.20220526 → 4.8.0-dev.20220529
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/lib.es5.d.ts +1 -1
- package/lib/tsc.js +228 -105
- package/lib/tsserver.js +270 -128
- package/lib/tsserverlibrary.js +270 -128
- package/lib/typescript.js +265 -122
- package/lib/typescriptServices.js +265 -122
- package/lib/typingsInstaller.js +260 -115
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.8";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220529";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -5598,6 +5598,7 @@ var ts;
|
|
|
5598
5598
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", undefined, true),
|
|
5599
5599
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
5600
5600
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
5601
|
+
This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
|
|
5601
5602
|
The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2209, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_export_map_entry_0_in_file_1_Supply_the_roo_2209", "The project root is ambiguous, but is required to resolve export map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5602
5603
|
The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_rootDir_compiler_option_to_disambiguate: diag(2210, ts.DiagnosticCategory.Error, "The_project_root_is_ambiguous_but_is_required_to_resolve_import_map_entry_0_in_file_1_Supply_the_roo_2210", "The project root is ambiguous, but is required to resolve import map entry '{0}' in file '{1}'. Supply the `rootDir` compiler option to disambiguate."),
|
|
5603
5604
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
@@ -12599,9 +12600,6 @@ var ts;
|
|
|
12599
12600
|
}
|
|
12600
12601
|
ts.isVariableDeclarationInitializedToBareOrAccessedRequire = isVariableDeclarationInitializedToBareOrAccessedRequire;
|
|
12601
12602
|
function isVariableDeclarationInitializedWithRequireHelper(node, allowAccessedRequire) {
|
|
12602
|
-
if (node.kind === 203) {
|
|
12603
|
-
node = node.parent.parent;
|
|
12604
|
-
}
|
|
12605
12603
|
return ts.isVariableDeclaration(node) &&
|
|
12606
12604
|
!!node.initializer &&
|
|
12607
12605
|
isRequireCall(allowAccessedRequire ? getLeftmostAccessExpression(node.initializer) : node.initializer, true);
|
|
@@ -15861,13 +15859,13 @@ var ts;
|
|
|
15861
15859
|
return !file.isDeclarationFile ? walkTreeForJSXTags(file) : undefined;
|
|
15862
15860
|
}
|
|
15863
15861
|
function isFileForcedToBeModuleByFormat(file) {
|
|
15864
|
-
return file.impliedNodeFormat === ts.ModuleKind.ESNext && !file.isDeclarationFile ? true : undefined;
|
|
15862
|
+
return (file.impliedNodeFormat === ts.ModuleKind.ESNext || (ts.fileExtensionIsOneOf(file.fileName, [".cjs", ".cts"]))) && !file.isDeclarationFile ? true : undefined;
|
|
15865
15863
|
}
|
|
15866
15864
|
function getSetExternalModuleIndicator(options) {
|
|
15867
15865
|
switch (getEmitModuleDetectionKind(options)) {
|
|
15868
15866
|
case ts.ModuleDetectionKind.Force:
|
|
15869
15867
|
return function (file) {
|
|
15870
|
-
file.externalModuleIndicator = !file.isDeclarationFile ||
|
|
15868
|
+
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file) || !file.isDeclarationFile || undefined;
|
|
15871
15869
|
};
|
|
15872
15870
|
case ts.ModuleDetectionKind.Legacy:
|
|
15873
15871
|
return function (file) {
|
|
@@ -15923,7 +15921,8 @@ var ts;
|
|
|
15923
15921
|
}
|
|
15924
15922
|
ts.getEmitModuleResolutionKind = getEmitModuleResolutionKind;
|
|
15925
15923
|
function getEmitModuleDetectionKind(options) {
|
|
15926
|
-
return options.moduleDetection ||
|
|
15924
|
+
return options.moduleDetection ||
|
|
15925
|
+
(getEmitModuleKind(options) === ts.ModuleKind.Node16 || getEmitModuleKind(options) === ts.ModuleKind.NodeNext ? ts.ModuleDetectionKind.Force : ts.ModuleDetectionKind.Auto);
|
|
15927
15926
|
}
|
|
15928
15927
|
ts.getEmitModuleDetectionKind = getEmitModuleDetectionKind;
|
|
15929
15928
|
function hasJsonModuleEmitEnabled(options) {
|
|
@@ -38491,12 +38490,14 @@ var ts;
|
|
|
38491
38490
|
}
|
|
38492
38491
|
}
|
|
38493
38492
|
function setCommonJsModuleIndicator(node) {
|
|
38494
|
-
if (file.externalModuleIndicator) {
|
|
38493
|
+
if (file.externalModuleIndicator && file.externalModuleIndicator !== true) {
|
|
38495
38494
|
return false;
|
|
38496
38495
|
}
|
|
38497
38496
|
if (!file.commonJsModuleIndicator) {
|
|
38498
38497
|
file.commonJsModuleIndicator = node;
|
|
38499
|
-
|
|
38498
|
+
if (!file.externalModuleIndicator) {
|
|
38499
|
+
bindSourceFileAsExternalModule();
|
|
38500
|
+
}
|
|
38500
38501
|
}
|
|
38501
38502
|
return true;
|
|
38502
38503
|
}
|
|
@@ -38849,7 +38850,11 @@ var ts;
|
|
|
38849
38850
|
checkStrictModeEvalOrArguments(node, node.name);
|
|
38850
38851
|
}
|
|
38851
38852
|
if (!ts.isBindingPattern(node.name)) {
|
|
38852
|
-
|
|
38853
|
+
var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent;
|
|
38854
|
+
if (ts.isInJSFile(node) &&
|
|
38855
|
+
ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) &&
|
|
38856
|
+
!ts.getJSDocTypeTag(node) &&
|
|
38857
|
+
!(ts.getCombinedModifierFlags(node) & 1)) {
|
|
38853
38858
|
declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
|
|
38854
38859
|
}
|
|
38855
38860
|
else if (ts.isBlockOrCatchScoped(node)) {
|
|
@@ -39747,6 +39752,7 @@ var ts;
|
|
|
39747
39752
|
var emptyTypeLiteralSymbol = createSymbol(2048, "__type");
|
|
39748
39753
|
emptyTypeLiteralSymbol.members = ts.createSymbolTable();
|
|
39749
39754
|
var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
39755
|
+
var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType;
|
|
39750
39756
|
var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
39751
39757
|
emptyGenericType.instantiations = new ts.Map();
|
|
39752
39758
|
var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
@@ -41162,7 +41168,8 @@ var ts;
|
|
|
41162
41168
|
&& isAliasableOrJsExpression(node.parent.right)
|
|
41163
41169
|
|| node.kind === 297
|
|
41164
41170
|
|| node.kind === 296 && isAliasableOrJsExpression(node.initializer)
|
|
41165
|
-
|| ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
41171
|
+
|| node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)
|
|
41172
|
+
|| node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent);
|
|
41166
41173
|
}
|
|
41167
41174
|
function isAliasableOrJsExpression(e) {
|
|
41168
41175
|
return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e);
|
|
@@ -41243,7 +41250,7 @@ var ts;
|
|
|
41243
41250
|
if (!ts.isSourceFileJS(file)) {
|
|
41244
41251
|
return hasExportAssignmentSymbol(moduleSymbol);
|
|
41245
41252
|
}
|
|
41246
|
-
return
|
|
41253
|
+
return typeof file.externalModuleIndicator !== "object" && !resolveExportByName(moduleSymbol, ts.escapeLeadingUnderscores("__esModule"), undefined, dontResolveAlias);
|
|
41247
41254
|
}
|
|
41248
41255
|
function getTargetOfImportClause(node, dontResolveAlias) {
|
|
41249
41256
|
var _a;
|
|
@@ -48555,7 +48562,7 @@ var ts;
|
|
|
48555
48562
|
}
|
|
48556
48563
|
}
|
|
48557
48564
|
}
|
|
48558
|
-
else if (t.flags & 469892092) {
|
|
48565
|
+
else if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) {
|
|
48559
48566
|
hasDisjointDomainType = true;
|
|
48560
48567
|
}
|
|
48561
48568
|
}
|
|
@@ -48563,7 +48570,7 @@ var ts;
|
|
|
48563
48570
|
if (hasDisjointDomainType) {
|
|
48564
48571
|
for (var _a = 0, types_6 = types; _a < types_6.length; _a++) {
|
|
48565
48572
|
var t = types_6[_a];
|
|
48566
|
-
if (t.flags & 469892092) {
|
|
48573
|
+
if (t.flags & 469892092 || isEmptyAnonymousObjectType(t)) {
|
|
48567
48574
|
constraints = ts.append(constraints, t);
|
|
48568
48575
|
}
|
|
48569
48576
|
}
|
|
@@ -50833,7 +50840,7 @@ var ts;
|
|
|
50833
50840
|
}
|
|
50834
50841
|
return includes;
|
|
50835
50842
|
}
|
|
50836
|
-
function
|
|
50843
|
+
function removeRedundantSupertypes(types, includes) {
|
|
50837
50844
|
var i = types.length;
|
|
50838
50845
|
while (i > 0) {
|
|
50839
50846
|
i--;
|
|
@@ -50841,7 +50848,9 @@ var ts;
|
|
|
50841
50848
|
var remove = t.flags & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50842
50849
|
t.flags & 8 && includes & 256 ||
|
|
50843
50850
|
t.flags & 64 && includes & 2048 ||
|
|
50844
|
-
t.flags & 4096 && includes & 8192
|
|
50851
|
+
t.flags & 4096 && includes & 8192 ||
|
|
50852
|
+
t.flags & 16384 && includes & 32768 ||
|
|
50853
|
+
isEmptyAnonymousObjectType(t) && includes & 470302716;
|
|
50845
50854
|
if (remove) {
|
|
50846
50855
|
ts.orderedRemoveItemAt(types, i);
|
|
50847
50856
|
}
|
|
@@ -50936,7 +50945,7 @@ var ts;
|
|
|
50936
50945
|
result.aliasTypeArguments = aliasTypeArguments;
|
|
50937
50946
|
return result;
|
|
50938
50947
|
}
|
|
50939
|
-
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
|
|
50948
|
+
function getIntersectionType(types, aliasSymbol, aliasTypeArguments, noSupertypeReduction) {
|
|
50940
50949
|
var typeMembershipMap = new ts.Map();
|
|
50941
50950
|
var includes = addTypesToIntersection(typeMembershipMap, 0, types);
|
|
50942
50951
|
var typeSet = ts.arrayFrom(typeMembershipMap.values());
|
|
@@ -50964,11 +50973,11 @@ var ts;
|
|
|
50964
50973
|
if (includes & 4 && includes & (128 | 134217728 | 268435456) ||
|
|
50965
50974
|
includes & 8 && includes & 256 ||
|
|
50966
50975
|
includes & 64 && includes & 2048 ||
|
|
50967
|
-
includes & 4096 && includes & 8192
|
|
50968
|
-
|
|
50969
|
-
|
|
50970
|
-
|
|
50971
|
-
|
|
50976
|
+
includes & 4096 && includes & 8192 ||
|
|
50977
|
+
includes & 16384 && includes & 32768 ||
|
|
50978
|
+
includes & 16777216 && includes & 470302716) {
|
|
50979
|
+
if (!noSupertypeReduction)
|
|
50980
|
+
removeRedundantSupertypes(typeSet, includes);
|
|
50972
50981
|
}
|
|
50973
50982
|
if (includes & 262144) {
|
|
50974
50983
|
typeSet[typeSet.indexOf(undefinedType)] = missingType;
|
|
@@ -51000,7 +51009,7 @@ var ts;
|
|
|
51000
51009
|
return errorType;
|
|
51001
51010
|
}
|
|
51002
51011
|
var constituents = getCrossProductIntersections(typeSet);
|
|
51003
|
-
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); }) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined;
|
|
51012
|
+
var origin = ts.some(constituents, function (t) { return !!(t.flags & 2097152); }) && getConstituentCountOfTypes(constituents) > getConstituentCountOfTypes(typeSet) ? createOriginUnionOrIntersectionType(2097152, typeSet) : undefined;
|
|
51004
51013
|
result = getUnionType(constituents, 1, aliasSymbol, aliasTypeArguments, origin);
|
|
51005
51014
|
}
|
|
51006
51015
|
}
|
|
@@ -51043,11 +51052,21 @@ var ts;
|
|
|
51043
51052
|
}
|
|
51044
51053
|
return intersections;
|
|
51045
51054
|
}
|
|
51055
|
+
function getConstituentCount(type) {
|
|
51056
|
+
return !(type.flags & 3145728) || type.aliasSymbol ? 1 :
|
|
51057
|
+
type.flags & 1048576 && type.origin ? getConstituentCount(type.origin) :
|
|
51058
|
+
getConstituentCountOfTypes(type.types);
|
|
51059
|
+
}
|
|
51060
|
+
function getConstituentCountOfTypes(types) {
|
|
51061
|
+
return ts.reduceLeft(types, function (n, t) { return n + getConstituentCount(t); }, 0);
|
|
51062
|
+
}
|
|
51046
51063
|
function getTypeFromIntersectionTypeNode(node) {
|
|
51047
51064
|
var links = getNodeLinks(node);
|
|
51048
51065
|
if (!links.resolvedType) {
|
|
51049
51066
|
var aliasSymbol = getAliasSymbolForTypeNode(node);
|
|
51050
|
-
|
|
51067
|
+
var types = ts.map(node.types, getTypeFromTypeNode);
|
|
51068
|
+
var noSupertypeReduction = types.length === 2 && !!(types[0].flags & (4 | 8 | 64)) && types[1] === emptyTypeLiteralType;
|
|
51069
|
+
links.resolvedType = getIntersectionType(types, aliasSymbol, getTypeArgumentsForAliasSymbol(aliasSymbol), noSupertypeReduction);
|
|
51051
51070
|
}
|
|
51052
51071
|
return links.resolvedType;
|
|
51053
51072
|
}
|
|
@@ -53526,6 +53545,17 @@ var ts;
|
|
|
53526
53545
|
return !!(ts.getObjectFlags(type) & 16 && (type.members && isEmptyResolvedType(type) ||
|
|
53527
53546
|
type.symbol && type.symbol.flags & 2048 && getMembersOfSymbol(type.symbol).size === 0));
|
|
53528
53547
|
}
|
|
53548
|
+
function isUnknownLikeUnionType(type) {
|
|
53549
|
+
if (strictNullChecks && type.flags & 1048576) {
|
|
53550
|
+
if (!(type.objectFlags & 33554432)) {
|
|
53551
|
+
var types = type.types;
|
|
53552
|
+
type.objectFlags |= 33554432 | (types.length >= 3 && types[0].flags & 32768 &&
|
|
53553
|
+
types[1].flags & 65536 && ts.some(types, isEmptyAnonymousObjectType) ? 67108864 : 0);
|
|
53554
|
+
}
|
|
53555
|
+
return !!(type.objectFlags & 67108864);
|
|
53556
|
+
}
|
|
53557
|
+
return false;
|
|
53558
|
+
}
|
|
53529
53559
|
function isStringIndexSignatureOnlyType(type) {
|
|
53530
53560
|
return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfosOfType(type).length === 1 && !!getIndexInfoOfType(type, stringType) ||
|
|
53531
53561
|
type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
|
|
@@ -53603,13 +53633,15 @@ var ts;
|
|
|
53603
53633
|
return true;
|
|
53604
53634
|
if (s & 65536 && (!strictNullChecks && !(t & 3145728) || t & 65536))
|
|
53605
53635
|
return true;
|
|
53606
|
-
if (s & 524288 && t & 67108864)
|
|
53636
|
+
if (s & 524288 && t & 67108864 && !(relation === strictSubtypeRelation && isEmptyAnonymousObjectType(source)))
|
|
53607
53637
|
return true;
|
|
53608
53638
|
if (relation === assignableRelation || relation === comparableRelation) {
|
|
53609
53639
|
if (s & 1)
|
|
53610
53640
|
return true;
|
|
53611
53641
|
if (s & (8 | 256) && !(s & 1024) && (t & 32 || relation === assignableRelation && t & 256 && t & 1024))
|
|
53612
53642
|
return true;
|
|
53643
|
+
if (isUnknownLikeUnionType(target))
|
|
53644
|
+
return true;
|
|
53613
53645
|
}
|
|
53614
53646
|
return false;
|
|
53615
53647
|
}
|
|
@@ -53651,16 +53683,27 @@ var ts;
|
|
|
53651
53683
|
function getNormalizedType(type, writing) {
|
|
53652
53684
|
while (true) {
|
|
53653
53685
|
var t = isFreshLiteralType(type) ? type.regularType :
|
|
53654
|
-
ts.getObjectFlags(type) & 4
|
|
53655
|
-
type.flags & 3145728 ?
|
|
53686
|
+
ts.getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type :
|
|
53687
|
+
type.flags & 3145728 ? getNormalizedUnionOrIntersectionType(type, writing) :
|
|
53656
53688
|
type.flags & 33554432 ? writing ? type.baseType : type.substitute :
|
|
53657
53689
|
type.flags & 25165824 ? getSimplifiedType(type, writing) :
|
|
53658
53690
|
type;
|
|
53659
|
-
t = getSingleBaseForNonAugmentingSubtype(t) || t;
|
|
53660
53691
|
if (t === type)
|
|
53661
|
-
|
|
53692
|
+
return t;
|
|
53662
53693
|
type = t;
|
|
53663
53694
|
}
|
|
53695
|
+
}
|
|
53696
|
+
function getNormalizedUnionOrIntersectionType(type, writing) {
|
|
53697
|
+
var reduced = getReducedType(type);
|
|
53698
|
+
if (reduced !== type) {
|
|
53699
|
+
return reduced;
|
|
53700
|
+
}
|
|
53701
|
+
if (type.flags & 2097152) {
|
|
53702
|
+
var normalizedTypes = ts.sameMap(type.types, function (t) { return getNormalizedType(t, writing); });
|
|
53703
|
+
if (normalizedTypes !== type.types) {
|
|
53704
|
+
return getIntersectionType(normalizedTypes);
|
|
53705
|
+
}
|
|
53706
|
+
}
|
|
53664
53707
|
return type;
|
|
53665
53708
|
}
|
|
53666
53709
|
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
|
|
@@ -54035,6 +54078,7 @@ var ts;
|
|
|
54035
54078
|
return 0;
|
|
54036
54079
|
}
|
|
54037
54080
|
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
54081
|
+
var _a, _b;
|
|
54038
54082
|
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
54039
54083
|
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
54040
54084
|
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
@@ -54073,6 +54117,9 @@ var ts;
|
|
|
54073
54117
|
return;
|
|
54074
54118
|
}
|
|
54075
54119
|
reportRelationError(headMessage, source, target);
|
|
54120
|
+
if (strictNullChecks && source.flags & 8650752 && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864))) {
|
|
54121
|
+
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
|
|
54122
|
+
}
|
|
54076
54123
|
}
|
|
54077
54124
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
54078
54125
|
if (!ts.tracing) {
|
|
@@ -54714,12 +54761,6 @@ var ts;
|
|
|
54714
54761
|
if (sourceFlags & 8650752) {
|
|
54715
54762
|
if (!(sourceFlags & 8388608 && targetFlags & 8388608)) {
|
|
54716
54763
|
var constraint = getConstraintOfType(source) || unknownType;
|
|
54717
|
-
if (!getConstraintOfType(source) || (sourceFlags & 262144 && constraint.flags & 1)) {
|
|
54718
|
-
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864), 3)) {
|
|
54719
|
-
resetErrorInfo(saveErrorInfo);
|
|
54720
|
-
return result;
|
|
54721
|
-
}
|
|
54722
|
-
}
|
|
54723
54764
|
if (result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState)) {
|
|
54724
54765
|
resetErrorInfo(saveErrorInfo);
|
|
54725
54766
|
return result;
|
|
@@ -55975,9 +56016,11 @@ var ts;
|
|
|
55975
56016
|
return getSupertypeOrUnion(types);
|
|
55976
56017
|
}
|
|
55977
56018
|
var primaryTypes = ts.filter(types, function (t) { return !(t.flags & 98304); });
|
|
55978
|
-
|
|
55979
|
-
|
|
55980
|
-
getUnionType(types,
|
|
56019
|
+
if (primaryTypes.length) {
|
|
56020
|
+
var supertypeOrUnion = getSupertypeOrUnion(primaryTypes);
|
|
56021
|
+
return primaryTypes === types ? supertypeOrUnion : getUnionType(__spreadArray([supertypeOrUnion], ts.filter(types, function (t) { return !!(t.flags & 98304); }), true));
|
|
56022
|
+
}
|
|
56023
|
+
return getUnionType(types, 2);
|
|
55981
56024
|
}
|
|
55982
56025
|
function getCommonSubtype(types) {
|
|
55983
56026
|
return ts.reduceLeft(types, function (s, t) { return isTypeSubtypeOf(t, s) ? t : s; });
|
|
@@ -56164,12 +56207,13 @@ var ts;
|
|
|
56164
56207
|
return result;
|
|
56165
56208
|
}
|
|
56166
56209
|
function getFalsyFlags(type) {
|
|
56167
|
-
|
|
56168
|
-
|
|
56169
|
-
|
|
56170
|
-
|
|
56171
|
-
|
|
56172
|
-
|
|
56210
|
+
var t = type.flags & 2097152 ? getBaseConstraintOrType(type) : type;
|
|
56211
|
+
return t.flags & 1048576 ? getFalsyFlagsOfTypes(t.types) :
|
|
56212
|
+
t.flags & 128 ? t.value === "" ? 128 : 0 :
|
|
56213
|
+
t.flags & 256 ? t.value === 0 ? 256 : 0 :
|
|
56214
|
+
t.flags & 2048 ? isZeroBigInt(t) ? 2048 : 0 :
|
|
56215
|
+
t.flags & 512 ? (t === falseType || t === regularFalseType) ? 512 : 0 :
|
|
56216
|
+
t.flags & 117724;
|
|
56173
56217
|
}
|
|
56174
56218
|
function removeDefinitelyFalsyTypes(type) {
|
|
56175
56219
|
return getFalsyFlags(type) & 117632 ?
|
|
@@ -56204,16 +56248,19 @@ var ts;
|
|
|
56204
56248
|
return type.flags & 32768 ? type : getUnionType([type, isProperty ? missingType : undefinedType]);
|
|
56205
56249
|
}
|
|
56206
56250
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
56207
|
-
var reducedType = getTypeWithFacts(type, 2097152);
|
|
56208
56251
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
56209
56252
|
deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, undefined) || unknownSymbol;
|
|
56210
56253
|
}
|
|
56211
56254
|
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
56212
|
-
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [
|
|
56213
|
-
|
|
56255
|
+
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [type]) :
|
|
56256
|
+
getIntersectionType([type, emptyObjectType]);
|
|
56214
56257
|
}
|
|
56215
56258
|
function getNonNullableType(type) {
|
|
56216
|
-
|
|
56259
|
+
if (strictNullChecks) {
|
|
56260
|
+
var reducedType = getTypeWithFacts(type, 2097152);
|
|
56261
|
+
return maybeTypeOfKind(reducedType, 465829888) ? getGlobalNonNullableTypeInstantiation(reducedType) : reducedType;
|
|
56262
|
+
}
|
|
56263
|
+
return type;
|
|
56217
56264
|
}
|
|
56218
56265
|
function addOptionalTypeMarker(type) {
|
|
56219
56266
|
return strictNullChecks ? getUnionType([type, optionalType]) : type;
|
|
@@ -56807,17 +56854,32 @@ var ts;
|
|
|
56807
56854
|
return sourceStart.slice(0, startLen) !== targetStart.slice(0, startLen) ||
|
|
56808
56855
|
sourceEnd.slice(sourceEnd.length - endLen) !== targetEnd.slice(targetEnd.length - endLen);
|
|
56809
56856
|
}
|
|
56810
|
-
function
|
|
56857
|
+
function isValidNumberString(s, roundTripOnly) {
|
|
56858
|
+
if (s === "")
|
|
56859
|
+
return false;
|
|
56860
|
+
var n = +s;
|
|
56861
|
+
return isFinite(n) && (!roundTripOnly || "" + n === s);
|
|
56862
|
+
}
|
|
56863
|
+
function parseBigIntLiteralType(text) {
|
|
56864
|
+
var negative = text.startsWith("-");
|
|
56865
|
+
var base10Value = ts.parsePseudoBigInt((negative ? text.slice(1) : text) + "n");
|
|
56866
|
+
return getBigIntLiteralType({ negative: negative, base10Value: base10Value });
|
|
56867
|
+
}
|
|
56868
|
+
function isValidBigIntString(s, roundTripOnly) {
|
|
56869
|
+
if (s === "")
|
|
56870
|
+
return false;
|
|
56811
56871
|
var scanner = ts.createScanner(99, false);
|
|
56812
56872
|
var success = true;
|
|
56813
56873
|
scanner.setOnError(function () { return success = false; });
|
|
56814
56874
|
scanner.setText(s + "n");
|
|
56815
56875
|
var result = scanner.scan();
|
|
56816
|
-
|
|
56876
|
+
var negative = result === 40;
|
|
56877
|
+
if (negative) {
|
|
56817
56878
|
result = scanner.scan();
|
|
56818
56879
|
}
|
|
56819
56880
|
var flags = scanner.getTokenFlags();
|
|
56820
|
-
return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
|
|
56881
|
+
return success && result === 9 && scanner.getTextPos() === (s.length + 1) && !(flags & 512)
|
|
56882
|
+
&& (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) }));
|
|
56821
56883
|
}
|
|
56822
56884
|
function isValidTypeForTemplateLiteralPlaceholder(source, target) {
|
|
56823
56885
|
if (source === target || target.flags & (1 | 4)) {
|
|
@@ -56825,8 +56887,8 @@ var ts;
|
|
|
56825
56887
|
}
|
|
56826
56888
|
if (source.flags & 128) {
|
|
56827
56889
|
var value = source.value;
|
|
56828
|
-
return !!(target.flags & 8 && value
|
|
56829
|
-
target.flags & 64 &&
|
|
56890
|
+
return !!(target.flags & 8 && isValidNumberString(value, false) ||
|
|
56891
|
+
target.flags & 64 && isValidBigIntString(value, false) ||
|
|
56830
56892
|
target.flags & (512 | 98304) && value === target.intrinsicName);
|
|
56831
56893
|
}
|
|
56832
56894
|
if (source.flags & 134217728) {
|
|
@@ -57291,8 +57353,51 @@ var ts;
|
|
|
57291
57353
|
var matches = inferTypesFromTemplateLiteralType(source, target);
|
|
57292
57354
|
var types = target.types;
|
|
57293
57355
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
57356
|
+
var _loop_23 = function (i) {
|
|
57357
|
+
var source_1 = matches ? matches[i] : neverType;
|
|
57358
|
+
var target_3 = types[i];
|
|
57359
|
+
if (source_1.flags & 128 && target_3.flags & 8650752) {
|
|
57360
|
+
var inferenceContext = getInferenceInfoForType(target_3);
|
|
57361
|
+
var constraint = inferenceContext ? getBaseConstraintOfType(inferenceContext.typeParameter) : undefined;
|
|
57362
|
+
if (constraint && !isTypeAny(constraint)) {
|
|
57363
|
+
var constraintTypes = constraint.flags & 1048576 ? constraint.types : [constraint];
|
|
57364
|
+
var allTypeFlags_1 = ts.reduceLeft(constraintTypes, function (flags, t) { return flags | t.flags; }, 0);
|
|
57365
|
+
if (!(allTypeFlags_1 & 4)) {
|
|
57366
|
+
var str_1 = source_1.value;
|
|
57367
|
+
if (allTypeFlags_1 & 296 && !isValidNumberString(str_1, true)) {
|
|
57368
|
+
allTypeFlags_1 &= ~296;
|
|
57369
|
+
}
|
|
57370
|
+
if (allTypeFlags_1 & 2112 && !isValidBigIntString(str_1, true)) {
|
|
57371
|
+
allTypeFlags_1 &= ~2112;
|
|
57372
|
+
}
|
|
57373
|
+
var matchingType = ts.reduceLeft(constraintTypes, function (left, right) {
|
|
57374
|
+
return !(right.flags & allTypeFlags_1) ? left :
|
|
57375
|
+
left.flags & 4 ? left : right.flags & 4 ? source_1 :
|
|
57376
|
+
left.flags & 134217728 ? left : right.flags & 134217728 && isTypeMatchedByTemplateLiteralType(source_1, right) ? source_1 :
|
|
57377
|
+
left.flags & 268435456 ? left : right.flags & 268435456 && str_1 === applyStringMapping(right.symbol, str_1) ? source_1 :
|
|
57378
|
+
left.flags & 128 ? left : right.flags & 128 && right.value === str_1 ? right :
|
|
57379
|
+
left.flags & 8 ? left : right.flags & 8 ? getNumberLiteralType(+str_1) :
|
|
57380
|
+
left.flags & 32 ? left : right.flags & 32 ? getNumberLiteralType(+str_1) :
|
|
57381
|
+
left.flags & 256 ? left : right.flags & 256 && right.value === +str_1 ? right :
|
|
57382
|
+
left.flags & 64 ? left : right.flags & 64 ? parseBigIntLiteralType(str_1) :
|
|
57383
|
+
left.flags & 2048 ? left : right.flags & 2048 && ts.pseudoBigIntToString(right.value) === str_1 ? right :
|
|
57384
|
+
left.flags & 16 ? left : right.flags & 16 ? str_1 === "true" ? trueType : str_1 === "false" ? falseType : booleanType :
|
|
57385
|
+
left.flags & 512 ? left : right.flags & 512 && right.intrinsicName === str_1 ? right :
|
|
57386
|
+
left.flags & 32768 ? left : right.flags & 32768 && right.intrinsicName === str_1 ? right :
|
|
57387
|
+
left.flags & 65536 ? left : right.flags & 65536 && right.intrinsicName === str_1 ? right :
|
|
57388
|
+
left;
|
|
57389
|
+
}, neverType);
|
|
57390
|
+
if (!(matchingType.flags & 131072)) {
|
|
57391
|
+
inferFromTypes(matchingType, target_3);
|
|
57392
|
+
return "continue";
|
|
57393
|
+
}
|
|
57394
|
+
}
|
|
57395
|
+
}
|
|
57396
|
+
}
|
|
57397
|
+
inferFromTypes(source_1, target_3);
|
|
57398
|
+
};
|
|
57294
57399
|
for (var i = 0; i < types.length; i++) {
|
|
57295
|
-
|
|
57400
|
+
_loop_23(i);
|
|
57296
57401
|
}
|
|
57297
57402
|
}
|
|
57298
57403
|
}
|
|
@@ -57762,7 +57867,7 @@ var ts;
|
|
|
57762
57867
|
function mapTypesByKeyProperty(types, name) {
|
|
57763
57868
|
var map = new ts.Map();
|
|
57764
57869
|
var count = 0;
|
|
57765
|
-
var
|
|
57870
|
+
var _loop_24 = function (type) {
|
|
57766
57871
|
if (type.flags & (524288 | 2097152 | 58982400)) {
|
|
57767
57872
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
57768
57873
|
if (discriminant) {
|
|
@@ -57788,7 +57893,7 @@ var ts;
|
|
|
57788
57893
|
};
|
|
57789
57894
|
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
57790
57895
|
var type = types_16[_i];
|
|
57791
|
-
var state_9 =
|
|
57896
|
+
var state_9 = _loop_24(type);
|
|
57792
57897
|
if (typeof state_9 === "object")
|
|
57793
57898
|
return state_9.value;
|
|
57794
57899
|
}
|
|
@@ -57976,6 +58081,24 @@ var ts;
|
|
|
57976
58081
|
function getTypeWithFacts(type, include) {
|
|
57977
58082
|
return filterType(type, function (t) { return (getTypeFacts(t) & include) !== 0; });
|
|
57978
58083
|
}
|
|
58084
|
+
function getIntersectionWithFacts(type, facts) {
|
|
58085
|
+
var reduced = recombineUnknownType(getTypeWithFacts(strictNullChecks && type.flags & 2 ? unknownUnionType : type, facts));
|
|
58086
|
+
if (strictNullChecks) {
|
|
58087
|
+
switch (facts) {
|
|
58088
|
+
case 524288:
|
|
58089
|
+
return mapType(reduced, function (t) { return getTypeFacts(t) & 65536 ? getIntersectionType([t, getTypeFacts(t) & 131072 && !maybeTypeOfKind(reduced, 65536) ? getUnionType([emptyObjectType, nullType]) : emptyObjectType]) : t; });
|
|
58090
|
+
case 1048576:
|
|
58091
|
+
return mapType(reduced, function (t) { return getTypeFacts(t) & 131072 ? getIntersectionType([t, getTypeFacts(t) & 65536 && !maybeTypeOfKind(reduced, 32768) ? getUnionType([emptyObjectType, undefinedType]) : emptyObjectType]) : t; });
|
|
58092
|
+
case 2097152:
|
|
58093
|
+
case 4194304:
|
|
58094
|
+
return mapType(reduced, function (t) { return getTypeFacts(t) & 262144 ? getGlobalNonNullableTypeInstantiation(t) : t; });
|
|
58095
|
+
}
|
|
58096
|
+
}
|
|
58097
|
+
return reduced;
|
|
58098
|
+
}
|
|
58099
|
+
function recombineUnknownType(type) {
|
|
58100
|
+
return type === unknownUnionType ? unknownType : type;
|
|
58101
|
+
}
|
|
57979
58102
|
function getTypeWithDefault(type, defaultExpression) {
|
|
57980
58103
|
return defaultExpression ?
|
|
57981
58104
|
getUnionType([getNonUndefinedType(type), getTypeOfExpression(defaultExpression)]) :
|
|
@@ -58916,7 +59039,7 @@ var ts;
|
|
|
58916
59039
|
if (isEvolvingArrayTypeList(types)) {
|
|
58917
59040
|
return getEvolvingArrayType(getUnionType(ts.map(types, getElementTypeOfEvolvingArrayType)));
|
|
58918
59041
|
}
|
|
58919
|
-
var result = getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction);
|
|
59042
|
+
var result = recombineUnknownType(getUnionType(ts.sameMap(types, finalizeEvolvingArrayType), subtypeReduction));
|
|
58920
59043
|
if (result !== declaredType && result.flags & declaredType.flags & 1048576 && ts.arraysEqual(result.types, declaredType.types)) {
|
|
58921
59044
|
return declaredType;
|
|
58922
59045
|
}
|
|
@@ -59012,8 +59135,7 @@ var ts;
|
|
|
59012
59135
|
}
|
|
59013
59136
|
function narrowTypeByTruthiness(type, expr, assumeTrue) {
|
|
59014
59137
|
if (isMatchingReference(reference, expr)) {
|
|
59015
|
-
return type
|
|
59016
|
-
getTypeWithFacts(type, assumeTrue ? 4194304 : 8388608);
|
|
59138
|
+
return getIntersectionWithFacts(type, assumeTrue ? 4194304 : 8388608);
|
|
59017
59139
|
}
|
|
59018
59140
|
if (strictNullChecks && assumeTrue && optionalChainContainsReference(expr, reference)) {
|
|
59019
59141
|
type = getTypeWithFacts(type, 2097152);
|
|
@@ -59153,9 +59275,6 @@ var ts;
|
|
|
59153
59275
|
assumeTrue = !assumeTrue;
|
|
59154
59276
|
}
|
|
59155
59277
|
var valueType = getTypeOfExpression(value);
|
|
59156
|
-
if (assumeTrue && (type.flags & 2) && (operator === 34 || operator === 35) && (valueType.flags & 65536)) {
|
|
59157
|
-
return getUnionType([nullType, undefinedType]);
|
|
59158
|
-
}
|
|
59159
59278
|
if ((type.flags & 2) && assumeTrue && (operator === 36 || operator === 37)) {
|
|
59160
59279
|
if (valueType.flags & (131068 | 67108864)) {
|
|
59161
59280
|
return valueType;
|
|
@@ -59175,7 +59294,7 @@ var ts;
|
|
|
59175
59294
|
valueType.flags & 65536 ?
|
|
59176
59295
|
assumeTrue ? 131072 : 1048576 :
|
|
59177
59296
|
assumeTrue ? 65536 : 524288;
|
|
59178
|
-
return
|
|
59297
|
+
return getIntersectionWithFacts(type, facts);
|
|
59179
59298
|
}
|
|
59180
59299
|
if (assumeTrue) {
|
|
59181
59300
|
var filterFn = operator === 34 ?
|
|
@@ -59202,14 +59321,11 @@ var ts;
|
|
|
59202
59321
|
if (type.flags & 1 && literal.text === "function") {
|
|
59203
59322
|
return type;
|
|
59204
59323
|
}
|
|
59205
|
-
if (assumeTrue && type.flags & 2 && literal.text === "object") {
|
|
59206
|
-
return type === nonNullUnknownType ? nonPrimitiveType : getUnionType([nonPrimitiveType, nullType]);
|
|
59207
|
-
}
|
|
59208
59324
|
var facts = assumeTrue ?
|
|
59209
59325
|
typeofEQFacts.get(literal.text) || 128 :
|
|
59210
59326
|
typeofNEFacts.get(literal.text) || 32768;
|
|
59211
59327
|
var impliedType = getImpliedTypeFromTypeofGuard(type, literal.text);
|
|
59212
|
-
return getTypeWithFacts(assumeTrue && impliedType ?
|
|
59328
|
+
return getTypeWithFacts(assumeTrue && impliedType ? narrowTypeByImpliedType(type, impliedType) : type, facts);
|
|
59213
59329
|
}
|
|
59214
59330
|
function narrowTypeBySwitchOptionalChainContainment(type, switchStatement, clauseStart, clauseEnd, clauseCheck) {
|
|
59215
59331
|
var everyClauseChecks = clauseStart !== clauseEnd && ts.every(getSwitchClauseTypes(switchStatement).slice(clauseStart, clauseEnd), clauseCheck);
|
|
@@ -59254,30 +59370,35 @@ var ts;
|
|
|
59254
59370
|
}
|
|
59255
59371
|
function getImpliedTypeFromTypeofGuard(type, text) {
|
|
59256
59372
|
switch (text) {
|
|
59373
|
+
case "object":
|
|
59374
|
+
return type.flags & 1 ? type : getUnionType([nullType, nonPrimitiveType]);
|
|
59257
59375
|
case "function":
|
|
59258
59376
|
return type.flags & 1 ? type : globalFunctionType;
|
|
59259
|
-
case "object":
|
|
59260
|
-
return type.flags & 2 ? getUnionType([nonPrimitiveType, nullType]) : type;
|
|
59261
59377
|
default:
|
|
59262
59378
|
return typeofTypesByName.get(text);
|
|
59263
59379
|
}
|
|
59264
59380
|
}
|
|
59265
|
-
function
|
|
59266
|
-
|
|
59267
|
-
|
|
59268
|
-
|
|
59269
|
-
|
|
59270
|
-
if (
|
|
59271
|
-
return
|
|
59381
|
+
function narrowTypeByImpliedType(type, candidate) {
|
|
59382
|
+
if (type.flags & 3) {
|
|
59383
|
+
return candidate;
|
|
59384
|
+
}
|
|
59385
|
+
return mapType(type, function (t) {
|
|
59386
|
+
if (isTypeRelatedTo(t, candidate, strictSubtypeRelation)) {
|
|
59387
|
+
return t;
|
|
59272
59388
|
}
|
|
59273
|
-
|
|
59274
|
-
|
|
59275
|
-
|
|
59276
|
-
return getIntersectionType([type, candidate]);
|
|
59389
|
+
return mapType(candidate, function (c) {
|
|
59390
|
+
if (!areTypesComparable(t, c)) {
|
|
59391
|
+
return neverType;
|
|
59277
59392
|
}
|
|
59278
|
-
|
|
59279
|
-
|
|
59280
|
-
|
|
59393
|
+
if (c.flags & 131068 && t.flags & 524288 && !isEmptyAnonymousObjectType(t)) {
|
|
59394
|
+
return isTypeSubtypeOf(c, t) ? c : neverType;
|
|
59395
|
+
}
|
|
59396
|
+
if (c === globalFunctionType && isTypeSubtypeOf(c, t)) {
|
|
59397
|
+
return c;
|
|
59398
|
+
}
|
|
59399
|
+
return getIntersectionType([t, c]);
|
|
59400
|
+
});
|
|
59401
|
+
});
|
|
59281
59402
|
}
|
|
59282
59403
|
function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
59283
59404
|
var switchWitnesses = getSwitchClauseTypeOfWitnesses(switchStatement, true);
|
|
@@ -59303,7 +59424,7 @@ var ts;
|
|
|
59303
59424
|
return filterType(type, function (t) { return (getTypeFacts(t) & switchFacts) === switchFacts; });
|
|
59304
59425
|
}
|
|
59305
59426
|
var impliedType = getTypeWithFacts(getUnionType(clauseWitnesses.map(function (text) { return getImpliedTypeFromTypeofGuard(type, text) || type; })), switchFacts);
|
|
59306
|
-
return getTypeWithFacts(
|
|
59427
|
+
return getTypeWithFacts(narrowTypeByImpliedType(type, impliedType), switchFacts);
|
|
59307
59428
|
}
|
|
59308
59429
|
function isMatchingConstructorReference(expr) {
|
|
59309
59430
|
return (ts.isPropertyAccessExpression(expr) && ts.idText(expr.name) === "constructor" ||
|
|
@@ -59564,7 +59685,9 @@ var ts;
|
|
|
59564
59685
|
!(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression)));
|
|
59565
59686
|
}
|
|
59566
59687
|
function isGenericTypeWithUnionConstraint(type) {
|
|
59567
|
-
return
|
|
59688
|
+
return type.flags & 2097152 ?
|
|
59689
|
+
ts.some(type.types, isGenericTypeWithUnionConstraint) :
|
|
59690
|
+
!!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576));
|
|
59568
59691
|
}
|
|
59569
59692
|
function isGenericTypeWithoutNullableConstraint(type) {
|
|
59570
59693
|
return !!(type.flags & 465829888 && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304));
|
|
@@ -59581,7 +59704,7 @@ var ts;
|
|
|
59581
59704
|
var substituteConstraints = !(checkMode && checkMode & 2) &&
|
|
59582
59705
|
someType(type, isGenericTypeWithUnionConstraint) &&
|
|
59583
59706
|
(isConstraintPosition(type, reference) || hasContextualTypeWithNoGenericTypes(reference, checkMode));
|
|
59584
|
-
return substituteConstraints ? mapType(type,
|
|
59707
|
+
return substituteConstraints ? mapType(type, getBaseConstraintOrType) : type;
|
|
59585
59708
|
}
|
|
59586
59709
|
function isExportOrExportExpression(location) {
|
|
59587
59710
|
return !!ts.findAncestor(location, function (n) {
|
|
@@ -63211,7 +63334,7 @@ var ts;
|
|
|
63211
63334
|
var spreadIndex = getSpreadArgumentIndex(args);
|
|
63212
63335
|
if (spreadIndex >= 0) {
|
|
63213
63336
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
63214
|
-
var
|
|
63337
|
+
var _loop_25 = function (i) {
|
|
63215
63338
|
var arg = args[i];
|
|
63216
63339
|
var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
63217
63340
|
if (spreadType && isTupleType(spreadType)) {
|
|
@@ -63227,7 +63350,7 @@ var ts;
|
|
|
63227
63350
|
}
|
|
63228
63351
|
};
|
|
63229
63352
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
63230
|
-
|
|
63353
|
+
_loop_25(i);
|
|
63231
63354
|
}
|
|
63232
63355
|
return effectiveArgs_1;
|
|
63233
63356
|
}
|
|
@@ -63475,7 +63598,7 @@ var ts;
|
|
|
63475
63598
|
var min_3 = Number.MAX_VALUE;
|
|
63476
63599
|
var minIndex = 0;
|
|
63477
63600
|
var i_1 = 0;
|
|
63478
|
-
var
|
|
63601
|
+
var _loop_26 = function (c) {
|
|
63479
63602
|
var chain_2 = function () { return ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
63480
63603
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0, true, chain_2);
|
|
63481
63604
|
if (diags_2) {
|
|
@@ -63493,7 +63616,7 @@ var ts;
|
|
|
63493
63616
|
};
|
|
63494
63617
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
63495
63618
|
var c = candidatesForArgumentError_1[_a];
|
|
63496
|
-
|
|
63619
|
+
_loop_26(c);
|
|
63497
63620
|
}
|
|
63498
63621
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
63499
63622
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -63636,7 +63759,7 @@ var ts;
|
|
|
63636
63759
|
}
|
|
63637
63760
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
63638
63761
|
var parameters = [];
|
|
63639
|
-
var
|
|
63762
|
+
var _loop_27 = function (i) {
|
|
63640
63763
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
63641
63764
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
63642
63765
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -63644,7 +63767,7 @@ var ts;
|
|
|
63644
63767
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
63645
63768
|
};
|
|
63646
63769
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
63647
|
-
|
|
63770
|
+
_loop_27(i);
|
|
63648
63771
|
}
|
|
63649
63772
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
63650
63773
|
var flags = 0;
|
|
@@ -67240,7 +67363,7 @@ var ts;
|
|
|
67240
67363
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
67241
67364
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
67242
67365
|
var indexSignatureMap_1 = new ts.Map();
|
|
67243
|
-
var
|
|
67366
|
+
var _loop_28 = function (declaration) {
|
|
67244
67367
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
67245
67368
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
67246
67369
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -67255,7 +67378,7 @@ var ts;
|
|
|
67255
67378
|
};
|
|
67256
67379
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
67257
67380
|
var declaration = _a[_i];
|
|
67258
|
-
|
|
67381
|
+
_loop_28(declaration);
|
|
67259
67382
|
}
|
|
67260
67383
|
indexSignatureMap_1.forEach(function (entry) {
|
|
67261
67384
|
if (entry.declarations.length > 1) {
|
|
@@ -69081,7 +69204,7 @@ var ts;
|
|
|
69081
69204
|
return;
|
|
69082
69205
|
}
|
|
69083
69206
|
var symbol = getSymbolOfNode(node);
|
|
69084
|
-
if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node)) {
|
|
69207
|
+
if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) {
|
|
69085
69208
|
checkAliasSymbol(node);
|
|
69086
69209
|
return;
|
|
69087
69210
|
}
|
|
@@ -70075,7 +70198,7 @@ var ts;
|
|
|
70075
70198
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
|
|
70076
70199
|
var localPropDeclaration = declaration && declaration.kind === 221 ||
|
|
70077
70200
|
name && name.kind === 162 || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
70078
|
-
var
|
|
70201
|
+
var _loop_29 = function (info) {
|
|
70079
70202
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
70080
70203
|
var errorNode = localPropDeclaration || localIndexDeclaration ||
|
|
70081
70204
|
(interfaceDeclaration && !ts.some(getBaseTypes(type), function (base) { return !!getPropertyOfObjectType(base, prop.escapedName) && !!getIndexTypeOfType(base, info.keyType); }) ? interfaceDeclaration : undefined);
|
|
@@ -70085,7 +70208,7 @@ var ts;
|
|
|
70085
70208
|
};
|
|
70086
70209
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
70087
70210
|
var info = indexInfos_9[_i];
|
|
70088
|
-
|
|
70211
|
+
_loop_29(info);
|
|
70089
70212
|
}
|
|
70090
70213
|
}
|
|
70091
70214
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -70093,7 +70216,7 @@ var ts;
|
|
|
70093
70216
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
70094
70217
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined;
|
|
70095
70218
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
70096
|
-
var
|
|
70219
|
+
var _loop_30 = function (info) {
|
|
70097
70220
|
if (info === checkInfo)
|
|
70098
70221
|
return "continue";
|
|
70099
70222
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -70105,7 +70228,7 @@ var ts;
|
|
|
70105
70228
|
};
|
|
70106
70229
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
70107
70230
|
var info = indexInfos_10[_i];
|
|
70108
|
-
|
|
70231
|
+
_loop_30(info);
|
|
70109
70232
|
}
|
|
70110
70233
|
}
|
|
70111
70234
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -70399,7 +70522,7 @@ var ts;
|
|
|
70399
70522
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
70400
70523
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
70401
70524
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
70402
|
-
var
|
|
70525
|
+
var _loop_31 = function (member) {
|
|
70403
70526
|
if (ts.hasAmbientModifier(member)) {
|
|
70404
70527
|
return "continue";
|
|
70405
70528
|
}
|
|
@@ -70414,7 +70537,7 @@ var ts;
|
|
|
70414
70537
|
};
|
|
70415
70538
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
70416
70539
|
var member = _a[_i];
|
|
70417
|
-
|
|
70540
|
+
_loop_31(member);
|
|
70418
70541
|
}
|
|
70419
70542
|
}
|
|
70420
70543
|
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
|
|
@@ -70489,7 +70612,7 @@ var ts;
|
|
|
70489
70612
|
}
|
|
70490
70613
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
70491
70614
|
var issuedMemberError = false;
|
|
70492
|
-
var
|
|
70615
|
+
var _loop_32 = function (member) {
|
|
70493
70616
|
if (ts.isStatic(member)) {
|
|
70494
70617
|
return "continue";
|
|
70495
70618
|
}
|
|
@@ -70507,7 +70630,7 @@ var ts;
|
|
|
70507
70630
|
};
|
|
70508
70631
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
70509
70632
|
var member = _a[_i];
|
|
70510
|
-
|
|
70633
|
+
_loop_32(member);
|
|
70511
70634
|
}
|
|
70512
70635
|
if (!issuedMemberError) {
|
|
70513
70636
|
checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
|
|
@@ -100999,7 +101122,7 @@ var ts;
|
|
|
100999
101122
|
importedFileFromNodeModules = importedFileFromNodeModules || isInNodeModules;
|
|
101000
101123
|
});
|
|
101001
101124
|
var sortedPaths = [];
|
|
101002
|
-
var
|
|
101125
|
+
var _loop_33 = function (directory) {
|
|
101003
101126
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
101004
101127
|
var pathsInDirectory;
|
|
101005
101128
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -101023,7 +101146,7 @@ var ts;
|
|
|
101023
101146
|
};
|
|
101024
101147
|
var out_directory_1;
|
|
101025
101148
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
101026
|
-
var state_10 =
|
|
101149
|
+
var state_10 = _loop_33(directory);
|
|
101027
101150
|
directory = out_directory_1;
|
|
101028
101151
|
if (state_10 === "break")
|
|
101029
101152
|
break;
|