typescript 4.9.0-dev.20221013 → 4.9.0-dev.20221015
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 +145 -128
- package/lib/tsserver.js +317 -168
- package/lib/tsserverlibrary.js +317 -168
- package/lib/typescript.js +317 -168
- package/lib/typescriptServices.js +317 -168
- package/lib/typingsInstaller.js +166 -155
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
92
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221015");
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -9584,6 +9584,10 @@ var ts;
|
|
|
9584
9584
|
Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"),
|
|
9585
9585
|
Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"),
|
|
9586
9586
|
Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"),
|
|
9587
|
+
Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."),
|
|
9588
|
+
Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."),
|
|
9589
|
+
Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."),
|
|
9590
|
+
Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."),
|
|
9587
9591
|
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
|
|
9588
9592
|
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
|
|
9589
9593
|
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
|
|
@@ -9900,6 +9904,8 @@ var ts;
|
|
|
9900
9904
|
Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""),
|
|
9901
9905
|
Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""),
|
|
9902
9906
|
Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""),
|
|
9907
|
+
Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"),
|
|
9908
|
+
Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"),
|
|
9903
9909
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9904
9910
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9905
9911
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -21660,6 +21666,32 @@ var ts;
|
|
|
21660
21666
|
return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type;
|
|
21661
21667
|
}
|
|
21662
21668
|
ts.getParameterTypeNode = getParameterTypeNode;
|
|
21669
|
+
function isTypeDeclaration(node) {
|
|
21670
|
+
switch (node.kind) {
|
|
21671
|
+
case 165 /* SyntaxKind.TypeParameter */:
|
|
21672
|
+
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
21673
|
+
case 261 /* SyntaxKind.InterfaceDeclaration */:
|
|
21674
|
+
case 262 /* SyntaxKind.TypeAliasDeclaration */:
|
|
21675
|
+
case 263 /* SyntaxKind.EnumDeclaration */:
|
|
21676
|
+
case 348 /* SyntaxKind.JSDocTypedefTag */:
|
|
21677
|
+
case 341 /* SyntaxKind.JSDocCallbackTag */:
|
|
21678
|
+
case 342 /* SyntaxKind.JSDocEnumTag */:
|
|
21679
|
+
return true;
|
|
21680
|
+
case 270 /* SyntaxKind.ImportClause */:
|
|
21681
|
+
return node.isTypeOnly;
|
|
21682
|
+
case 273 /* SyntaxKind.ImportSpecifier */:
|
|
21683
|
+
case 278 /* SyntaxKind.ExportSpecifier */:
|
|
21684
|
+
return node.parent.parent.isTypeOnly;
|
|
21685
|
+
default:
|
|
21686
|
+
return false;
|
|
21687
|
+
}
|
|
21688
|
+
}
|
|
21689
|
+
ts.isTypeDeclaration = isTypeDeclaration;
|
|
21690
|
+
function canHaveExportModifier(node) {
|
|
21691
|
+
return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)
|
|
21692
|
+
|| ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node));
|
|
21693
|
+
}
|
|
21694
|
+
ts.canHaveExportModifier = canHaveExportModifier;
|
|
21663
21695
|
})(ts || (ts = {}));
|
|
21664
21696
|
/* @internal */
|
|
21665
21697
|
var ts;
|
|
@@ -44284,6 +44316,9 @@ var ts;
|
|
|
44284
44316
|
requestContainingDirectory: containingDirectory,
|
|
44285
44317
|
reportDiagnostic: function (diag) { return void diagnostics.push(diag); },
|
|
44286
44318
|
};
|
|
44319
|
+
if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) {
|
|
44320
|
+
trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", "));
|
|
44321
|
+
}
|
|
44287
44322
|
var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); });
|
|
44288
44323
|
return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache);
|
|
44289
44324
|
function tryResolve(extensions) {
|
|
@@ -44873,7 +44908,7 @@ var ts;
|
|
|
44873
44908
|
}
|
|
44874
44909
|
if (mainExport) {
|
|
44875
44910
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false);
|
|
44876
|
-
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false);
|
|
44911
|
+
return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, ".");
|
|
44877
44912
|
}
|
|
44878
44913
|
}
|
|
44879
44914
|
else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) {
|
|
@@ -44953,7 +44988,7 @@ var ts;
|
|
|
44953
44988
|
var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports);
|
|
44954
44989
|
if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) {
|
|
44955
44990
|
var target = lookupTable[moduleName];
|
|
44956
|
-
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false);
|
|
44991
|
+
return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName);
|
|
44957
44992
|
}
|
|
44958
44993
|
var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys);
|
|
44959
44994
|
for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) {
|
|
@@ -44962,17 +44997,17 @@ var ts;
|
|
|
44962
44997
|
var target = lookupTable[potentialTarget];
|
|
44963
44998
|
var starPos = potentialTarget.indexOf("*");
|
|
44964
44999
|
var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos));
|
|
44965
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
45000
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
|
|
44966
45001
|
}
|
|
44967
45002
|
else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) {
|
|
44968
45003
|
var target = lookupTable[potentialTarget];
|
|
44969
45004
|
var subpath = moduleName.substring(potentialTarget.length - 1);
|
|
44970
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true);
|
|
45005
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget);
|
|
44971
45006
|
}
|
|
44972
45007
|
else if (ts.startsWith(moduleName, potentialTarget)) {
|
|
44973
45008
|
var target = lookupTable[potentialTarget];
|
|
44974
45009
|
var subpath = moduleName.substring(potentialTarget.length);
|
|
44975
|
-
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false);
|
|
45010
|
+
return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget);
|
|
44976
45011
|
}
|
|
44977
45012
|
}
|
|
44978
45013
|
function matchesPatternWithTrailer(target, name) {
|
|
@@ -44989,7 +45024,7 @@ var ts;
|
|
|
44989
45024
|
*/
|
|
44990
45025
|
function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) {
|
|
44991
45026
|
return loadModuleFromTargetImportOrExport;
|
|
44992
|
-
function loadModuleFromTargetImportOrExport(target, subpath, pattern) {
|
|
45027
|
+
function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) {
|
|
44993
45028
|
if (typeof target === "string") {
|
|
44994
45029
|
if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) {
|
|
44995
45030
|
if (state.traceEnabled) {
|
|
@@ -45000,6 +45035,8 @@ var ts;
|
|
|
45000
45035
|
if (!ts.startsWith(target, "./")) {
|
|
45001
45036
|
if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) {
|
|
45002
45037
|
var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath;
|
|
45038
|
+
traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup);
|
|
45039
|
+
traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/");
|
|
45003
45040
|
var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference);
|
|
45004
45041
|
return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined);
|
|
45005
45042
|
}
|
|
@@ -45026,6 +45063,9 @@ var ts;
|
|
|
45026
45063
|
}
|
|
45027
45064
|
return toSearchResult(/*value*/ undefined);
|
|
45028
45065
|
}
|
|
45066
|
+
if (state.traceEnabled) {
|
|
45067
|
+
trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath);
|
|
45068
|
+
}
|
|
45029
45069
|
var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath);
|
|
45030
45070
|
var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports);
|
|
45031
45071
|
if (inputLink)
|
|
@@ -45035,14 +45075,18 @@ var ts;
|
|
|
45035
45075
|
else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null
|
|
45036
45076
|
if (!Array.isArray(target)) {
|
|
45037
45077
|
for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) {
|
|
45038
|
-
var
|
|
45039
|
-
if (
|
|
45040
|
-
|
|
45041
|
-
var
|
|
45078
|
+
var condition = _a[_i];
|
|
45079
|
+
if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) {
|
|
45080
|
+
traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition);
|
|
45081
|
+
var subTarget = target[condition];
|
|
45082
|
+
var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key);
|
|
45042
45083
|
if (result) {
|
|
45043
45084
|
return result;
|
|
45044
45085
|
}
|
|
45045
45086
|
}
|
|
45087
|
+
else {
|
|
45088
|
+
traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition);
|
|
45089
|
+
}
|
|
45046
45090
|
}
|
|
45047
45091
|
return undefined;
|
|
45048
45092
|
}
|
|
@@ -45055,7 +45099,7 @@ var ts;
|
|
|
45055
45099
|
}
|
|
45056
45100
|
for (var _b = 0, target_2 = target; _b < target_2.length; _b++) {
|
|
45057
45101
|
var elem = target_2[_b];
|
|
45058
|
-
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern);
|
|
45102
|
+
var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key);
|
|
45059
45103
|
if (result) {
|
|
45060
45104
|
return result;
|
|
45061
45105
|
}
|
|
@@ -45471,6 +45515,15 @@ var ts;
|
|
|
45471
45515
|
function toSearchResult(value) {
|
|
45472
45516
|
return value !== undefined ? { value: value } : undefined;
|
|
45473
45517
|
}
|
|
45518
|
+
function traceIfEnabled(state, diagnostic) {
|
|
45519
|
+
var args = [];
|
|
45520
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
45521
|
+
args[_i - 2] = arguments[_i];
|
|
45522
|
+
}
|
|
45523
|
+
if (state.traceEnabled) {
|
|
45524
|
+
trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false));
|
|
45525
|
+
}
|
|
45526
|
+
}
|
|
45474
45527
|
})(ts || (ts = {}));
|
|
45475
45528
|
/* @internal */
|
|
45476
45529
|
var ts;
|
|
@@ -49062,8 +49115,6 @@ var ts;
|
|
|
49062
49115
|
IntersectionState[IntersectionState["None"] = 0] = "None";
|
|
49063
49116
|
IntersectionState[IntersectionState["Source"] = 1] = "Source";
|
|
49064
49117
|
IntersectionState[IntersectionState["Target"] = 2] = "Target";
|
|
49065
|
-
IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck";
|
|
49066
|
-
IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck";
|
|
49067
49118
|
})(IntersectionState || (IntersectionState = {}));
|
|
49068
49119
|
var RecursionFlags;
|
|
49069
49120
|
(function (RecursionFlags) {
|
|
@@ -55405,7 +55456,7 @@ var ts;
|
|
|
55405
55456
|
// export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it
|
|
55406
55457
|
var indices = ts.indicesOf(statements);
|
|
55407
55458
|
var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); });
|
|
55408
|
-
if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) {
|
|
55459
|
+
if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) {
|
|
55409
55460
|
for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) {
|
|
55410
55461
|
var index_1 = associatedIndices_1[_i];
|
|
55411
55462
|
statements[index_1] = addExportModifier(statements[index_1]);
|
|
@@ -55439,15 +55490,6 @@ var ts;
|
|
|
55439
55490
|
}
|
|
55440
55491
|
return statements;
|
|
55441
55492
|
}
|
|
55442
|
-
function canHaveExportModifier(node) {
|
|
55443
|
-
return ts.isEnumDeclaration(node) ||
|
|
55444
|
-
ts.isVariableStatement(node) ||
|
|
55445
|
-
ts.isFunctionDeclaration(node) ||
|
|
55446
|
-
ts.isClassDeclaration(node) ||
|
|
55447
|
-
(ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) ||
|
|
55448
|
-
ts.isInterfaceDeclaration(node) ||
|
|
55449
|
-
isTypeDeclaration(node);
|
|
55450
|
-
}
|
|
55451
55493
|
function addExportModifier(node) {
|
|
55452
55494
|
var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */;
|
|
55453
55495
|
return ts.factory.updateModifiers(node, flags);
|
|
@@ -55694,7 +55736,7 @@ var ts;
|
|
|
55694
55736
|
(ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration);
|
|
55695
55737
|
if (additionalModifierFlags & 1 /* ModifierFlags.Export */ &&
|
|
55696
55738
|
enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) &&
|
|
55697
|
-
canHaveExportModifier(node)) {
|
|
55739
|
+
ts.canHaveExportModifier(node)) {
|
|
55698
55740
|
// Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private
|
|
55699
55741
|
newModifierFlags |= 1 /* ModifierFlags.Export */;
|
|
55700
55742
|
}
|
|
@@ -63821,18 +63863,23 @@ var ts;
|
|
|
63821
63863
|
var result;
|
|
63822
63864
|
var extraTypes;
|
|
63823
63865
|
var tailCount = 0;
|
|
63824
|
-
|
|
63866
|
+
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
63867
|
+
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
63868
|
+
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
63869
|
+
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63870
|
+
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63871
|
+
while (true) {
|
|
63825
63872
|
if (tailCount === 1000) {
|
|
63826
63873
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
63827
63874
|
result = errorType;
|
|
63828
|
-
|
|
63875
|
+
break;
|
|
63829
63876
|
}
|
|
63830
63877
|
var isUnwrapped = isTypicalNondistributiveConditional(root);
|
|
63831
63878
|
var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
|
|
63832
63879
|
var checkTypeInstantiable = isGenericType(checkType);
|
|
63833
63880
|
var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
|
|
63834
63881
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
63835
|
-
return
|
|
63882
|
+
return wildcardType;
|
|
63836
63883
|
}
|
|
63837
63884
|
var combinedMapper = void 0;
|
|
63838
63885
|
if (root.inferTypeParameters) {
|
|
@@ -63865,11 +63912,7 @@ var ts;
|
|
|
63865
63912
|
}
|
|
63866
63913
|
}
|
|
63867
63914
|
}
|
|
63868
|
-
|
|
63869
|
-
// if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
|
|
63870
|
-
// "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
|
|
63871
|
-
// so in those cases we refain from performing inference and retain the uninfered type parameter
|
|
63872
|
-
if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
|
|
63915
|
+
if (!checkTypeInstantiable) {
|
|
63873
63916
|
// We don't want inferences from constraints as they may cause us to eagerly resolve the
|
|
63874
63917
|
// conditional type instead of deferring resolution. Also, we always want strict function
|
|
63875
63918
|
// types rules (i.e. proper contravariance) for inferences.
|
|
@@ -63901,14 +63944,14 @@ var ts;
|
|
|
63901
63944
|
var newRoot = falseType_1.root;
|
|
63902
63945
|
if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
|
|
63903
63946
|
root = newRoot;
|
|
63904
|
-
|
|
63947
|
+
continue;
|
|
63905
63948
|
}
|
|
63906
63949
|
if (canTailRecurse(falseType_1, mapper)) {
|
|
63907
|
-
|
|
63950
|
+
continue;
|
|
63908
63951
|
}
|
|
63909
63952
|
}
|
|
63910
63953
|
result = instantiateType(falseType_1, mapper);
|
|
63911
|
-
|
|
63954
|
+
break;
|
|
63912
63955
|
}
|
|
63913
63956
|
// Return trueType for a definitely true extends check. We check instantiations of the two
|
|
63914
63957
|
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
|
|
@@ -63919,10 +63962,10 @@ var ts;
|
|
|
63919
63962
|
var trueType_1 = getTypeFromTypeNode(root.node.trueType);
|
|
63920
63963
|
var trueMapper = combinedMapper || mapper;
|
|
63921
63964
|
if (canTailRecurse(trueType_1, trueMapper)) {
|
|
63922
|
-
|
|
63965
|
+
continue;
|
|
63923
63966
|
}
|
|
63924
63967
|
result = instantiateType(trueType_1, trueMapper);
|
|
63925
|
-
|
|
63968
|
+
break;
|
|
63926
63969
|
}
|
|
63927
63970
|
}
|
|
63928
63971
|
// Return a deferred type for a check that is neither definitely true nor definitely false
|
|
@@ -63934,19 +63977,7 @@ var ts;
|
|
|
63934
63977
|
result.combinedMapper = combinedMapper;
|
|
63935
63978
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
63936
63979
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
63937
|
-
|
|
63938
|
-
};
|
|
63939
|
-
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
63940
|
-
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
63941
|
-
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
63942
|
-
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
63943
|
-
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
63944
|
-
while (true) {
|
|
63945
|
-
var state_6 = _loop_20();
|
|
63946
|
-
if (typeof state_6 === "object")
|
|
63947
|
-
return state_6.value;
|
|
63948
|
-
if (state_6 === "break")
|
|
63949
|
-
break;
|
|
63980
|
+
break;
|
|
63950
63981
|
}
|
|
63951
63982
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
63952
63983
|
// We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
|
|
@@ -66400,7 +66431,7 @@ var ts;
|
|
|
66400
66431
|
return 0 /* Ternary.False */;
|
|
66401
66432
|
}
|
|
66402
66433
|
}
|
|
66403
|
-
var isPerformingCommonPropertyChecks = (relation !== comparableRelation ||
|
|
66434
|
+
var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) &&
|
|
66404
66435
|
!(intersectionState & 2 /* IntersectionState.Target */) &&
|
|
66405
66436
|
source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType &&
|
|
66406
66437
|
target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) &&
|
|
@@ -66428,27 +66459,6 @@ var ts;
|
|
|
66428
66459
|
var result_7 = skipCaching ?
|
|
66429
66460
|
unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) :
|
|
66430
66461
|
recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags);
|
|
66431
|
-
// For certain combinations involving intersections and optional, excess, or mismatched properties we need
|
|
66432
|
-
// an extra property check where the intersection is viewed as a single object. The following are motivating
|
|
66433
|
-
// examples that all should be errors, but aren't without this extra property check:
|
|
66434
|
-
//
|
|
66435
|
-
// let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
|
|
66436
|
-
//
|
|
66437
|
-
// declare let wrong: { a: { y: string } };
|
|
66438
|
-
// let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
|
|
66439
|
-
//
|
|
66440
|
-
// function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
|
|
66441
|
-
// x = y; // Mismatched property in source intersection
|
|
66442
|
-
// }
|
|
66443
|
-
//
|
|
66444
|
-
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
66445
|
-
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
66446
|
-
if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) ||
|
|
66447
|
-
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
|
|
66448
|
-
inPropertyCheck = true;
|
|
66449
|
-
result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags);
|
|
66450
|
-
inPropertyCheck = false;
|
|
66451
|
-
}
|
|
66452
66462
|
if (result_7) {
|
|
66453
66463
|
return result_7;
|
|
66454
66464
|
}
|
|
@@ -66560,7 +66570,7 @@ var ts;
|
|
|
66560
66570
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
66561
66571
|
checkTypes = reducedTarget.flags & 1048576 /* TypeFlags.Union */ ? reducedTarget.types : [reducedTarget];
|
|
66562
66572
|
}
|
|
66563
|
-
var
|
|
66573
|
+
var _loop_20 = function (prop) {
|
|
66564
66574
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
66565
66575
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
66566
66576
|
if (reportErrors) {
|
|
@@ -66623,9 +66633,9 @@ var ts;
|
|
|
66623
66633
|
};
|
|
66624
66634
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
66625
66635
|
var prop = _b[_i];
|
|
66626
|
-
var
|
|
66627
|
-
if (typeof
|
|
66628
|
-
return
|
|
66636
|
+
var state_6 = _loop_20(prop);
|
|
66637
|
+
if (typeof state_6 === "object")
|
|
66638
|
+
return state_6.value;
|
|
66629
66639
|
}
|
|
66630
66640
|
return false;
|
|
66631
66641
|
}
|
|
@@ -66846,8 +66856,7 @@ var ts;
|
|
|
66846
66856
|
if (overflow) {
|
|
66847
66857
|
return 0 /* Ternary.False */;
|
|
66848
66858
|
}
|
|
66849
|
-
var
|
|
66850
|
-
var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false);
|
|
66859
|
+
var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false);
|
|
66851
66860
|
var entry = relation.get(id);
|
|
66852
66861
|
if (entry !== undefined) {
|
|
66853
66862
|
if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) {
|
|
@@ -66877,7 +66886,7 @@ var ts;
|
|
|
66877
66886
|
// A key that starts with "*" is an indication that we have type references that reference constrained
|
|
66878
66887
|
// type parameters. For such keys we also check against the key we would have gotten if all type parameters
|
|
66879
66888
|
// were unconstrained.
|
|
66880
|
-
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target,
|
|
66889
|
+
var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined;
|
|
66881
66890
|
for (var i = 0; i < maybeCount; i++) {
|
|
66882
66891
|
// If source and target are already being compared, consider them related with assumptions
|
|
66883
66892
|
if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) {
|
|
@@ -66964,7 +66973,7 @@ var ts;
|
|
|
66964
66973
|
function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) {
|
|
66965
66974
|
var saveErrorInfo = captureErrorCalculationState();
|
|
66966
66975
|
var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo);
|
|
66967
|
-
if (
|
|
66976
|
+
if (relation !== identityRelation) {
|
|
66968
66977
|
// The combined constraint of an intersection type is the intersection of the constraints of
|
|
66969
66978
|
// the constituents. When an intersection type contains instantiable types with union type
|
|
66970
66979
|
// constraints, there are situations where we need to examine the combined constraint. One is
|
|
@@ -66978,10 +66987,33 @@ var ts;
|
|
|
66978
66987
|
// needs to have its constraint hoisted into an intersection with said type parameter, this way
|
|
66979
66988
|
// the type param can be compared with itself in the target (with the influence of its constraint to match other parts)
|
|
66980
66989
|
// For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)`
|
|
66981
|
-
|
|
66982
|
-
|
|
66983
|
-
|
|
66984
|
-
|
|
66990
|
+
if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) {
|
|
66991
|
+
var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */));
|
|
66992
|
+
if (constraint && !(constraint.flags & 131072 /* TypeFlags.Never */) && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself
|
|
66993
|
+
// TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this
|
|
66994
|
+
result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState);
|
|
66995
|
+
}
|
|
66996
|
+
}
|
|
66997
|
+
// For certain combinations involving intersections and optional, excess, or mismatched properties we need
|
|
66998
|
+
// an extra property check where the intersection is viewed as a single object. The following are motivating
|
|
66999
|
+
// examples that all should be errors, but aren't without this extra property check:
|
|
67000
|
+
//
|
|
67001
|
+
// let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property
|
|
67002
|
+
//
|
|
67003
|
+
// declare let wrong: { a: { y: string } };
|
|
67004
|
+
// let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type
|
|
67005
|
+
//
|
|
67006
|
+
// function foo<T extends object>(x: { a?: string }, y: T & { a: boolean }) {
|
|
67007
|
+
// x = y; // Mismatched property in source intersection
|
|
67008
|
+
// }
|
|
67009
|
+
//
|
|
67010
|
+
// We suppress recursive intersection property checks because they can generate lots of work when relating
|
|
67011
|
+
// recursive intersections that are structurally similar but not exactly identical. See #37854.
|
|
67012
|
+
if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) ||
|
|
67013
|
+
isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) {
|
|
67014
|
+
inPropertyCheck = true;
|
|
67015
|
+
result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
|
|
67016
|
+
inPropertyCheck = false;
|
|
66985
67017
|
}
|
|
66986
67018
|
}
|
|
66987
67019
|
if (result) {
|
|
@@ -66990,9 +67022,6 @@ var ts;
|
|
|
66990
67022
|
return result;
|
|
66991
67023
|
}
|
|
66992
67024
|
function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) {
|
|
66993
|
-
if (intersectionState & 4 /* IntersectionState.PropertyCheck */) {
|
|
66994
|
-
return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */);
|
|
66995
|
-
}
|
|
66996
67025
|
var result;
|
|
66997
67026
|
var originalErrorInfo;
|
|
66998
67027
|
var varianceCheckFailed = false;
|
|
@@ -67616,11 +67645,11 @@ var ts;
|
|
|
67616
67645
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
67617
67646
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
67618
67647
|
var matchingTypes = [];
|
|
67619
|
-
var
|
|
67648
|
+
var _loop_21 = function (combination) {
|
|
67620
67649
|
var hasMatch = false;
|
|
67621
67650
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
67622
67651
|
var type = _d[_c];
|
|
67623
|
-
var
|
|
67652
|
+
var _loop_22 = function (i) {
|
|
67624
67653
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
67625
67654
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
67626
67655
|
if (!targetProperty)
|
|
@@ -67636,8 +67665,8 @@ var ts;
|
|
|
67636
67665
|
}
|
|
67637
67666
|
};
|
|
67638
67667
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
67639
|
-
var
|
|
67640
|
-
switch (
|
|
67668
|
+
var state_8 = _loop_22(i);
|
|
67669
|
+
switch (state_8) {
|
|
67641
67670
|
case "continue-outer": continue outer;
|
|
67642
67671
|
}
|
|
67643
67672
|
}
|
|
@@ -67650,9 +67679,9 @@ var ts;
|
|
|
67650
67679
|
};
|
|
67651
67680
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
67652
67681
|
var combination = discriminantCombinations_1[_a];
|
|
67653
|
-
var
|
|
67654
|
-
if (typeof
|
|
67655
|
-
return
|
|
67682
|
+
var state_7 = _loop_21(combination);
|
|
67683
|
+
if (typeof state_7 === "object")
|
|
67684
|
+
return state_7.value;
|
|
67656
67685
|
}
|
|
67657
67686
|
// Compare the remaining non-discriminant properties of each match.
|
|
67658
67687
|
var result = -1 /* Ternary.True */;
|
|
@@ -68357,7 +68386,7 @@ var ts;
|
|
|
68357
68386
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* tracing.Phase.CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: getTypeId(getDeclaredTypeOfSymbol(symbol)) });
|
|
68358
68387
|
links.variances = ts.emptyArray;
|
|
68359
68388
|
var variances = [];
|
|
68360
|
-
var
|
|
68389
|
+
var _loop_23 = function (tp) {
|
|
68361
68390
|
var modifiers = getVarianceModifiers(tp);
|
|
68362
68391
|
var variance = modifiers & 65536 /* ModifierFlags.Out */ ?
|
|
68363
68392
|
modifiers & 32768 /* ModifierFlags.In */ ? 0 /* VarianceFlags.Invariant */ : 1 /* VarianceFlags.Covariant */ :
|
|
@@ -68395,7 +68424,7 @@ var ts;
|
|
|
68395
68424
|
};
|
|
68396
68425
|
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
|
|
68397
68426
|
var tp = typeParameters_2[_i];
|
|
68398
|
-
|
|
68427
|
+
_loop_23(tp);
|
|
68399
68428
|
}
|
|
68400
68429
|
links.variances = variances;
|
|
68401
68430
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop({ variances: variances.map(ts.Debug.formatVariance) });
|
|
@@ -70353,7 +70382,7 @@ var ts;
|
|
|
70353
70382
|
// upon instantiation, would collapse all the placeholders to just 'string', and an assignment check might
|
|
70354
70383
|
// succeed. That would be a pointless and confusing outcome.
|
|
70355
70384
|
if (matches || ts.every(target.texts, function (s) { return s.length === 0; })) {
|
|
70356
|
-
var
|
|
70385
|
+
var _loop_24 = function (i) {
|
|
70357
70386
|
var source_1 = matches ? matches[i] : neverType;
|
|
70358
70387
|
var target_3 = types[i];
|
|
70359
70388
|
// If we are inferring from a string literal type to a type variable whose constraint includes one of the
|
|
@@ -70403,7 +70432,7 @@ var ts;
|
|
|
70403
70432
|
inferFromTypes(source_1, target_3);
|
|
70404
70433
|
};
|
|
70405
70434
|
for (var i = 0; i < types.length; i++) {
|
|
70406
|
-
|
|
70435
|
+
_loop_24(i);
|
|
70407
70436
|
}
|
|
70408
70437
|
}
|
|
70409
70438
|
}
|
|
@@ -70932,7 +70961,7 @@ var ts;
|
|
|
70932
70961
|
function mapTypesByKeyProperty(types, name) {
|
|
70933
70962
|
var map = new ts.Map();
|
|
70934
70963
|
var count = 0;
|
|
70935
|
-
var
|
|
70964
|
+
var _loop_25 = function (type) {
|
|
70936
70965
|
if (type.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */)) {
|
|
70937
70966
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
70938
70967
|
if (discriminant) {
|
|
@@ -70958,9 +70987,9 @@ var ts;
|
|
|
70958
70987
|
};
|
|
70959
70988
|
for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
|
|
70960
70989
|
var type = types_15[_i];
|
|
70961
|
-
var
|
|
70962
|
-
if (typeof
|
|
70963
|
-
return
|
|
70990
|
+
var state_9 = _loop_25(type);
|
|
70991
|
+
if (typeof state_9 === "object")
|
|
70992
|
+
return state_9.value;
|
|
70964
70993
|
}
|
|
70965
70994
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
70966
70995
|
}
|
|
@@ -77416,7 +77445,7 @@ var ts;
|
|
|
77416
77445
|
if (spreadIndex >= 0) {
|
|
77417
77446
|
// Create synthetic arguments from spreads of tuple types.
|
|
77418
77447
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
77419
|
-
var
|
|
77448
|
+
var _loop_26 = function (i) {
|
|
77420
77449
|
var arg = args[i];
|
|
77421
77450
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
77422
77451
|
var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -77433,7 +77462,7 @@ var ts;
|
|
|
77433
77462
|
}
|
|
77434
77463
|
};
|
|
77435
77464
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
77436
|
-
|
|
77465
|
+
_loop_26(i);
|
|
77437
77466
|
}
|
|
77438
77467
|
return effectiveArgs_1;
|
|
77439
77468
|
}
|
|
@@ -77762,7 +77791,7 @@ var ts;
|
|
|
77762
77791
|
var min_3 = Number.MAX_VALUE;
|
|
77763
77792
|
var minIndex = 0;
|
|
77764
77793
|
var i_1 = 0;
|
|
77765
|
-
var
|
|
77794
|
+
var _loop_27 = function (c) {
|
|
77766
77795
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
77767
77796
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* CheckMode.Normal */, /*reportErrors*/ true, chain_2);
|
|
77768
77797
|
if (diags_2) {
|
|
@@ -77780,7 +77809,7 @@ var ts;
|
|
|
77780
77809
|
};
|
|
77781
77810
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
77782
77811
|
var c = candidatesForArgumentError_1[_a];
|
|
77783
|
-
|
|
77812
|
+
_loop_27(c);
|
|
77784
77813
|
}
|
|
77785
77814
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
77786
77815
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -77938,7 +77967,7 @@ var ts;
|
|
|
77938
77967
|
}
|
|
77939
77968
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
77940
77969
|
var parameters = [];
|
|
77941
|
-
var
|
|
77970
|
+
var _loop_28 = function (i) {
|
|
77942
77971
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
77943
77972
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
77944
77973
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -77946,7 +77975,7 @@ var ts;
|
|
|
77946
77975
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
77947
77976
|
};
|
|
77948
77977
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
77949
|
-
|
|
77978
|
+
_loop_28(i);
|
|
77950
77979
|
}
|
|
77951
77980
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
77952
77981
|
var flags = 0 /* SignatureFlags.None */;
|
|
@@ -82004,7 +82033,7 @@ var ts;
|
|
|
82004
82033
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
82005
82034
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
82006
82035
|
var indexSignatureMap_1 = new ts.Map();
|
|
82007
|
-
var
|
|
82036
|
+
var _loop_29 = function (declaration) {
|
|
82008
82037
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
82009
82038
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
82010
82039
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -82019,7 +82048,7 @@ var ts;
|
|
|
82019
82048
|
};
|
|
82020
82049
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
82021
82050
|
var declaration = _a[_i];
|
|
82022
|
-
|
|
82051
|
+
_loop_29(declaration);
|
|
82023
82052
|
}
|
|
82024
82053
|
indexSignatureMap_1.forEach(function (entry) {
|
|
82025
82054
|
if (entry.declarations.length > 1) {
|
|
@@ -82296,7 +82325,7 @@ var ts;
|
|
|
82296
82325
|
}
|
|
82297
82326
|
var symbol = getNodeLinks(node).resolvedSymbol;
|
|
82298
82327
|
if (symbol) {
|
|
82299
|
-
if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
|
|
82328
|
+
if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) {
|
|
82300
82329
|
addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName);
|
|
82301
82330
|
}
|
|
82302
82331
|
if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) {
|
|
@@ -83674,7 +83703,7 @@ var ts;
|
|
|
83674
83703
|
}
|
|
83675
83704
|
function errorUnusedLocal(declaration, name, addDiagnostic) {
|
|
83676
83705
|
var node = ts.getNameOfDeclaration(declaration) || declaration;
|
|
83677
|
-
var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
|
|
83706
|
+
var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read;
|
|
83678
83707
|
addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name));
|
|
83679
83708
|
}
|
|
83680
83709
|
function isIdentifierThatStartsWithUnderscore(node) {
|
|
@@ -85628,7 +85657,7 @@ var ts;
|
|
|
85628
85657
|
var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ ||
|
|
85629
85658
|
name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined;
|
|
85630
85659
|
var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
85631
|
-
var
|
|
85660
|
+
var _loop_30 = function (info) {
|
|
85632
85661
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
85633
85662
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
85634
85663
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -85645,7 +85674,7 @@ var ts;
|
|
|
85645
85674
|
};
|
|
85646
85675
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
85647
85676
|
var info = indexInfos_9[_i];
|
|
85648
|
-
|
|
85677
|
+
_loop_30(info);
|
|
85649
85678
|
}
|
|
85650
85679
|
}
|
|
85651
85680
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -85653,7 +85682,7 @@ var ts;
|
|
|
85653
85682
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
85654
85683
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined;
|
|
85655
85684
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
85656
|
-
var
|
|
85685
|
+
var _loop_31 = function (info) {
|
|
85657
85686
|
if (info === checkInfo)
|
|
85658
85687
|
return "continue";
|
|
85659
85688
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -85668,7 +85697,7 @@ var ts;
|
|
|
85668
85697
|
};
|
|
85669
85698
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
85670
85699
|
var info = indexInfos_10[_i];
|
|
85671
|
-
|
|
85700
|
+
_loop_31(info);
|
|
85672
85701
|
}
|
|
85673
85702
|
}
|
|
85674
85703
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -85723,7 +85752,7 @@ var ts;
|
|
|
85723
85752
|
}
|
|
85724
85753
|
else {
|
|
85725
85754
|
ts.forEach(jsdocParameters, function (_a, index) {
|
|
85726
|
-
var name = _a.name;
|
|
85755
|
+
var name = _a.name, isNameFirst = _a.isNameFirst;
|
|
85727
85756
|
if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) {
|
|
85728
85757
|
return;
|
|
85729
85758
|
}
|
|
@@ -85733,7 +85762,9 @@ var ts;
|
|
|
85733
85762
|
}
|
|
85734
85763
|
}
|
|
85735
85764
|
else {
|
|
85736
|
-
|
|
85765
|
+
if (!isNameFirst) {
|
|
85766
|
+
errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name));
|
|
85767
|
+
}
|
|
85737
85768
|
}
|
|
85738
85769
|
});
|
|
85739
85770
|
}
|
|
@@ -85988,7 +86019,7 @@ var ts;
|
|
|
85988
86019
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
85989
86020
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
85990
86021
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
85991
|
-
var
|
|
86022
|
+
var _loop_32 = function (member) {
|
|
85992
86023
|
if (ts.hasAmbientModifier(member)) {
|
|
85993
86024
|
return "continue";
|
|
85994
86025
|
}
|
|
@@ -86005,7 +86036,7 @@ var ts;
|
|
|
86005
86036
|
};
|
|
86006
86037
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
86007
86038
|
var member = _a[_i];
|
|
86008
|
-
|
|
86039
|
+
_loop_32(member);
|
|
86009
86040
|
}
|
|
86010
86041
|
}
|
|
86011
86042
|
/**
|
|
@@ -86093,7 +86124,7 @@ var ts;
|
|
|
86093
86124
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
86094
86125
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
86095
86126
|
var issuedMemberError = false;
|
|
86096
|
-
var
|
|
86127
|
+
var _loop_33 = function (member) {
|
|
86097
86128
|
if (ts.isStatic(member)) {
|
|
86098
86129
|
return "continue";
|
|
86099
86130
|
}
|
|
@@ -86112,7 +86143,7 @@ var ts;
|
|
|
86112
86143
|
};
|
|
86113
86144
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
86114
86145
|
var member = _a[_i];
|
|
86115
|
-
|
|
86146
|
+
_loop_33(member);
|
|
86116
86147
|
}
|
|
86117
86148
|
if (!issuedMemberError) {
|
|
86118
86149
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -86183,7 +86214,7 @@ var ts;
|
|
|
86183
86214
|
var _a, _b, _c, _d;
|
|
86184
86215
|
// NOTE: assignability is checked in checkClassDeclaration
|
|
86185
86216
|
var baseProperties = getPropertiesOfType(baseType);
|
|
86186
|
-
var
|
|
86217
|
+
var _loop_34 = function (baseProperty) {
|
|
86187
86218
|
var base = getTargetSymbol(baseProperty);
|
|
86188
86219
|
if (base.flags & 4194304 /* SymbolFlags.Prototype */) {
|
|
86189
86220
|
return "continue";
|
|
@@ -86293,8 +86324,8 @@ var ts;
|
|
|
86293
86324
|
};
|
|
86294
86325
|
basePropertyCheck: for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) {
|
|
86295
86326
|
var baseProperty = baseProperties_1[_i];
|
|
86296
|
-
var
|
|
86297
|
-
switch (
|
|
86327
|
+
var state_10 = _loop_34(baseProperty);
|
|
86328
|
+
switch (state_10) {
|
|
86298
86329
|
case "continue-basePropertyCheck": continue basePropertyCheck;
|
|
86299
86330
|
}
|
|
86300
86331
|
}
|
|
@@ -88004,29 +88035,9 @@ var ts;
|
|
|
88004
88035
|
}
|
|
88005
88036
|
function isTypeDeclarationName(name) {
|
|
88006
88037
|
return name.kind === 79 /* SyntaxKind.Identifier */ &&
|
|
88007
|
-
isTypeDeclaration(name.parent) &&
|
|
88038
|
+
ts.isTypeDeclaration(name.parent) &&
|
|
88008
88039
|
ts.getNameOfDeclaration(name.parent) === name;
|
|
88009
88040
|
}
|
|
88010
|
-
function isTypeDeclaration(node) {
|
|
88011
|
-
switch (node.kind) {
|
|
88012
|
-
case 165 /* SyntaxKind.TypeParameter */:
|
|
88013
|
-
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
88014
|
-
case 261 /* SyntaxKind.InterfaceDeclaration */:
|
|
88015
|
-
case 262 /* SyntaxKind.TypeAliasDeclaration */:
|
|
88016
|
-
case 263 /* SyntaxKind.EnumDeclaration */:
|
|
88017
|
-
case 348 /* SyntaxKind.JSDocTypedefTag */:
|
|
88018
|
-
case 341 /* SyntaxKind.JSDocCallbackTag */:
|
|
88019
|
-
case 342 /* SyntaxKind.JSDocEnumTag */:
|
|
88020
|
-
return true;
|
|
88021
|
-
case 270 /* SyntaxKind.ImportClause */:
|
|
88022
|
-
return node.isTypeOnly;
|
|
88023
|
-
case 273 /* SyntaxKind.ImportSpecifier */:
|
|
88024
|
-
case 278 /* SyntaxKind.ExportSpecifier */:
|
|
88025
|
-
return node.parent.parent.isTypeOnly;
|
|
88026
|
-
default:
|
|
88027
|
-
return false;
|
|
88028
|
-
}
|
|
88029
|
-
}
|
|
88030
88041
|
// True if the given identifier is part of a type reference
|
|
88031
88042
|
function isTypeReferenceIdentifier(node) {
|
|
88032
88043
|
while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) {
|
|
@@ -88459,7 +88470,7 @@ var ts;
|
|
|
88459
88470
|
var baseType = ts.firstOrUndefined(getBaseTypes(classType));
|
|
88460
88471
|
return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType;
|
|
88461
88472
|
}
|
|
88462
|
-
if (isTypeDeclaration(node)) {
|
|
88473
|
+
if (ts.isTypeDeclaration(node)) {
|
|
88463
88474
|
// In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration
|
|
88464
88475
|
var symbol = getSymbolOfNode(node);
|
|
88465
88476
|
return getDeclaredTypeOfSymbol(symbol);
|
|
@@ -125145,7 +125156,7 @@ var ts;
|
|
|
125145
125156
|
});
|
|
125146
125157
|
// Sort by paths closest to importing file Name directory
|
|
125147
125158
|
var sortedPaths = [];
|
|
125148
|
-
var
|
|
125159
|
+
var _loop_35 = function (directory) {
|
|
125149
125160
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
125150
125161
|
var pathsInDirectory;
|
|
125151
125162
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -125169,9 +125180,9 @@ var ts;
|
|
|
125169
125180
|
};
|
|
125170
125181
|
var out_directory_1;
|
|
125171
125182
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
125172
|
-
var
|
|
125183
|
+
var state_11 = _loop_35(directory);
|
|
125173
125184
|
directory = out_directory_1;
|
|
125174
|
-
if (
|
|
125185
|
+
if (state_11 === "break")
|
|
125175
125186
|
break;
|
|
125176
125187
|
}
|
|
125177
125188
|
if (allFileNames.size) {
|
|
@@ -125240,7 +125251,7 @@ var ts;
|
|
|
125240
125251
|
}
|
|
125241
125252
|
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
125242
125253
|
for (var key in paths) {
|
|
125243
|
-
var
|
|
125254
|
+
var _loop_36 = function (patternText_1) {
|
|
125244
125255
|
var pattern = ts.normalizePath(patternText_1);
|
|
125245
125256
|
var indexOfStar = pattern.indexOf("*");
|
|
125246
125257
|
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
@@ -125307,9 +125318,9 @@ var ts;
|
|
|
125307
125318
|
};
|
|
125308
125319
|
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
125309
125320
|
var patternText_1 = _a[_i];
|
|
125310
|
-
var
|
|
125311
|
-
if (typeof
|
|
125312
|
-
return
|
|
125321
|
+
var state_12 = _loop_36(patternText_1);
|
|
125322
|
+
if (typeof state_12 === "object")
|
|
125323
|
+
return state_12.value;
|
|
125313
125324
|
}
|
|
125314
125325
|
}
|
|
125315
125326
|
function validateEnding(_a) {
|