typescript 4.8.0-dev.20220803 → 4.8.0-dev.20220806
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/cs/diagnosticMessages.generated.json +4 -0
- package/lib/de/diagnosticMessages.generated.json +4 -0
- package/lib/es/diagnosticMessages.generated.json +4 -0
- package/lib/fr/diagnosticMessages.generated.json +4 -0
- package/lib/it/diagnosticMessages.generated.json +4 -0
- package/lib/ja/diagnosticMessages.generated.json +4 -0
- package/lib/ko/diagnosticMessages.generated.json +4 -0
- package/lib/pl/diagnosticMessages.generated.json +4 -0
- package/lib/pt-br/diagnosticMessages.generated.json +4 -0
- package/lib/ru/diagnosticMessages.generated.json +4 -0
- package/lib/tr/diagnosticMessages.generated.json +4 -0
- package/lib/tsc.js +237 -108
- package/lib/tsserver.js +312 -115
- package/lib/tsserverlibrary.js +312 -115
- package/lib/typescript.js +312 -115
- package/lib/typescriptServices.js +312 -115
- package/lib/typingsInstaller.js +308 -114
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +4 -0
- package/package.json +4 -1
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
112
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220806";
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -8576,7 +8576,7 @@ var ts;
|
|
|
8576
8576
|
File_is_CommonJS_module_because_0_does_not_have_field_type: diag(1460, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_0_does_not_have_field_type_1460", "File is CommonJS module because '{0}' does not have field \"type\""),
|
|
8577
8577
|
File_is_CommonJS_module_because_package_json_was_not_found: diag(1461, ts.DiagnosticCategory.Message, "File_is_CommonJS_module_because_package_json_was_not_found_1461", "File is CommonJS module because 'package.json' was not found"),
|
|
8578
8578
|
The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output: diag(1470, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output_1470", "The 'import.meta' meta-property is not allowed in files which will build into CommonJS output."),
|
|
8579
|
-
|
|
8579
|
+
Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead: diag(1471, ts.DiagnosticCategory.Error, "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471", "Module '{0}' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported with 'require'. Use an ECMAScript import instead."),
|
|
8580
8580
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8581
8581
|
An_import_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1473, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_at_the_top_level_of_a_module_1473", "An import declaration can only be used at the top level of a module."),
|
|
8582
8582
|
An_export_declaration_can_only_be_used_at_the_top_level_of_a_module: diag(1474, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_at_the_top_level_of_a_module_1474", "An export declaration can only be used at the top level of a module."),
|
|
@@ -8584,6 +8584,11 @@ var ts;
|
|
|
8584
8584
|
auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules: diag(1476, ts.DiagnosticCategory.Message, "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476", "\"auto\": Treat files with imports, exports, import.meta, jsx (with jsx: react-jsx), or esm format (with module: node16+) as modules."),
|
|
8585
8585
|
An_instantiation_expression_cannot_be_followed_by_a_property_access: diag(1477, ts.DiagnosticCategory.Error, "An_instantiation_expression_cannot_be_followed_by_a_property_access_1477", "An instantiation expression cannot be followed by a property access."),
|
|
8586
8586
|
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
8587
|
+
The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead: diag(1479, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479", "The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import(\"{0}\")' call instead."),
|
|
8588
|
+
To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module: diag(1480, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480", "To convert this file to an ECMAScript module, change its file extension to '{0}' or create a local package.json file with `{ \"type\": \"module\" }`."),
|
|
8589
|
+
To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1: diag(1481, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481", "To convert this file to an ECMAScript module, change its file extension to '{0}', or add the field `\"type\": \"module\"` to '{1}'."),
|
|
8590
|
+
To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0: diag(1482, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482", "To convert this file to an ECMAScript module, add the field `\"type\": \"module\"` to '{0}'."),
|
|
8591
|
+
To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module: diag(1483, ts.DiagnosticCategory.Message, "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483", "To convert this file to an ECMAScript module, create a local package.json file with `{ \"type\": \"module\" }`."),
|
|
8587
8592
|
The_types_of_0_are_incompatible_between_these_types: diag(2200, ts.DiagnosticCategory.Error, "The_types_of_0_are_incompatible_between_these_types_2200", "The types of '{0}' are incompatible between these types."),
|
|
8588
8593
|
The_types_returned_by_0_are_incompatible_between_these_types: diag(2201, ts.DiagnosticCategory.Error, "The_types_returned_by_0_are_incompatible_between_these_types_2201", "The types returned by '{0}' are incompatible between these types."),
|
|
8589
8594
|
Call_signature_return_types_0_and_1_are_incompatible: diag(2202, ts.DiagnosticCategory.Error, "Call_signature_return_types_0_and_1_are_incompatible_2202", "Call signature return types '{0}' and '{1}' are incompatible.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
@@ -21878,7 +21883,7 @@ var ts;
|
|
|
21878
21883
|
* Wraps an expression in parentheses if it is needed in order to use the expression for
|
|
21879
21884
|
* property or element access.
|
|
21880
21885
|
*/
|
|
21881
|
-
function parenthesizeLeftSideOfAccess(expression) {
|
|
21886
|
+
function parenthesizeLeftSideOfAccess(expression, optionalChain) {
|
|
21882
21887
|
// isLeftHandSideExpression is almost the correct criterion for when it is not necessary
|
|
21883
21888
|
// to parenthesize the expression before a dot. The known exception is:
|
|
21884
21889
|
//
|
|
@@ -21887,7 +21892,8 @@ var ts;
|
|
|
21887
21892
|
//
|
|
21888
21893
|
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
|
|
21889
21894
|
if (ts.isLeftHandSideExpression(emittedExpression)
|
|
21890
|
-
&& (emittedExpression.kind !== 209 /* NewExpression */ || emittedExpression.arguments)
|
|
21895
|
+
&& (emittedExpression.kind !== 209 /* NewExpression */ || emittedExpression.arguments)
|
|
21896
|
+
&& (optionalChain || !ts.isOptionalChain(emittedExpression))) {
|
|
21891
21897
|
// TODO(rbuckton): Verify whether this assertion holds.
|
|
21892
21898
|
return expression;
|
|
21893
21899
|
}
|
|
@@ -23294,7 +23300,7 @@ var ts;
|
|
|
23294
23300
|
// @api
|
|
23295
23301
|
function createDecorator(expression) {
|
|
23296
23302
|
var node = createBaseNode(165 /* Decorator */);
|
|
23297
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
23303
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
23298
23304
|
node.transformFlags |=
|
|
23299
23305
|
propagateChildFlags(node.expression) |
|
|
23300
23306
|
1 /* ContainsTypeScript */ |
|
|
@@ -24095,7 +24101,7 @@ var ts;
|
|
|
24095
24101
|
// @api
|
|
24096
24102
|
function createPropertyAccessExpression(expression, name) {
|
|
24097
24103
|
var node = createBaseExpression(206 /* PropertyAccessExpression */);
|
|
24098
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24104
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24099
24105
|
node.name = asName(name);
|
|
24100
24106
|
node.transformFlags =
|
|
24101
24107
|
propagateChildFlags(node.expression) |
|
|
@@ -24125,7 +24131,7 @@ var ts;
|
|
|
24125
24131
|
function createPropertyAccessChain(expression, questionDotToken, name) {
|
|
24126
24132
|
var node = createBaseExpression(206 /* PropertyAccessExpression */);
|
|
24127
24133
|
node.flags |= 32 /* OptionalChain */;
|
|
24128
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24134
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24129
24135
|
node.questionDotToken = questionDotToken;
|
|
24130
24136
|
node.name = asName(name);
|
|
24131
24137
|
node.transformFlags |=
|
|
@@ -24151,7 +24157,7 @@ var ts;
|
|
|
24151
24157
|
// @api
|
|
24152
24158
|
function createElementAccessExpression(expression, index) {
|
|
24153
24159
|
var node = createBaseExpression(207 /* ElementAccessExpression */);
|
|
24154
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24160
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24155
24161
|
node.argumentExpression = asExpression(index);
|
|
24156
24162
|
node.transformFlags |=
|
|
24157
24163
|
propagateChildFlags(node.expression) |
|
|
@@ -24179,7 +24185,7 @@ var ts;
|
|
|
24179
24185
|
function createElementAccessChain(expression, questionDotToken, index) {
|
|
24180
24186
|
var node = createBaseExpression(207 /* ElementAccessExpression */);
|
|
24181
24187
|
node.flags |= 32 /* OptionalChain */;
|
|
24182
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24188
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24183
24189
|
node.questionDotToken = questionDotToken;
|
|
24184
24190
|
node.argumentExpression = asExpression(index);
|
|
24185
24191
|
node.transformFlags |=
|
|
@@ -24203,7 +24209,7 @@ var ts;
|
|
|
24203
24209
|
// @api
|
|
24204
24210
|
function createCallExpression(expression, typeArguments, argumentsArray) {
|
|
24205
24211
|
var node = createBaseExpression(208 /* CallExpression */);
|
|
24206
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24212
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24207
24213
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24208
24214
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
24209
24215
|
node.transformFlags |=
|
|
@@ -24236,7 +24242,7 @@ var ts;
|
|
|
24236
24242
|
function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) {
|
|
24237
24243
|
var node = createBaseExpression(208 /* CallExpression */);
|
|
24238
24244
|
node.flags |= 32 /* OptionalChain */;
|
|
24239
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24245
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24240
24246
|
node.questionDotToken = questionDotToken;
|
|
24241
24247
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24242
24248
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
@@ -24291,7 +24297,7 @@ var ts;
|
|
|
24291
24297
|
// @api
|
|
24292
24298
|
function createTaggedTemplateExpression(tag, typeArguments, template) {
|
|
24293
24299
|
var node = createBaseExpression(210 /* TaggedTemplateExpression */);
|
|
24294
|
-
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag);
|
|
24300
|
+
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false);
|
|
24295
24301
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24296
24302
|
node.template = template;
|
|
24297
24303
|
node.transformFlags |=
|
|
@@ -24729,7 +24735,7 @@ var ts;
|
|
|
24729
24735
|
// @api
|
|
24730
24736
|
function createExpressionWithTypeArguments(expression, typeArguments) {
|
|
24731
24737
|
var node = createBaseNode(228 /* ExpressionWithTypeArguments */);
|
|
24732
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24738
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24733
24739
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
24734
24740
|
node.transformFlags |=
|
|
24735
24741
|
propagateChildFlags(node.expression) |
|
|
@@ -24765,7 +24771,7 @@ var ts;
|
|
|
24765
24771
|
// @api
|
|
24766
24772
|
function createNonNullExpression(expression) {
|
|
24767
24773
|
var node = createBaseExpression(230 /* NonNullExpression */);
|
|
24768
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24774
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24769
24775
|
node.transformFlags |=
|
|
24770
24776
|
propagateChildFlags(node.expression) |
|
|
24771
24777
|
1 /* ContainsTypeScript */;
|
|
@@ -24784,7 +24790,7 @@ var ts;
|
|
|
24784
24790
|
function createNonNullChain(expression) {
|
|
24785
24791
|
var node = createBaseExpression(230 /* NonNullExpression */);
|
|
24786
24792
|
node.flags |= 32 /* OptionalChain */;
|
|
24787
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24793
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24788
24794
|
node.transformFlags |=
|
|
24789
24795
|
propagateChildFlags(node.expression) |
|
|
24790
24796
|
1 /* ContainsTypeScript */;
|
|
@@ -26988,7 +26994,7 @@ var ts;
|
|
|
26988
26994
|
}
|
|
26989
26995
|
else if (ts.getEmitFlags(callee) & 4096 /* HelperName */) {
|
|
26990
26996
|
thisArg = createVoidZero();
|
|
26991
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
|
|
26997
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee, /*optionalChain*/ false);
|
|
26992
26998
|
}
|
|
26993
26999
|
else if (ts.isPropertyAccessExpression(callee)) {
|
|
26994
27000
|
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
|
|
@@ -27017,7 +27023,7 @@ var ts;
|
|
|
27017
27023
|
else {
|
|
27018
27024
|
// for `a()` target is `a` and thisArg is `void 0`
|
|
27019
27025
|
thisArg = createVoidZero();
|
|
27020
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
27026
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
27021
27027
|
}
|
|
27022
27028
|
return { target: target, thisArg: thisArg };
|
|
27023
27029
|
}
|
|
@@ -51692,7 +51698,40 @@ var ts;
|
|
|
51692
51698
|
// An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
|
|
51693
51699
|
// normal mode restrictions
|
|
51694
51700
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51695
|
-
|
|
51701
|
+
if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
|
|
51702
|
+
// ImportEquals in a ESM file resolving to another ESM file
|
|
51703
|
+
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_with_require_Use_an_ECMAScript_import_instead, moduleReference);
|
|
51704
|
+
}
|
|
51705
|
+
else {
|
|
51706
|
+
// CJS file resolving to an ESM file
|
|
51707
|
+
var diagnosticDetails = void 0;
|
|
51708
|
+
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
51709
|
+
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
51710
|
+
var scope = currentSourceFile.packageJsonScope;
|
|
51711
|
+
var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
|
|
51712
|
+
if (scope && !scope.packageJsonContent.type) {
|
|
51713
|
+
if (targetExt) {
|
|
51714
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51715
|
+
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Colon_module_to_1, targetExt, ts.combinePaths(scope.packageDirectory, "package.json"));
|
|
51716
|
+
}
|
|
51717
|
+
else {
|
|
51718
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51719
|
+
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0, ts.combinePaths(scope.packageDirectory, "package.json"));
|
|
51720
|
+
}
|
|
51721
|
+
}
|
|
51722
|
+
else {
|
|
51723
|
+
if (targetExt) {
|
|
51724
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51725
|
+
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_package_json_file_with_type_Colon_module, targetExt);
|
|
51726
|
+
}
|
|
51727
|
+
else {
|
|
51728
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51729
|
+
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
|
|
51730
|
+
}
|
|
51731
|
+
}
|
|
51732
|
+
}
|
|
51733
|
+
diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(errorNode, ts.chainDiagnosticMessages(diagnosticDetails, ts.Diagnostics.The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_referenced_file_is_an_ECMAScript_module_and_cannot_be_imported_with_require_Consider_writing_a_dynamic_import_0_call_instead, moduleReference)));
|
|
51734
|
+
}
|
|
51696
51735
|
}
|
|
51697
51736
|
}
|
|
51698
51737
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
@@ -73200,12 +73239,15 @@ var ts;
|
|
|
73200
73239
|
if (contextualReturnType) {
|
|
73201
73240
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73202
73241
|
if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
|
|
73203
|
-
var
|
|
73204
|
-
|
|
73205
|
-
|
|
73242
|
+
var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
|
|
73243
|
+
if (contextualReturnType.flags & 1048576 /* Union */) {
|
|
73244
|
+
contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
|
|
73245
|
+
}
|
|
73246
|
+
var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
|
|
73247
|
+
if (!iterationReturnType) {
|
|
73206
73248
|
return undefined;
|
|
73207
73249
|
}
|
|
73208
|
-
contextualReturnType =
|
|
73250
|
+
contextualReturnType = iterationReturnType;
|
|
73209
73251
|
// falls through to unwrap Promise for AsyncGenerators
|
|
73210
73252
|
}
|
|
73211
73253
|
if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
|
|
@@ -73232,9 +73274,13 @@ var ts;
|
|
|
73232
73274
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73233
73275
|
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73234
73276
|
if (contextualReturnType) {
|
|
73277
|
+
var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
|
|
73278
|
+
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
73279
|
+
contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
|
|
73280
|
+
}
|
|
73235
73281
|
return node.asteriskToken
|
|
73236
73282
|
? contextualReturnType
|
|
73237
|
-
: getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType,
|
|
73283
|
+
: getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
|
|
73238
73284
|
}
|
|
73239
73285
|
}
|
|
73240
73286
|
return undefined;
|
|
@@ -84009,17 +84055,28 @@ var ts;
|
|
|
84009
84055
|
* the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method.
|
|
84010
84056
|
*/
|
|
84011
84057
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
84058
|
+
var _a, _b;
|
|
84012
84059
|
if (isTypeAny(type)) {
|
|
84013
84060
|
return anyIterationTypes;
|
|
84014
84061
|
}
|
|
84015
84062
|
if (!(type.flags & 1048576 /* Union */)) {
|
|
84016
|
-
var
|
|
84063
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
84064
|
+
var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
84017
84065
|
if (iterationTypes_1 === noIterationTypes) {
|
|
84018
84066
|
if (errorNode) {
|
|
84019
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84067
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84068
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
84069
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
84070
|
+
}
|
|
84020
84071
|
}
|
|
84021
84072
|
return undefined;
|
|
84022
84073
|
}
|
|
84074
|
+
else if ((_a = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
84075
|
+
for (var _i = 0, _c = errorOutputContainer.errors; _i < _c.length; _i++) {
|
|
84076
|
+
var diag = _c[_i];
|
|
84077
|
+
diagnostics.add(diag);
|
|
84078
|
+
}
|
|
84079
|
+
}
|
|
84023
84080
|
return iterationTypes_1;
|
|
84024
84081
|
}
|
|
84025
84082
|
var cacheKey = use & 2 /* AllowsAsyncIterablesFlag */ ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable";
|
|
@@ -84027,19 +84084,27 @@ var ts;
|
|
|
84027
84084
|
if (cachedTypes)
|
|
84028
84085
|
return cachedTypes === noIterationTypes ? undefined : cachedTypes;
|
|
84029
84086
|
var allIterationTypes;
|
|
84030
|
-
for (var
|
|
84031
|
-
var constituent =
|
|
84032
|
-
var
|
|
84087
|
+
for (var _d = 0, _e = type.types; _d < _e.length; _d++) {
|
|
84088
|
+
var constituent = _e[_d];
|
|
84089
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
84090
|
+
var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode, errorOutputContainer);
|
|
84033
84091
|
if (iterationTypes_2 === noIterationTypes) {
|
|
84034
84092
|
if (errorNode) {
|
|
84035
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84093
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84094
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
84095
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
84096
|
+
}
|
|
84036
84097
|
}
|
|
84037
84098
|
setCachedIterationTypes(type, cacheKey, noIterationTypes);
|
|
84038
84099
|
return undefined;
|
|
84039
84100
|
}
|
|
84040
|
-
else {
|
|
84041
|
-
|
|
84101
|
+
else if ((_b = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
84102
|
+
for (var _f = 0, _g = errorOutputContainer.errors; _f < _g.length; _f++) {
|
|
84103
|
+
var diag = _g[_f];
|
|
84104
|
+
diagnostics.add(diag);
|
|
84105
|
+
}
|
|
84042
84106
|
}
|
|
84107
|
+
allIterationTypes = ts.append(allIterationTypes, iterationTypes_2);
|
|
84043
84108
|
}
|
|
84044
84109
|
var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes;
|
|
84045
84110
|
setCachedIterationTypes(type, cacheKey, iterationTypes);
|
|
@@ -84067,47 +84132,62 @@ var ts;
|
|
|
84067
84132
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84068
84133
|
* `getIterationTypesOfIterable` instead.
|
|
84069
84134
|
*/
|
|
84070
|
-
function getIterationTypesOfIterableWorker(type, use, errorNode) {
|
|
84135
|
+
function getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer) {
|
|
84071
84136
|
if (isTypeAny(type)) {
|
|
84072
84137
|
return anyIterationTypes;
|
|
84073
84138
|
}
|
|
84139
|
+
// If we are reporting errors and encounter a cached `noIterationTypes`, we should ignore the cached value and continue as if nothing was cached.
|
|
84140
|
+
// In addition, we should not cache any new results for this call.
|
|
84141
|
+
var noCache = false;
|
|
84074
84142
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84075
84143
|
var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) ||
|
|
84076
84144
|
getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
84077
84145
|
if (iterationTypes) {
|
|
84078
|
-
|
|
84079
|
-
|
|
84080
|
-
|
|
84146
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84147
|
+
// ignore the cached value
|
|
84148
|
+
noCache = true;
|
|
84149
|
+
}
|
|
84150
|
+
else {
|
|
84151
|
+
return use & 8 /* ForOfFlag */ ?
|
|
84152
|
+
getAsyncFromSyncIterationTypes(iterationTypes, errorNode) :
|
|
84153
|
+
iterationTypes;
|
|
84154
|
+
}
|
|
84081
84155
|
}
|
|
84082
84156
|
}
|
|
84083
84157
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84084
84158
|
var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) ||
|
|
84085
84159
|
getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
84086
84160
|
if (iterationTypes) {
|
|
84087
|
-
if (
|
|
84088
|
-
//
|
|
84089
|
-
|
|
84090
|
-
return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", getAsyncFromSyncIterationTypes(iterationTypes, errorNode));
|
|
84091
|
-
}
|
|
84161
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84162
|
+
// ignore the cached value
|
|
84163
|
+
noCache = true;
|
|
84092
84164
|
}
|
|
84093
84165
|
else {
|
|
84094
|
-
|
|
84166
|
+
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84167
|
+
// for a sync iterable in an async context, only use the cached types if they are valid.
|
|
84168
|
+
if (iterationTypes !== noIterationTypes) {
|
|
84169
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
84170
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
84171
|
+
}
|
|
84172
|
+
}
|
|
84173
|
+
else {
|
|
84174
|
+
return iterationTypes;
|
|
84175
|
+
}
|
|
84095
84176
|
}
|
|
84096
84177
|
}
|
|
84097
84178
|
}
|
|
84098
84179
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84099
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode);
|
|
84180
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84100
84181
|
if (iterationTypes !== noIterationTypes) {
|
|
84101
84182
|
return iterationTypes;
|
|
84102
84183
|
}
|
|
84103
84184
|
}
|
|
84104
84185
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84105
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode);
|
|
84186
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84106
84187
|
if (iterationTypes !== noIterationTypes) {
|
|
84107
84188
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84108
|
-
|
|
84109
|
-
|
|
84110
|
-
: noIterationTypes);
|
|
84189
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
84190
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
84111
84191
|
}
|
|
84112
84192
|
else {
|
|
84113
84193
|
return iterationTypes;
|
|
@@ -84128,7 +84208,7 @@ var ts;
|
|
|
84128
84208
|
}
|
|
84129
84209
|
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
84130
84210
|
var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) ||
|
|
84131
|
-
getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined);
|
|
84211
|
+
getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined, /*noCache*/ false);
|
|
84132
84212
|
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
84133
84213
|
}
|
|
84134
84214
|
/**
|
|
@@ -84182,40 +84262,56 @@ var ts;
|
|
|
84182
84262
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84183
84263
|
* `getIterationTypesOfIterable` instead.
|
|
84184
84264
|
*/
|
|
84185
|
-
function getIterationTypesOfIterableSlow(type, resolver, errorNode) {
|
|
84265
|
+
function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84186
84266
|
var _a;
|
|
84187
84267
|
var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName));
|
|
84188
84268
|
var methodType = method && !(method.flags & 16777216 /* Optional */) ? getTypeOfSymbol(method) : undefined;
|
|
84189
84269
|
if (isTypeAny(methodType)) {
|
|
84190
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
84270
|
+
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
84191
84271
|
}
|
|
84192
84272
|
var signatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : undefined;
|
|
84193
84273
|
if (!ts.some(signatures)) {
|
|
84194
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
84274
|
+
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
84195
84275
|
}
|
|
84196
84276
|
var iteratorType = getIntersectionType(ts.map(signatures, getReturnTypeOfSignature));
|
|
84197
|
-
var iterationTypes = (_a =
|
|
84198
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
84277
|
+
var iterationTypes = (_a = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) !== null && _a !== void 0 ? _a : noIterationTypes;
|
|
84278
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
84199
84279
|
}
|
|
84200
84280
|
function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) {
|
|
84201
84281
|
var message = allowAsyncIterables
|
|
84202
84282
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
84203
84283
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
84204
|
-
errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
84284
|
+
return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
84285
|
+
}
|
|
84286
|
+
/**
|
|
84287
|
+
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
84288
|
+
*
|
|
84289
|
+
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84290
|
+
* record is returned. Otherwise, `undefined` is returned.
|
|
84291
|
+
*/
|
|
84292
|
+
function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) {
|
|
84293
|
+
return getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, /*noCache*/ false);
|
|
84205
84294
|
}
|
|
84206
84295
|
/**
|
|
84207
84296
|
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
84208
84297
|
*
|
|
84209
84298
|
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84210
84299
|
* record is returned. Otherwise, `undefined` is returned.
|
|
84300
|
+
*
|
|
84301
|
+
* NOTE: You probably don't want to call this directly and should be calling
|
|
84302
|
+
* `getIterationTypesOfIterator` instead.
|
|
84211
84303
|
*/
|
|
84212
|
-
function
|
|
84304
|
+
function getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84213
84305
|
if (isTypeAny(type)) {
|
|
84214
84306
|
return anyIterationTypes;
|
|
84215
84307
|
}
|
|
84216
84308
|
var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) ||
|
|
84217
|
-
getIterationTypesOfIteratorFast(type, resolver)
|
|
84218
|
-
|
|
84309
|
+
getIterationTypesOfIteratorFast(type, resolver);
|
|
84310
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84311
|
+
iterationTypes = undefined;
|
|
84312
|
+
noCache = true;
|
|
84313
|
+
}
|
|
84314
|
+
iterationTypes !== null && iterationTypes !== void 0 ? iterationTypes : (iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache));
|
|
84219
84315
|
return iterationTypes === noIterationTypes ? undefined : iterationTypes;
|
|
84220
84316
|
}
|
|
84221
84317
|
/**
|
|
@@ -84253,7 +84349,7 @@ var ts;
|
|
|
84253
84349
|
// iteration types of their `next`, `return`, and `throw` methods. While we define these as `any`
|
|
84254
84350
|
// and `undefined` in our libs by default, a custom lib *could* use different definitions.
|
|
84255
84351
|
var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) ||
|
|
84256
|
-
getIterationTypesOfIteratorSlow(globalType, resolver, /*errorNode*/ undefined);
|
|
84352
|
+
getIterationTypesOfIteratorSlow(globalType, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined, /*noCache*/ false);
|
|
84257
84353
|
var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType;
|
|
84258
84354
|
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
84259
84355
|
}
|
|
@@ -84323,8 +84419,8 @@ var ts;
|
|
|
84323
84419
|
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84324
84420
|
* record is returned. Otherwise, we return `undefined`.
|
|
84325
84421
|
*/
|
|
84326
|
-
function getIterationTypesOfMethod(type, resolver, methodName, errorNode) {
|
|
84327
|
-
var _a, _b, _c, _d;
|
|
84422
|
+
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
84423
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84328
84424
|
var method = getPropertyOfType(type, methodName);
|
|
84329
84425
|
// Ignore 'return' or 'throw' if they are missing.
|
|
84330
84426
|
if (!method && methodName !== "next") {
|
|
@@ -84344,9 +84440,15 @@ var ts;
|
|
|
84344
84440
|
var diagnostic = methodName === "next"
|
|
84345
84441
|
? resolver.mustHaveANextMethodDiagnostic
|
|
84346
84442
|
: resolver.mustBeAMethodDiagnostic;
|
|
84347
|
-
|
|
84443
|
+
if (errorOutputContainer) {
|
|
84444
|
+
(_a = errorOutputContainer.errors) !== null && _a !== void 0 ? _a : (errorOutputContainer.errors = []);
|
|
84445
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
84446
|
+
}
|
|
84447
|
+
else {
|
|
84448
|
+
error(errorNode, diagnostic, methodName);
|
|
84449
|
+
}
|
|
84348
84450
|
}
|
|
84349
|
-
return methodName === "next" ?
|
|
84451
|
+
return methodName === "next" ? noIterationTypes : undefined;
|
|
84350
84452
|
}
|
|
84351
84453
|
// If the method signature comes exclusively from the global iterator or generator type,
|
|
84352
84454
|
// create iteration types from its type arguments like `getIterationTypesOfIteratorFast`
|
|
@@ -84358,8 +84460,8 @@ var ts;
|
|
|
84358
84460
|
if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) {
|
|
84359
84461
|
var globalGeneratorType = resolver.getGlobalGeneratorType(/*reportErrors*/ false);
|
|
84360
84462
|
var globalIteratorType = resolver.getGlobalIteratorType(/*reportErrors*/ false);
|
|
84361
|
-
var isGeneratorMethod = ((
|
|
84362
|
-
var isIteratorMethod = !isGeneratorMethod && ((
|
|
84463
|
+
var isGeneratorMethod = ((_c = (_b = globalGeneratorType.symbol) === null || _b === void 0 ? void 0 : _b.members) === null || _c === void 0 ? void 0 : _c.get(methodName)) === methodType.symbol;
|
|
84464
|
+
var isIteratorMethod = !isGeneratorMethod && ((_e = (_d = globalIteratorType.symbol) === null || _d === void 0 ? void 0 : _d.members) === null || _e === void 0 ? void 0 : _e.get(methodName)) === methodType.symbol;
|
|
84363
84465
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
84364
84466
|
var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
84365
84467
|
var mapper = methodType.mapper;
|
|
@@ -84399,7 +84501,13 @@ var ts;
|
|
|
84399
84501
|
var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType);
|
|
84400
84502
|
if (iterationTypes === noIterationTypes) {
|
|
84401
84503
|
if (errorNode) {
|
|
84402
|
-
|
|
84504
|
+
if (errorOutputContainer) {
|
|
84505
|
+
(_f = errorOutputContainer.errors) !== null && _f !== void 0 ? _f : (errorOutputContainer.errors = []);
|
|
84506
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
84507
|
+
}
|
|
84508
|
+
else {
|
|
84509
|
+
error(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
84510
|
+
}
|
|
84403
84511
|
}
|
|
84404
84512
|
yieldType = anyType;
|
|
84405
84513
|
returnTypes = ts.append(returnTypes, anyType);
|
|
@@ -84420,13 +84528,13 @@ var ts;
|
|
|
84420
84528
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84421
84529
|
* `getIterationTypesOfIterator` instead.
|
|
84422
84530
|
*/
|
|
84423
|
-
function getIterationTypesOfIteratorSlow(type, resolver, errorNode) {
|
|
84531
|
+
function getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84424
84532
|
var iterationTypes = combineIterationTypes([
|
|
84425
|
-
getIterationTypesOfMethod(type, resolver, "next", errorNode),
|
|
84426
|
-
getIterationTypesOfMethod(type, resolver, "return", errorNode),
|
|
84427
|
-
getIterationTypesOfMethod(type, resolver, "throw", errorNode),
|
|
84533
|
+
getIterationTypesOfMethod(type, resolver, "next", errorNode, errorOutputContainer),
|
|
84534
|
+
getIterationTypesOfMethod(type, resolver, "return", errorNode, errorOutputContainer),
|
|
84535
|
+
getIterationTypesOfMethod(type, resolver, "throw", errorNode, errorOutputContainer),
|
|
84428
84536
|
]);
|
|
84429
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
84537
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
84430
84538
|
}
|
|
84431
84539
|
/**
|
|
84432
84540
|
* Gets the requested "iteration type" from a type that is either `Iterable`-like, `Iterator`-like,
|
|
@@ -84447,7 +84555,7 @@ var ts;
|
|
|
84447
84555
|
var use = isAsyncGenerator ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
|
|
84448
84556
|
var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
84449
84557
|
return getIterationTypesOfIterable(type, use, /*errorNode*/ undefined) ||
|
|
84450
|
-
getIterationTypesOfIterator(type, resolver, /*errorNode*/ undefined);
|
|
84558
|
+
getIterationTypesOfIterator(type, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined);
|
|
84451
84559
|
}
|
|
84452
84560
|
function checkBreakOrContinueStatement(node) {
|
|
84453
84561
|
// Grammar checking
|
|
@@ -122744,8 +122852,6 @@ var ts;
|
|
|
122744
122852
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
122745
122853
|
fileWatchesOfAffectingLocations.delete(path);
|
|
122746
122854
|
watcher.watcher.close();
|
|
122747
|
-
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
122748
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
122749
122855
|
}
|
|
122750
122856
|
});
|
|
122751
122857
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
@@ -123091,20 +123197,27 @@ var ts;
|
|
|
123091
123197
|
}
|
|
123092
123198
|
var paths = new ts.Set();
|
|
123093
123199
|
paths.add(locationToWatch);
|
|
123200
|
+
var actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
123201
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
123202
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123203
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123204
|
+
paths.forEach(function (path) {
|
|
123205
|
+
if (watcher.resolutions)
|
|
123206
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
123207
|
+
if (watcher.files)
|
|
123208
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123209
|
+
packageJsonMap === null || packageJsonMap === void 0 ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
123210
|
+
});
|
|
123211
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123212
|
+
}) : ts.noopFileWatcher;
|
|
123094
123213
|
var watcher = {
|
|
123095
|
-
watcher:
|
|
123096
|
-
|
|
123097
|
-
|
|
123098
|
-
|
|
123099
|
-
|
|
123100
|
-
|
|
123101
|
-
|
|
123102
|
-
if (watcher.files)
|
|
123103
|
-
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123104
|
-
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
123105
|
-
});
|
|
123106
|
-
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123107
|
-
}) : ts.noopFileWatcher,
|
|
123214
|
+
watcher: actualWatcher !== ts.noopFileWatcher ? {
|
|
123215
|
+
close: function () {
|
|
123216
|
+
actualWatcher.close();
|
|
123217
|
+
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
123218
|
+
actualWatcher = ts.noopFileWatcher;
|
|
123219
|
+
}
|
|
123220
|
+
} : actualWatcher,
|
|
123108
123221
|
resolutions: forResolution ? 1 : 0,
|
|
123109
123222
|
files: forResolution ? 0 : 1,
|
|
123110
123223
|
paths: paths,
|
|
@@ -123518,7 +123631,7 @@ var ts;
|
|
|
123518
123631
|
var info = getInfo(importingSourceFileName, host);
|
|
123519
123632
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
123520
123633
|
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
123521
|
-
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
123634
|
+
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
123522
123635
|
}
|
|
123523
123636
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
123524
123637
|
if (options === void 0) { options = {}; }
|
|
@@ -123601,7 +123714,7 @@ var ts;
|
|
|
123601
123714
|
return nodeModulesSpecifiers;
|
|
123602
123715
|
}
|
|
123603
123716
|
if (!specifier && !modulePath.isRedirect) {
|
|
123604
|
-
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, preferences);
|
|
123717
|
+
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
123605
123718
|
if (ts.pathIsBareSpecifier(local)) {
|
|
123606
123719
|
pathsSpecifiers = ts.append(pathsSpecifiers, local);
|
|
123607
123720
|
}
|
|
@@ -123629,7 +123742,7 @@ var ts;
|
|
|
123629
123742
|
var sourceDirectory = ts.getDirectoryPath(importingSourceFileName);
|
|
123630
123743
|
return { getCanonicalFileName: getCanonicalFileName, importingSourceFileName: importingSourceFileName, sourceDirectory: sourceDirectory };
|
|
123631
123744
|
}
|
|
123632
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, _a) {
|
|
123745
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, _a) {
|
|
123633
123746
|
var ending = _a.ending, relativePreference = _a.relativePreference;
|
|
123634
123747
|
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
|
|
123635
123748
|
var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName;
|
|
@@ -123643,9 +123756,8 @@ var ts;
|
|
|
123643
123756
|
if (!relativeToBaseUrl) {
|
|
123644
123757
|
return relativePath;
|
|
123645
123758
|
}
|
|
123646
|
-
var
|
|
123647
|
-
var
|
|
123648
|
-
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
|
123759
|
+
var fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
123760
|
+
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
123649
123761
|
if (!nonRelative) {
|
|
123650
123762
|
return relativePath;
|
|
123651
123763
|
}
|
|
@@ -123880,28 +123992,102 @@ var ts;
|
|
|
123880
123992
|
return ambientModuleDeclare.name.text;
|
|
123881
123993
|
}
|
|
123882
123994
|
}
|
|
123883
|
-
function
|
|
123995
|
+
function getAllowedEndings(preferredEnding, compilerOptions, importMode) {
|
|
123996
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && importMode === ts.ModuleKind.ESNext) {
|
|
123997
|
+
return [2 /* JsExtension */];
|
|
123998
|
+
}
|
|
123999
|
+
switch (preferredEnding) {
|
|
124000
|
+
case 2 /* JsExtension */: return [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */];
|
|
124001
|
+
case 1 /* Index */: return [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */];
|
|
124002
|
+
case 0 /* Minimal */: return [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */];
|
|
124003
|
+
default: ts.Debug.assertNever(preferredEnding);
|
|
124004
|
+
}
|
|
124005
|
+
}
|
|
124006
|
+
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
123884
124007
|
for (var key in paths) {
|
|
123885
|
-
|
|
123886
|
-
var
|
|
123887
|
-
var pattern = ts.removeFileExtension(ts.normalizePath(patternText_1));
|
|
124008
|
+
var _loop_36 = function (patternText_1) {
|
|
124009
|
+
var pattern = ts.normalizePath(patternText_1);
|
|
123888
124010
|
var indexOfStar = pattern.indexOf("*");
|
|
124011
|
+
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
124012
|
+
// meaning a '.ts' or '.d.ts' extension is allowed to resolve. This is distinct from the case where a '*' substitution
|
|
124013
|
+
// causes a module specifier to have an extension, i.e. the extension comes from the module specifier in a JS/TS file
|
|
124014
|
+
// and matches the '*'. For example:
|
|
124015
|
+
//
|
|
124016
|
+
// Module Specifier | Path Mapping (key: [pattern]) | Interpolation | Resolution Action
|
|
124017
|
+
// ---------------------->------------------------------->--------------------->---------------------------------------------------------------
|
|
124018
|
+
// import "@app/foo" -> "@app/*": ["./src/app/*.ts"] -> "./src/app/foo.ts" -> tryFile("./src/app/foo.ts") || [continue resolution algorithm]
|
|
124019
|
+
// import "@app/foo.ts" -> "@app/*": ["./src/app/*"] -> "./src/app/foo.ts" -> [continue resolution algorithm]
|
|
124020
|
+
//
|
|
124021
|
+
// (https://github.com/microsoft/TypeScript/blob/ad4ded80e1d58f0bf36ac16bea71bc10d9f09895/src/compiler/moduleNameResolver.ts#L2509-L2516)
|
|
124022
|
+
//
|
|
124023
|
+
// The interpolation produced by both scenarios is identical, but only in the former, where the extension is encoded in
|
|
124024
|
+
// the path mapping rather than in the module specifier, will we prioritize a file lookup on the interpolation result.
|
|
124025
|
+
// (In fact, currently, the latter scenario will necessarily fail since no resolution mode recognizes '.ts' as a valid
|
|
124026
|
+
// extension for a module specifier.)
|
|
124027
|
+
//
|
|
124028
|
+
// Here, this means we need to be careful about whether we generate a match from the target filename (typically with a
|
|
124029
|
+
// .ts extension) or the possible relative module specifiers representing that file:
|
|
124030
|
+
//
|
|
124031
|
+
// Filename | Relative Module Specifier Candidates | Path Mapping | Filename Result | Module Specifier Results
|
|
124032
|
+
// --------------------<----------------------------------------------<------------------------------<-------------------||----------------------------
|
|
124033
|
+
// dist/haha.d.ts <- dist/haha, dist/haha.js <- "@app/*": ["./dist/*.d.ts"] <- @app/haha || (none)
|
|
124034
|
+
// dist/haha.d.ts <- dist/haha, dist/haha.js <- "@app/*": ["./dist/*"] <- (none) || @app/haha, @app/haha.js
|
|
124035
|
+
// dist/foo/index.d.ts <- dist/foo, dist/foo/index, dist/foo/index.js <- "@app/*": ["./dist/*.d.ts"] <- @app/foo/index || (none)
|
|
124036
|
+
// dist/foo/index.d.ts <- dist/foo, dist/foo/index, dist/foo/index.js <- "@app/*": ["./dist/*"] <- (none) || @app/foo, @app/foo/index, @app/foo/index.js
|
|
124037
|
+
// dist/wow.js.js <- dist/wow.js, dist/wow.js.js <- "@app/*": ["./dist/*.js"] <- @app/wow.js || @app/wow, @app/wow.js
|
|
124038
|
+
//
|
|
124039
|
+
// The "Filename Result" can be generated only if `pattern` has an extension. Care must be taken that the list of
|
|
124040
|
+
// relative module specifiers to run the interpolation (a) is actually valid for the module resolution mode, (b) takes
|
|
124041
|
+
// into account the existence of other files (e.g. 'dist/wow.js' cannot refer to 'dist/wow.js.js' if 'dist/wow.js'
|
|
124042
|
+
// exists) and (c) that they are ordered by preference. The last row shows that the filename result and module
|
|
124043
|
+
// specifier results are not mutually exclusive. Note that the filename result is a higher priority in module
|
|
124044
|
+
// resolution, but as long criteria (b) above is met, I don't think its result needs to be the highest priority result
|
|
124045
|
+
// in module specifier generation. I have included it last, as it's difficult to tell exactly where it should be
|
|
124046
|
+
// sorted among the others for a particular value of `importModuleSpecifierEnding`.
|
|
124047
|
+
var candidates = allowedEndings.map(function (ending) { return ({
|
|
124048
|
+
ending: ending,
|
|
124049
|
+
value: removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions)
|
|
124050
|
+
}); });
|
|
124051
|
+
if (ts.tryGetExtensionFromPath(pattern)) {
|
|
124052
|
+
candidates.push({ ending: undefined, value: relativeToBaseUrl });
|
|
124053
|
+
}
|
|
123889
124054
|
if (indexOfStar !== -1) {
|
|
123890
|
-
var prefix = pattern.
|
|
123891
|
-
var suffix = pattern.
|
|
123892
|
-
|
|
123893
|
-
|
|
123894
|
-
|
|
123895
|
-
|
|
123896
|
-
|
|
123897
|
-
|
|
124055
|
+
var prefix = pattern.substring(0, indexOfStar);
|
|
124056
|
+
var suffix = pattern.substring(indexOfStar + 1);
|
|
124057
|
+
for (var _b = 0, candidates_3 = candidates; _b < candidates_3.length; _b++) {
|
|
124058
|
+
var _c = candidates_3[_b], ending = _c.ending, value = _c.value;
|
|
124059
|
+
if (value.length >= prefix.length + suffix.length &&
|
|
124060
|
+
ts.startsWith(value, prefix) &&
|
|
124061
|
+
ts.endsWith(value, suffix) &&
|
|
124062
|
+
validateEnding({ ending: ending, value: value })) {
|
|
124063
|
+
var matchedStar = value.substring(prefix.length, value.length - suffix.length);
|
|
124064
|
+
return { value: key.replace("*", matchedStar) };
|
|
124065
|
+
}
|
|
123898
124066
|
}
|
|
123899
124067
|
}
|
|
123900
|
-
else if (
|
|
123901
|
-
return
|
|
124068
|
+
else if (ts.some(candidates, function (c) { return c.ending !== 0 /* Minimal */ && pattern === c.value; }) ||
|
|
124069
|
+
ts.some(candidates, function (c) { return c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c); })) {
|
|
124070
|
+
return { value: key };
|
|
123902
124071
|
}
|
|
124072
|
+
};
|
|
124073
|
+
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
124074
|
+
var patternText_1 = _a[_i];
|
|
124075
|
+
var state_12 = _loop_36(patternText_1);
|
|
124076
|
+
if (typeof state_12 === "object")
|
|
124077
|
+
return state_12.value;
|
|
123903
124078
|
}
|
|
123904
124079
|
}
|
|
124080
|
+
function validateEnding(_a) {
|
|
124081
|
+
var ending = _a.ending, value = _a.value;
|
|
124082
|
+
// Optimization: `removeExtensionAndIndexPostFix` can query the file system (a good bit) if `ending` is `Minimal`, the basename
|
|
124083
|
+
// is 'index', and a `host` is provided. To avoid that until it's unavoidable, we ran the function with no `host` above. Only
|
|
124084
|
+
// here, after we've checked that the minimal ending is indeed a match (via the length and prefix/suffix checks / `some` calls),
|
|
124085
|
+
// do we check that the host-validated result is consistent with the answer we got before. If it's not, it falls back to the
|
|
124086
|
+
// `Ending.Index` result, which should already be in the list of candidates if `Minimal` was. (Note: the assumption here is
|
|
124087
|
+
// that every module resolution mode that supports dropping extensions also supports dropping `/index`. Like literally
|
|
124088
|
+
// everything else in this file, this logic needs to be updated if that's not true in some future module resolution mode.)
|
|
124089
|
+
return ending !== 0 /* Minimal */ || value === removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions, host);
|
|
124090
|
+
}
|
|
123905
124091
|
}
|
|
123906
124092
|
var MatchingMode;
|
|
123907
124093
|
(function (MatchingMode) {
|
|
@@ -123997,10 +124183,10 @@ var ts;
|
|
|
123997
124183
|
return undefined;
|
|
123998
124184
|
}
|
|
123999
124185
|
// Simplify the full file path to something that can be resolved by Node.
|
|
124186
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
124000
124187
|
var moduleSpecifier = path;
|
|
124001
124188
|
var isPackageRootPath = false;
|
|
124002
124189
|
if (!packageNameOnly) {
|
|
124003
|
-
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
124004
124190
|
var packageRootIndex = parts.packageRootIndex;
|
|
124005
124191
|
var moduleFileName = void 0;
|
|
124006
124192
|
while (true) {
|
|
@@ -124049,15 +124235,13 @@ var ts;
|
|
|
124049
124235
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
124050
124236
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
124051
124237
|
var moduleFileToTry = path;
|
|
124238
|
+
var maybeBlockedByTypesVersions = false;
|
|
124052
124239
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
124053
124240
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
124054
124241
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
124242
|
+
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
124055
124243
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
124056
|
-
|
|
124057
|
-
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
124058
|
-
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
124059
|
-
// with, so for now we just stick with the mode of the file.
|
|
124060
|
-
var conditions = ["node", overrideMode || importingSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
124244
|
+
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
124061
124245
|
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
124062
124246
|
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
124063
124247
|
: undefined;
|
|
@@ -124076,16 +124260,26 @@ var ts;
|
|
|
124076
124260
|
: undefined;
|
|
124077
124261
|
if (versionPaths) {
|
|
124078
124262
|
var subModuleName = path.slice(packageRootPath.length + 1);
|
|
124079
|
-
var fromPaths = tryGetModuleNameFromPaths(
|
|
124080
|
-
if (fromPaths
|
|
124263
|
+
var fromPaths = tryGetModuleNameFromPaths(subModuleName, versionPaths.paths, getAllowedEndings(preferences.ending, options, importMode), host, options);
|
|
124264
|
+
if (fromPaths === undefined) {
|
|
124265
|
+
maybeBlockedByTypesVersions = true;
|
|
124266
|
+
}
|
|
124267
|
+
else {
|
|
124081
124268
|
moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
|
|
124082
124269
|
}
|
|
124083
124270
|
}
|
|
124084
124271
|
// If the file is the main module, it can be imported by the package name
|
|
124085
124272
|
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
124086
|
-
if (ts.isString(mainFileRelative)) {
|
|
124273
|
+
if (ts.isString(mainFileRelative) && !(maybeBlockedByTypesVersions && ts.matchPatternOrExact(ts.tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
124274
|
+
// The 'main' file is also subject to mapping through typesVersions, and we couldn't come up with a path
|
|
124275
|
+
// explicitly through typesVersions, so if it matches a key in typesVersions now, it's not reachable.
|
|
124276
|
+
// (The only way this can happen is if some file in a package that's not resolvable from outside the
|
|
124277
|
+
// package got pulled into the program anyway, e.g. transitively through a file that *is* reachable. It
|
|
124278
|
+
// happens very easily in fourslash tests though, since every test file listed gets included. See
|
|
124279
|
+
// importNameCodeFix_typesVersions.ts for an example.)
|
|
124087
124280
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
124088
124281
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
124282
|
+
// ^ An arbitrary removal of file extension for this comparison is almost certainly wrong
|
|
124089
124283
|
return { packageRootPath: packageRootPath, moduleFileToTry: moduleFileToTry };
|
|
124090
124284
|
}
|
|
124091
124285
|
}
|
|
@@ -156486,7 +156680,7 @@ var ts;
|
|
|
156486
156680
|
return undefined;
|
|
156487
156681
|
return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
156488
156682
|
}
|
|
156489
|
-
if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
|
|
156683
|
+
if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
|
|
156490
156684
|
return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
|
|
156491
156685
|
}
|
|
156492
156686
|
if (!ts.isPropertyAccessExpression(parent))
|
|
@@ -161731,6 +161925,9 @@ var ts;
|
|
|
161731
161925
|
if (!containingDecl) {
|
|
161732
161926
|
return;
|
|
161733
161927
|
}
|
|
161928
|
+
if (ts.isFunctionLikeDeclaration(containingDecl) && containingDecl.body && ts.rangeContainsPosition(containingDecl.body, startPosition)) {
|
|
161929
|
+
return;
|
|
161930
|
+
}
|
|
161734
161931
|
var checker = program.getTypeChecker();
|
|
161735
161932
|
var signatureSymbol = containingDecl.symbol;
|
|
161736
161933
|
if (!signatureSymbol) {
|