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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220806";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -8761,7 +8761,7 @@ var ts;
|
|
|
8761
8761
|
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\""),
|
|
8762
8762
|
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"),
|
|
8763
8763
|
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."),
|
|
8764
|
-
|
|
8764
|
+
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."),
|
|
8765
8765
|
catch_or_finally_expected: diag(1472, ts.DiagnosticCategory.Error, "catch_or_finally_expected_1472", "'catch' or 'finally' expected."),
|
|
8766
8766
|
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."),
|
|
8767
8767
|
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."),
|
|
@@ -8769,6 +8769,11 @@ var ts;
|
|
|
8769
8769
|
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."),
|
|
8770
8770
|
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."),
|
|
8771
8771
|
Identifier_or_string_literal_expected: diag(1478, ts.DiagnosticCategory.Error, "Identifier_or_string_literal_expected_1478", "Identifier or string literal expected."),
|
|
8772
|
+
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."),
|
|
8773
|
+
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\" }`."),
|
|
8774
|
+
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}'."),
|
|
8775
|
+
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}'."),
|
|
8776
|
+
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\" }`."),
|
|
8772
8777
|
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."),
|
|
8773
8778
|
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."),
|
|
8774
8779
|
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),
|
|
@@ -22063,7 +22068,7 @@ var ts;
|
|
|
22063
22068
|
* Wraps an expression in parentheses if it is needed in order to use the expression for
|
|
22064
22069
|
* property or element access.
|
|
22065
22070
|
*/
|
|
22066
|
-
function parenthesizeLeftSideOfAccess(expression) {
|
|
22071
|
+
function parenthesizeLeftSideOfAccess(expression, optionalChain) {
|
|
22067
22072
|
// isLeftHandSideExpression is almost the correct criterion for when it is not necessary
|
|
22068
22073
|
// to parenthesize the expression before a dot. The known exception is:
|
|
22069
22074
|
//
|
|
@@ -22072,7 +22077,8 @@ var ts;
|
|
|
22072
22077
|
//
|
|
22073
22078
|
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
|
|
22074
22079
|
if (ts.isLeftHandSideExpression(emittedExpression)
|
|
22075
|
-
&& (emittedExpression.kind !== 209 /* NewExpression */ || emittedExpression.arguments)
|
|
22080
|
+
&& (emittedExpression.kind !== 209 /* NewExpression */ || emittedExpression.arguments)
|
|
22081
|
+
&& (optionalChain || !ts.isOptionalChain(emittedExpression))) {
|
|
22076
22082
|
// TODO(rbuckton): Verify whether this assertion holds.
|
|
22077
22083
|
return expression;
|
|
22078
22084
|
}
|
|
@@ -23479,7 +23485,7 @@ var ts;
|
|
|
23479
23485
|
// @api
|
|
23480
23486
|
function createDecorator(expression) {
|
|
23481
23487
|
var node = createBaseNode(165 /* Decorator */);
|
|
23482
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
23488
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
23483
23489
|
node.transformFlags |=
|
|
23484
23490
|
propagateChildFlags(node.expression) |
|
|
23485
23491
|
1 /* ContainsTypeScript */ |
|
|
@@ -24280,7 +24286,7 @@ var ts;
|
|
|
24280
24286
|
// @api
|
|
24281
24287
|
function createPropertyAccessExpression(expression, name) {
|
|
24282
24288
|
var node = createBaseExpression(206 /* PropertyAccessExpression */);
|
|
24283
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24289
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24284
24290
|
node.name = asName(name);
|
|
24285
24291
|
node.transformFlags =
|
|
24286
24292
|
propagateChildFlags(node.expression) |
|
|
@@ -24310,7 +24316,7 @@ var ts;
|
|
|
24310
24316
|
function createPropertyAccessChain(expression, questionDotToken, name) {
|
|
24311
24317
|
var node = createBaseExpression(206 /* PropertyAccessExpression */);
|
|
24312
24318
|
node.flags |= 32 /* OptionalChain */;
|
|
24313
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24319
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24314
24320
|
node.questionDotToken = questionDotToken;
|
|
24315
24321
|
node.name = asName(name);
|
|
24316
24322
|
node.transformFlags |=
|
|
@@ -24336,7 +24342,7 @@ var ts;
|
|
|
24336
24342
|
// @api
|
|
24337
24343
|
function createElementAccessExpression(expression, index) {
|
|
24338
24344
|
var node = createBaseExpression(207 /* ElementAccessExpression */);
|
|
24339
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24345
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24340
24346
|
node.argumentExpression = asExpression(index);
|
|
24341
24347
|
node.transformFlags |=
|
|
24342
24348
|
propagateChildFlags(node.expression) |
|
|
@@ -24364,7 +24370,7 @@ var ts;
|
|
|
24364
24370
|
function createElementAccessChain(expression, questionDotToken, index) {
|
|
24365
24371
|
var node = createBaseExpression(207 /* ElementAccessExpression */);
|
|
24366
24372
|
node.flags |= 32 /* OptionalChain */;
|
|
24367
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24373
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24368
24374
|
node.questionDotToken = questionDotToken;
|
|
24369
24375
|
node.argumentExpression = asExpression(index);
|
|
24370
24376
|
node.transformFlags |=
|
|
@@ -24388,7 +24394,7 @@ var ts;
|
|
|
24388
24394
|
// @api
|
|
24389
24395
|
function createCallExpression(expression, typeArguments, argumentsArray) {
|
|
24390
24396
|
var node = createBaseExpression(208 /* CallExpression */);
|
|
24391
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24397
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24392
24398
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24393
24399
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
24394
24400
|
node.transformFlags |=
|
|
@@ -24421,7 +24427,7 @@ var ts;
|
|
|
24421
24427
|
function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) {
|
|
24422
24428
|
var node = createBaseExpression(208 /* CallExpression */);
|
|
24423
24429
|
node.flags |= 32 /* OptionalChain */;
|
|
24424
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24430
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24425
24431
|
node.questionDotToken = questionDotToken;
|
|
24426
24432
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24427
24433
|
node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray));
|
|
@@ -24476,7 +24482,7 @@ var ts;
|
|
|
24476
24482
|
// @api
|
|
24477
24483
|
function createTaggedTemplateExpression(tag, typeArguments, template) {
|
|
24478
24484
|
var node = createBaseExpression(210 /* TaggedTemplateExpression */);
|
|
24479
|
-
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag);
|
|
24485
|
+
node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false);
|
|
24480
24486
|
node.typeArguments = asNodeArray(typeArguments);
|
|
24481
24487
|
node.template = template;
|
|
24482
24488
|
node.transformFlags |=
|
|
@@ -24914,7 +24920,7 @@ var ts;
|
|
|
24914
24920
|
// @api
|
|
24915
24921
|
function createExpressionWithTypeArguments(expression, typeArguments) {
|
|
24916
24922
|
var node = createBaseNode(228 /* ExpressionWithTypeArguments */);
|
|
24917
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24923
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24918
24924
|
node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments);
|
|
24919
24925
|
node.transformFlags |=
|
|
24920
24926
|
propagateChildFlags(node.expression) |
|
|
@@ -24950,7 +24956,7 @@ var ts;
|
|
|
24950
24956
|
// @api
|
|
24951
24957
|
function createNonNullExpression(expression) {
|
|
24952
24958
|
var node = createBaseExpression(230 /* NonNullExpression */);
|
|
24953
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24959
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
24954
24960
|
node.transformFlags |=
|
|
24955
24961
|
propagateChildFlags(node.expression) |
|
|
24956
24962
|
1 /* ContainsTypeScript */;
|
|
@@ -24969,7 +24975,7 @@ var ts;
|
|
|
24969
24975
|
function createNonNullChain(expression) {
|
|
24970
24976
|
var node = createBaseExpression(230 /* NonNullExpression */);
|
|
24971
24977
|
node.flags |= 32 /* OptionalChain */;
|
|
24972
|
-
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
24978
|
+
node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true);
|
|
24973
24979
|
node.transformFlags |=
|
|
24974
24980
|
propagateChildFlags(node.expression) |
|
|
24975
24981
|
1 /* ContainsTypeScript */;
|
|
@@ -27173,7 +27179,7 @@ var ts;
|
|
|
27173
27179
|
}
|
|
27174
27180
|
else if (ts.getEmitFlags(callee) & 4096 /* HelperName */) {
|
|
27175
27181
|
thisArg = createVoidZero();
|
|
27176
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee);
|
|
27182
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(callee, /*optionalChain*/ false);
|
|
27177
27183
|
}
|
|
27178
27184
|
else if (ts.isPropertyAccessExpression(callee)) {
|
|
27179
27185
|
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
|
|
@@ -27202,7 +27208,7 @@ var ts;
|
|
|
27202
27208
|
else {
|
|
27203
27209
|
// for `a()` target is `a` and thisArg is `void 0`
|
|
27204
27210
|
thisArg = createVoidZero();
|
|
27205
|
-
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression);
|
|
27211
|
+
target = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false);
|
|
27206
27212
|
}
|
|
27207
27213
|
return { target: target, thisArg: thisArg };
|
|
27208
27214
|
}
|
|
@@ -51877,7 +51883,40 @@ var ts;
|
|
|
51877
51883
|
// An override clause will take effect for type-only imports and import types, and allows importing the types across formats, regardless of
|
|
51878
51884
|
// normal mode restrictions
|
|
51879
51885
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51880
|
-
|
|
51886
|
+
if (ts.findAncestor(location, ts.isImportEqualsDeclaration)) {
|
|
51887
|
+
// ImportEquals in a ESM file resolving to another ESM file
|
|
51888
|
+
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);
|
|
51889
|
+
}
|
|
51890
|
+
else {
|
|
51891
|
+
// CJS file resolving to an ESM file
|
|
51892
|
+
var diagnosticDetails = void 0;
|
|
51893
|
+
var ext = ts.tryGetExtensionFromPath(currentSourceFile.fileName);
|
|
51894
|
+
if (ext === ".ts" /* Ts */ || ext === ".js" /* Js */ || ext === ".tsx" /* Tsx */ || ext === ".jsx" /* Jsx */) {
|
|
51895
|
+
var scope = currentSourceFile.packageJsonScope;
|
|
51896
|
+
var targetExt = ext === ".ts" /* Ts */ ? ".mts" /* Mts */ : ext === ".js" /* Js */ ? ".mjs" /* Mjs */ : undefined;
|
|
51897
|
+
if (scope && !scope.packageJsonContent.type) {
|
|
51898
|
+
if (targetExt) {
|
|
51899
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51900
|
+
/*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"));
|
|
51901
|
+
}
|
|
51902
|
+
else {
|
|
51903
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51904
|
+
/*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"));
|
|
51905
|
+
}
|
|
51906
|
+
}
|
|
51907
|
+
else {
|
|
51908
|
+
if (targetExt) {
|
|
51909
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51910
|
+
/*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);
|
|
51911
|
+
}
|
|
51912
|
+
else {
|
|
51913
|
+
diagnosticDetails = ts.chainDiagnosticMessages(
|
|
51914
|
+
/*details*/ undefined, ts.Diagnostics.To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module);
|
|
51915
|
+
}
|
|
51916
|
+
}
|
|
51917
|
+
}
|
|
51918
|
+
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)));
|
|
51919
|
+
}
|
|
51881
51920
|
}
|
|
51882
51921
|
}
|
|
51883
51922
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
@@ -73385,12 +73424,15 @@ var ts;
|
|
|
73385
73424
|
if (contextualReturnType) {
|
|
73386
73425
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73387
73426
|
if (functionFlags & 1 /* Generator */) { // Generator or AsyncGenerator function
|
|
73388
|
-
var
|
|
73389
|
-
|
|
73390
|
-
|
|
73427
|
+
var isAsyncGenerator_1 = (functionFlags & 2 /* Async */) !== 0;
|
|
73428
|
+
if (contextualReturnType.flags & 1048576 /* Union */) {
|
|
73429
|
+
contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_1); });
|
|
73430
|
+
}
|
|
73431
|
+
var iterationReturnType = getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, contextualReturnType, (functionFlags & 2 /* Async */) !== 0);
|
|
73432
|
+
if (!iterationReturnType) {
|
|
73391
73433
|
return undefined;
|
|
73392
73434
|
}
|
|
73393
|
-
contextualReturnType =
|
|
73435
|
+
contextualReturnType = iterationReturnType;
|
|
73394
73436
|
// falls through to unwrap Promise for AsyncGenerators
|
|
73395
73437
|
}
|
|
73396
73438
|
if (functionFlags & 2 /* Async */) { // Async function or AsyncGenerator function
|
|
@@ -73417,9 +73459,13 @@ var ts;
|
|
|
73417
73459
|
var functionFlags = ts.getFunctionFlags(func);
|
|
73418
73460
|
var contextualReturnType = getContextualReturnType(func, contextFlags);
|
|
73419
73461
|
if (contextualReturnType) {
|
|
73462
|
+
var isAsyncGenerator_2 = (functionFlags & 2 /* Async */) !== 0;
|
|
73463
|
+
if (!node.asteriskToken && contextualReturnType.flags & 1048576 /* Union */) {
|
|
73464
|
+
contextualReturnType = filterType(contextualReturnType, function (type) { return !!getIterationTypeOfGeneratorFunctionReturnType(1 /* Return */, type, isAsyncGenerator_2); });
|
|
73465
|
+
}
|
|
73420
73466
|
return node.asteriskToken
|
|
73421
73467
|
? contextualReturnType
|
|
73422
|
-
: getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType,
|
|
73468
|
+
: getIterationTypeOfGeneratorFunctionReturnType(0 /* Yield */, contextualReturnType, isAsyncGenerator_2);
|
|
73423
73469
|
}
|
|
73424
73470
|
}
|
|
73425
73471
|
return undefined;
|
|
@@ -84194,17 +84240,28 @@ var ts;
|
|
|
84194
84240
|
* the `[Symbol.asyncIterator]()` method first, and then the `[Symbol.iterator]()` method.
|
|
84195
84241
|
*/
|
|
84196
84242
|
function getIterationTypesOfIterable(type, use, errorNode) {
|
|
84243
|
+
var _a, _b;
|
|
84197
84244
|
if (isTypeAny(type)) {
|
|
84198
84245
|
return anyIterationTypes;
|
|
84199
84246
|
}
|
|
84200
84247
|
if (!(type.flags & 1048576 /* Union */)) {
|
|
84201
|
-
var
|
|
84248
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
84249
|
+
var iterationTypes_1 = getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer);
|
|
84202
84250
|
if (iterationTypes_1 === noIterationTypes) {
|
|
84203
84251
|
if (errorNode) {
|
|
84204
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84252
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84253
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
84254
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
84255
|
+
}
|
|
84205
84256
|
}
|
|
84206
84257
|
return undefined;
|
|
84207
84258
|
}
|
|
84259
|
+
else if ((_a = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _a === void 0 ? void 0 : _a.length) {
|
|
84260
|
+
for (var _i = 0, _c = errorOutputContainer.errors; _i < _c.length; _i++) {
|
|
84261
|
+
var diag = _c[_i];
|
|
84262
|
+
diagnostics.add(diag);
|
|
84263
|
+
}
|
|
84264
|
+
}
|
|
84208
84265
|
return iterationTypes_1;
|
|
84209
84266
|
}
|
|
84210
84267
|
var cacheKey = use & 2 /* AllowsAsyncIterablesFlag */ ? "iterationTypesOfAsyncIterable" : "iterationTypesOfIterable";
|
|
@@ -84212,19 +84269,27 @@ var ts;
|
|
|
84212
84269
|
if (cachedTypes)
|
|
84213
84270
|
return cachedTypes === noIterationTypes ? undefined : cachedTypes;
|
|
84214
84271
|
var allIterationTypes;
|
|
84215
|
-
for (var
|
|
84216
|
-
var constituent =
|
|
84217
|
-
var
|
|
84272
|
+
for (var _d = 0, _e = type.types; _d < _e.length; _d++) {
|
|
84273
|
+
var constituent = _e[_d];
|
|
84274
|
+
var errorOutputContainer = errorNode ? { errors: undefined } : undefined;
|
|
84275
|
+
var iterationTypes_2 = getIterationTypesOfIterableWorker(constituent, use, errorNode, errorOutputContainer);
|
|
84218
84276
|
if (iterationTypes_2 === noIterationTypes) {
|
|
84219
84277
|
if (errorNode) {
|
|
84220
|
-
reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84278
|
+
var rootDiag = reportTypeNotIterableError(errorNode, type, !!(use & 2 /* AllowsAsyncIterablesFlag */));
|
|
84279
|
+
if (errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) {
|
|
84280
|
+
ts.addRelatedInfo.apply(void 0, __spreadArray([rootDiag], errorOutputContainer.errors, false));
|
|
84281
|
+
}
|
|
84221
84282
|
}
|
|
84222
84283
|
setCachedIterationTypes(type, cacheKey, noIterationTypes);
|
|
84223
84284
|
return undefined;
|
|
84224
84285
|
}
|
|
84225
|
-
else {
|
|
84226
|
-
|
|
84286
|
+
else if ((_b = errorOutputContainer === null || errorOutputContainer === void 0 ? void 0 : errorOutputContainer.errors) === null || _b === void 0 ? void 0 : _b.length) {
|
|
84287
|
+
for (var _f = 0, _g = errorOutputContainer.errors; _f < _g.length; _f++) {
|
|
84288
|
+
var diag = _g[_f];
|
|
84289
|
+
diagnostics.add(diag);
|
|
84290
|
+
}
|
|
84227
84291
|
}
|
|
84292
|
+
allIterationTypes = ts.append(allIterationTypes, iterationTypes_2);
|
|
84228
84293
|
}
|
|
84229
84294
|
var iterationTypes = allIterationTypes ? combineIterationTypes(allIterationTypes) : noIterationTypes;
|
|
84230
84295
|
setCachedIterationTypes(type, cacheKey, iterationTypes);
|
|
@@ -84252,47 +84317,62 @@ var ts;
|
|
|
84252
84317
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84253
84318
|
* `getIterationTypesOfIterable` instead.
|
|
84254
84319
|
*/
|
|
84255
|
-
function getIterationTypesOfIterableWorker(type, use, errorNode) {
|
|
84320
|
+
function getIterationTypesOfIterableWorker(type, use, errorNode, errorOutputContainer) {
|
|
84256
84321
|
if (isTypeAny(type)) {
|
|
84257
84322
|
return anyIterationTypes;
|
|
84258
84323
|
}
|
|
84324
|
+
// If we are reporting errors and encounter a cached `noIterationTypes`, we should ignore the cached value and continue as if nothing was cached.
|
|
84325
|
+
// In addition, we should not cache any new results for this call.
|
|
84326
|
+
var noCache = false;
|
|
84259
84327
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84260
84328
|
var iterationTypes = getIterationTypesOfIterableCached(type, asyncIterationTypesResolver) ||
|
|
84261
84329
|
getIterationTypesOfIterableFast(type, asyncIterationTypesResolver);
|
|
84262
84330
|
if (iterationTypes) {
|
|
84263
|
-
|
|
84264
|
-
|
|
84265
|
-
|
|
84331
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84332
|
+
// ignore the cached value
|
|
84333
|
+
noCache = true;
|
|
84334
|
+
}
|
|
84335
|
+
else {
|
|
84336
|
+
return use & 8 /* ForOfFlag */ ?
|
|
84337
|
+
getAsyncFromSyncIterationTypes(iterationTypes, errorNode) :
|
|
84338
|
+
iterationTypes;
|
|
84339
|
+
}
|
|
84266
84340
|
}
|
|
84267
84341
|
}
|
|
84268
84342
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84269
84343
|
var iterationTypes = getIterationTypesOfIterableCached(type, syncIterationTypesResolver) ||
|
|
84270
84344
|
getIterationTypesOfIterableFast(type, syncIterationTypesResolver);
|
|
84271
84345
|
if (iterationTypes) {
|
|
84272
|
-
if (
|
|
84273
|
-
//
|
|
84274
|
-
|
|
84275
|
-
return setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", getAsyncFromSyncIterationTypes(iterationTypes, errorNode));
|
|
84276
|
-
}
|
|
84346
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84347
|
+
// ignore the cached value
|
|
84348
|
+
noCache = true;
|
|
84277
84349
|
}
|
|
84278
84350
|
else {
|
|
84279
|
-
|
|
84351
|
+
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84352
|
+
// for a sync iterable in an async context, only use the cached types if they are valid.
|
|
84353
|
+
if (iterationTypes !== noIterationTypes) {
|
|
84354
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
84355
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
84356
|
+
}
|
|
84357
|
+
}
|
|
84358
|
+
else {
|
|
84359
|
+
return iterationTypes;
|
|
84360
|
+
}
|
|
84280
84361
|
}
|
|
84281
84362
|
}
|
|
84282
84363
|
}
|
|
84283
84364
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84284
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode);
|
|
84365
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, asyncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84285
84366
|
if (iterationTypes !== noIterationTypes) {
|
|
84286
84367
|
return iterationTypes;
|
|
84287
84368
|
}
|
|
84288
84369
|
}
|
|
84289
84370
|
if (use & 1 /* AllowsSyncIterablesFlag */) {
|
|
84290
|
-
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode);
|
|
84371
|
+
var iterationTypes = getIterationTypesOfIterableSlow(type, syncIterationTypesResolver, errorNode, errorOutputContainer, noCache);
|
|
84291
84372
|
if (iterationTypes !== noIterationTypes) {
|
|
84292
84373
|
if (use & 2 /* AllowsAsyncIterablesFlag */) {
|
|
84293
|
-
|
|
84294
|
-
|
|
84295
|
-
: noIterationTypes);
|
|
84374
|
+
iterationTypes = getAsyncFromSyncIterationTypes(iterationTypes, errorNode);
|
|
84375
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, "iterationTypesOfAsyncIterable", iterationTypes);
|
|
84296
84376
|
}
|
|
84297
84377
|
else {
|
|
84298
84378
|
return iterationTypes;
|
|
@@ -84313,7 +84393,7 @@ var ts;
|
|
|
84313
84393
|
}
|
|
84314
84394
|
function getIterationTypesOfGlobalIterableType(globalType, resolver) {
|
|
84315
84395
|
var globalIterationTypes = getIterationTypesOfIterableCached(globalType, resolver) ||
|
|
84316
|
-
getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined);
|
|
84396
|
+
getIterationTypesOfIterableSlow(globalType, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined, /*noCache*/ false);
|
|
84317
84397
|
return globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes;
|
|
84318
84398
|
}
|
|
84319
84399
|
/**
|
|
@@ -84367,40 +84447,56 @@ var ts;
|
|
|
84367
84447
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84368
84448
|
* `getIterationTypesOfIterable` instead.
|
|
84369
84449
|
*/
|
|
84370
|
-
function getIterationTypesOfIterableSlow(type, resolver, errorNode) {
|
|
84450
|
+
function getIterationTypesOfIterableSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84371
84451
|
var _a;
|
|
84372
84452
|
var method = getPropertyOfType(type, getPropertyNameForKnownSymbolName(resolver.iteratorSymbolName));
|
|
84373
84453
|
var methodType = method && !(method.flags & 16777216 /* Optional */) ? getTypeOfSymbol(method) : undefined;
|
|
84374
84454
|
if (isTypeAny(methodType)) {
|
|
84375
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
84455
|
+
return noCache ? anyIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, anyIterationTypes);
|
|
84376
84456
|
}
|
|
84377
84457
|
var signatures = methodType ? getSignaturesOfType(methodType, 0 /* Call */) : undefined;
|
|
84378
84458
|
if (!ts.some(signatures)) {
|
|
84379
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
84459
|
+
return noCache ? noIterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, noIterationTypes);
|
|
84380
84460
|
}
|
|
84381
84461
|
var iteratorType = getIntersectionType(ts.map(signatures, getReturnTypeOfSignature));
|
|
84382
|
-
var iterationTypes = (_a =
|
|
84383
|
-
return setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
84462
|
+
var iterationTypes = (_a = getIterationTypesOfIteratorWorker(iteratorType, resolver, errorNode, errorOutputContainer, noCache)) !== null && _a !== void 0 ? _a : noIterationTypes;
|
|
84463
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iterableCacheKey, iterationTypes);
|
|
84384
84464
|
}
|
|
84385
84465
|
function reportTypeNotIterableError(errorNode, type, allowAsyncIterables) {
|
|
84386
84466
|
var message = allowAsyncIterables
|
|
84387
84467
|
? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator
|
|
84388
84468
|
: ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator;
|
|
84389
|
-
errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
84469
|
+
return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type));
|
|
84470
|
+
}
|
|
84471
|
+
/**
|
|
84472
|
+
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
84473
|
+
*
|
|
84474
|
+
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84475
|
+
* record is returned. Otherwise, `undefined` is returned.
|
|
84476
|
+
*/
|
|
84477
|
+
function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) {
|
|
84478
|
+
return getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, /*noCache*/ false);
|
|
84390
84479
|
}
|
|
84391
84480
|
/**
|
|
84392
84481
|
* Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type.
|
|
84393
84482
|
*
|
|
84394
84483
|
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84395
84484
|
* record is returned. Otherwise, `undefined` is returned.
|
|
84485
|
+
*
|
|
84486
|
+
* NOTE: You probably don't want to call this directly and should be calling
|
|
84487
|
+
* `getIterationTypesOfIterator` instead.
|
|
84396
84488
|
*/
|
|
84397
|
-
function
|
|
84489
|
+
function getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84398
84490
|
if (isTypeAny(type)) {
|
|
84399
84491
|
return anyIterationTypes;
|
|
84400
84492
|
}
|
|
84401
84493
|
var iterationTypes = getIterationTypesOfIteratorCached(type, resolver) ||
|
|
84402
|
-
getIterationTypesOfIteratorFast(type, resolver)
|
|
84403
|
-
|
|
84494
|
+
getIterationTypesOfIteratorFast(type, resolver);
|
|
84495
|
+
if (iterationTypes === noIterationTypes && errorNode) {
|
|
84496
|
+
iterationTypes = undefined;
|
|
84497
|
+
noCache = true;
|
|
84498
|
+
}
|
|
84499
|
+
iterationTypes !== null && iterationTypes !== void 0 ? iterationTypes : (iterationTypes = getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache));
|
|
84404
84500
|
return iterationTypes === noIterationTypes ? undefined : iterationTypes;
|
|
84405
84501
|
}
|
|
84406
84502
|
/**
|
|
@@ -84438,7 +84534,7 @@ var ts;
|
|
|
84438
84534
|
// iteration types of their `next`, `return`, and `throw` methods. While we define these as `any`
|
|
84439
84535
|
// and `undefined` in our libs by default, a custom lib *could* use different definitions.
|
|
84440
84536
|
var globalIterationTypes = getIterationTypesOfIteratorCached(globalType, resolver) ||
|
|
84441
|
-
getIterationTypesOfIteratorSlow(globalType, resolver, /*errorNode*/ undefined);
|
|
84537
|
+
getIterationTypesOfIteratorSlow(globalType, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined, /*noCache*/ false);
|
|
84442
84538
|
var _a = globalIterationTypes === noIterationTypes ? defaultIterationTypes : globalIterationTypes, returnType = _a.returnType, nextType = _a.nextType;
|
|
84443
84539
|
return setCachedIterationTypes(type, resolver.iteratorCacheKey, createIterationTypes(yieldType, returnType, nextType));
|
|
84444
84540
|
}
|
|
@@ -84508,8 +84604,8 @@ var ts;
|
|
|
84508
84604
|
* If we successfully found the *yield*, *return*, and *next* types, an `IterationTypes`
|
|
84509
84605
|
* record is returned. Otherwise, we return `undefined`.
|
|
84510
84606
|
*/
|
|
84511
|
-
function getIterationTypesOfMethod(type, resolver, methodName, errorNode) {
|
|
84512
|
-
var _a, _b, _c, _d;
|
|
84607
|
+
function getIterationTypesOfMethod(type, resolver, methodName, errorNode, errorOutputContainer) {
|
|
84608
|
+
var _a, _b, _c, _d, _e, _f;
|
|
84513
84609
|
var method = getPropertyOfType(type, methodName);
|
|
84514
84610
|
// Ignore 'return' or 'throw' if they are missing.
|
|
84515
84611
|
if (!method && methodName !== "next") {
|
|
@@ -84529,9 +84625,15 @@ var ts;
|
|
|
84529
84625
|
var diagnostic = methodName === "next"
|
|
84530
84626
|
? resolver.mustHaveANextMethodDiagnostic
|
|
84531
84627
|
: resolver.mustBeAMethodDiagnostic;
|
|
84532
|
-
|
|
84628
|
+
if (errorOutputContainer) {
|
|
84629
|
+
(_a = errorOutputContainer.errors) !== null && _a !== void 0 ? _a : (errorOutputContainer.errors = []);
|
|
84630
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, diagnostic, methodName));
|
|
84631
|
+
}
|
|
84632
|
+
else {
|
|
84633
|
+
error(errorNode, diagnostic, methodName);
|
|
84634
|
+
}
|
|
84533
84635
|
}
|
|
84534
|
-
return methodName === "next" ?
|
|
84636
|
+
return methodName === "next" ? noIterationTypes : undefined;
|
|
84535
84637
|
}
|
|
84536
84638
|
// If the method signature comes exclusively from the global iterator or generator type,
|
|
84537
84639
|
// create iteration types from its type arguments like `getIterationTypesOfIteratorFast`
|
|
@@ -84543,8 +84645,8 @@ var ts;
|
|
|
84543
84645
|
if ((methodType === null || methodType === void 0 ? void 0 : methodType.symbol) && methodSignatures.length === 1) {
|
|
84544
84646
|
var globalGeneratorType = resolver.getGlobalGeneratorType(/*reportErrors*/ false);
|
|
84545
84647
|
var globalIteratorType = resolver.getGlobalIteratorType(/*reportErrors*/ false);
|
|
84546
|
-
var isGeneratorMethod = ((
|
|
84547
|
-
var isIteratorMethod = !isGeneratorMethod && ((
|
|
84648
|
+
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;
|
|
84649
|
+
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;
|
|
84548
84650
|
if (isGeneratorMethod || isIteratorMethod) {
|
|
84549
84651
|
var globalType = isGeneratorMethod ? globalGeneratorType : globalIteratorType;
|
|
84550
84652
|
var mapper = methodType.mapper;
|
|
@@ -84584,7 +84686,13 @@ var ts;
|
|
|
84584
84686
|
var iterationTypes = getIterationTypesOfIteratorResult(resolvedMethodReturnType);
|
|
84585
84687
|
if (iterationTypes === noIterationTypes) {
|
|
84586
84688
|
if (errorNode) {
|
|
84587
|
-
|
|
84689
|
+
if (errorOutputContainer) {
|
|
84690
|
+
(_f = errorOutputContainer.errors) !== null && _f !== void 0 ? _f : (errorOutputContainer.errors = []);
|
|
84691
|
+
errorOutputContainer.errors.push(ts.createDiagnosticForNode(errorNode, resolver.mustHaveAValueDiagnostic, methodName));
|
|
84692
|
+
}
|
|
84693
|
+
else {
|
|
84694
|
+
error(errorNode, resolver.mustHaveAValueDiagnostic, methodName);
|
|
84695
|
+
}
|
|
84588
84696
|
}
|
|
84589
84697
|
yieldType = anyType;
|
|
84590
84698
|
returnTypes = ts.append(returnTypes, anyType);
|
|
@@ -84605,13 +84713,13 @@ var ts;
|
|
|
84605
84713
|
* NOTE: You probably don't want to call this directly and should be calling
|
|
84606
84714
|
* `getIterationTypesOfIterator` instead.
|
|
84607
84715
|
*/
|
|
84608
|
-
function getIterationTypesOfIteratorSlow(type, resolver, errorNode) {
|
|
84716
|
+
function getIterationTypesOfIteratorSlow(type, resolver, errorNode, errorOutputContainer, noCache) {
|
|
84609
84717
|
var iterationTypes = combineIterationTypes([
|
|
84610
|
-
getIterationTypesOfMethod(type, resolver, "next", errorNode),
|
|
84611
|
-
getIterationTypesOfMethod(type, resolver, "return", errorNode),
|
|
84612
|
-
getIterationTypesOfMethod(type, resolver, "throw", errorNode),
|
|
84718
|
+
getIterationTypesOfMethod(type, resolver, "next", errorNode, errorOutputContainer),
|
|
84719
|
+
getIterationTypesOfMethod(type, resolver, "return", errorNode, errorOutputContainer),
|
|
84720
|
+
getIterationTypesOfMethod(type, resolver, "throw", errorNode, errorOutputContainer),
|
|
84613
84721
|
]);
|
|
84614
|
-
return setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
84722
|
+
return noCache ? iterationTypes : setCachedIterationTypes(type, resolver.iteratorCacheKey, iterationTypes);
|
|
84615
84723
|
}
|
|
84616
84724
|
/**
|
|
84617
84725
|
* Gets the requested "iteration type" from a type that is either `Iterable`-like, `Iterator`-like,
|
|
@@ -84632,7 +84740,7 @@ var ts;
|
|
|
84632
84740
|
var use = isAsyncGenerator ? 2 /* AsyncGeneratorReturnType */ : 1 /* GeneratorReturnType */;
|
|
84633
84741
|
var resolver = isAsyncGenerator ? asyncIterationTypesResolver : syncIterationTypesResolver;
|
|
84634
84742
|
return getIterationTypesOfIterable(type, use, /*errorNode*/ undefined) ||
|
|
84635
|
-
getIterationTypesOfIterator(type, resolver, /*errorNode*/ undefined);
|
|
84743
|
+
getIterationTypesOfIterator(type, resolver, /*errorNode*/ undefined, /*errorOutputContainer*/ undefined);
|
|
84636
84744
|
}
|
|
84637
84745
|
function checkBreakOrContinueStatement(node) {
|
|
84638
84746
|
// Grammar checking
|
|
@@ -122929,8 +123037,6 @@ var ts;
|
|
|
122929
123037
|
if (watcher.files === 0 && watcher.resolutions === 0) {
|
|
122930
123038
|
fileWatchesOfAffectingLocations.delete(path);
|
|
122931
123039
|
watcher.watcher.close();
|
|
122932
|
-
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
122933
|
-
watcher.watcher = ts.noopFileWatcher;
|
|
122934
123040
|
}
|
|
122935
123041
|
});
|
|
122936
123042
|
hasChangedAutomaticTypeDirectiveNames = false;
|
|
@@ -123276,20 +123382,27 @@ var ts;
|
|
|
123276
123382
|
}
|
|
123277
123383
|
var paths = new ts.Set();
|
|
123278
123384
|
paths.add(locationToWatch);
|
|
123385
|
+
var actualWatcher = canWatchDirectoryOrFile(resolutionHost.toPath(locationToWatch)) ?
|
|
123386
|
+
resolutionHost.watchAffectingFileLocation(locationToWatch, function (fileName, eventKind) {
|
|
123387
|
+
cachedDirectoryStructureHost === null || cachedDirectoryStructureHost === void 0 ? void 0 : cachedDirectoryStructureHost.addOrDeleteFile(fileName, resolutionHost.toPath(locationToWatch), eventKind);
|
|
123388
|
+
var packageJsonMap = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap();
|
|
123389
|
+
paths.forEach(function (path) {
|
|
123390
|
+
if (watcher.resolutions)
|
|
123391
|
+
(affectingPathChecks !== null && affectingPathChecks !== void 0 ? affectingPathChecks : (affectingPathChecks = new ts.Set())).add(path);
|
|
123392
|
+
if (watcher.files)
|
|
123393
|
+
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123394
|
+
packageJsonMap === null || packageJsonMap === void 0 ? void 0 : packageJsonMap.delete(resolutionHost.toPath(path));
|
|
123395
|
+
});
|
|
123396
|
+
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123397
|
+
}) : ts.noopFileWatcher;
|
|
123279
123398
|
var watcher = {
|
|
123280
|
-
watcher:
|
|
123281
|
-
|
|
123282
|
-
|
|
123283
|
-
|
|
123284
|
-
|
|
123285
|
-
|
|
123286
|
-
|
|
123287
|
-
if (watcher.files)
|
|
123288
|
-
(affectingPathChecksForFile !== null && affectingPathChecksForFile !== void 0 ? affectingPathChecksForFile : (affectingPathChecksForFile = new ts.Set())).add(path);
|
|
123289
|
-
(_a = moduleResolutionCache.getPackageJsonInfoCache().getInternalMap()) === null || _a === void 0 ? void 0 : _a.delete(resolutionHost.toPath(path));
|
|
123290
|
-
});
|
|
123291
|
-
resolutionHost.scheduleInvalidateResolutionsOfFailedLookupLocations();
|
|
123292
|
-
}) : ts.noopFileWatcher,
|
|
123399
|
+
watcher: actualWatcher !== ts.noopFileWatcher ? {
|
|
123400
|
+
close: function () {
|
|
123401
|
+
actualWatcher.close();
|
|
123402
|
+
// Ensure when watching symlinked package.json, we can close the actual file watcher only once
|
|
123403
|
+
actualWatcher = ts.noopFileWatcher;
|
|
123404
|
+
}
|
|
123405
|
+
} : actualWatcher,
|
|
123293
123406
|
resolutions: forResolution ? 1 : 0,
|
|
123294
123407
|
files: forResolution ? 0 : 1,
|
|
123295
123408
|
paths: paths,
|
|
@@ -123703,7 +123816,7 @@ var ts;
|
|
|
123703
123816
|
var info = getInfo(importingSourceFileName, host);
|
|
123704
123817
|
var modulePaths = getAllModulePaths(importingSourceFileName, toFileName, host, userPreferences, options);
|
|
123705
123818
|
return ts.firstDefined(modulePaths, function (modulePath) { return tryGetModuleNameAsNodeModule(modulePath, info, importingSourceFile, host, compilerOptions, userPreferences, /*packageNameOnly*/ undefined, options.overrideImportMode); }) ||
|
|
123706
|
-
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, preferences);
|
|
123819
|
+
getLocalModuleSpecifier(toFileName, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
123707
123820
|
}
|
|
123708
123821
|
function tryGetModuleSpecifiersFromCache(moduleSymbol, importingSourceFile, host, userPreferences, options) {
|
|
123709
123822
|
if (options === void 0) { options = {}; }
|
|
@@ -123786,7 +123899,7 @@ var ts;
|
|
|
123786
123899
|
return nodeModulesSpecifiers;
|
|
123787
123900
|
}
|
|
123788
123901
|
if (!specifier && !modulePath.isRedirect) {
|
|
123789
|
-
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, preferences);
|
|
123902
|
+
var local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
123790
123903
|
if (ts.pathIsBareSpecifier(local)) {
|
|
123791
123904
|
pathsSpecifiers = ts.append(pathsSpecifiers, local);
|
|
123792
123905
|
}
|
|
@@ -123814,7 +123927,7 @@ var ts;
|
|
|
123814
123927
|
var sourceDirectory = ts.getDirectoryPath(importingSourceFileName);
|
|
123815
123928
|
return { getCanonicalFileName: getCanonicalFileName, importingSourceFileName: importingSourceFileName, sourceDirectory: sourceDirectory };
|
|
123816
123929
|
}
|
|
123817
|
-
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, _a) {
|
|
123930
|
+
function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, importMode, _a) {
|
|
123818
123931
|
var ending = _a.ending, relativePreference = _a.relativePreference;
|
|
123819
123932
|
var baseUrl = compilerOptions.baseUrl, paths = compilerOptions.paths, rootDirs = compilerOptions.rootDirs;
|
|
123820
123933
|
var sourceDirectory = info.sourceDirectory, getCanonicalFileName = info.getCanonicalFileName;
|
|
@@ -123828,9 +123941,8 @@ var ts;
|
|
|
123828
123941
|
if (!relativeToBaseUrl) {
|
|
123829
123942
|
return relativePath;
|
|
123830
123943
|
}
|
|
123831
|
-
var
|
|
123832
|
-
var
|
|
123833
|
-
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? importRelativeToBaseUrl : fromPaths;
|
|
123944
|
+
var fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
123945
|
+
var nonRelative = fromPaths === undefined && baseUrl !== undefined ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
123834
123946
|
if (!nonRelative) {
|
|
123835
123947
|
return relativePath;
|
|
123836
123948
|
}
|
|
@@ -124065,28 +124177,102 @@ var ts;
|
|
|
124065
124177
|
return ambientModuleDeclare.name.text;
|
|
124066
124178
|
}
|
|
124067
124179
|
}
|
|
124068
|
-
function
|
|
124180
|
+
function getAllowedEndings(preferredEnding, compilerOptions, importMode) {
|
|
124181
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && importMode === ts.ModuleKind.ESNext) {
|
|
124182
|
+
return [2 /* JsExtension */];
|
|
124183
|
+
}
|
|
124184
|
+
switch (preferredEnding) {
|
|
124185
|
+
case 2 /* JsExtension */: return [2 /* JsExtension */, 0 /* Minimal */, 1 /* Index */];
|
|
124186
|
+
case 1 /* Index */: return [1 /* Index */, 0 /* Minimal */, 2 /* JsExtension */];
|
|
124187
|
+
case 0 /* Minimal */: return [0 /* Minimal */, 1 /* Index */, 2 /* JsExtension */];
|
|
124188
|
+
default: ts.Debug.assertNever(preferredEnding);
|
|
124189
|
+
}
|
|
124190
|
+
}
|
|
124191
|
+
function tryGetModuleNameFromPaths(relativeToBaseUrl, paths, allowedEndings, host, compilerOptions) {
|
|
124069
124192
|
for (var key in paths) {
|
|
124070
|
-
|
|
124071
|
-
var
|
|
124072
|
-
var pattern = ts.removeFileExtension(ts.normalizePath(patternText_1));
|
|
124193
|
+
var _loop_36 = function (patternText_1) {
|
|
124194
|
+
var pattern = ts.normalizePath(patternText_1);
|
|
124073
124195
|
var indexOfStar = pattern.indexOf("*");
|
|
124196
|
+
// In module resolution, if `pattern` itself has an extension, a file with that extension is looked up directly,
|
|
124197
|
+
// meaning a '.ts' or '.d.ts' extension is allowed to resolve. This is distinct from the case where a '*' substitution
|
|
124198
|
+
// causes a module specifier to have an extension, i.e. the extension comes from the module specifier in a JS/TS file
|
|
124199
|
+
// and matches the '*'. For example:
|
|
124200
|
+
//
|
|
124201
|
+
// Module Specifier | Path Mapping (key: [pattern]) | Interpolation | Resolution Action
|
|
124202
|
+
// ---------------------->------------------------------->--------------------->---------------------------------------------------------------
|
|
124203
|
+
// import "@app/foo" -> "@app/*": ["./src/app/*.ts"] -> "./src/app/foo.ts" -> tryFile("./src/app/foo.ts") || [continue resolution algorithm]
|
|
124204
|
+
// import "@app/foo.ts" -> "@app/*": ["./src/app/*"] -> "./src/app/foo.ts" -> [continue resolution algorithm]
|
|
124205
|
+
//
|
|
124206
|
+
// (https://github.com/microsoft/TypeScript/blob/ad4ded80e1d58f0bf36ac16bea71bc10d9f09895/src/compiler/moduleNameResolver.ts#L2509-L2516)
|
|
124207
|
+
//
|
|
124208
|
+
// The interpolation produced by both scenarios is identical, but only in the former, where the extension is encoded in
|
|
124209
|
+
// the path mapping rather than in the module specifier, will we prioritize a file lookup on the interpolation result.
|
|
124210
|
+
// (In fact, currently, the latter scenario will necessarily fail since no resolution mode recognizes '.ts' as a valid
|
|
124211
|
+
// extension for a module specifier.)
|
|
124212
|
+
//
|
|
124213
|
+
// Here, this means we need to be careful about whether we generate a match from the target filename (typically with a
|
|
124214
|
+
// .ts extension) or the possible relative module specifiers representing that file:
|
|
124215
|
+
//
|
|
124216
|
+
// Filename | Relative Module Specifier Candidates | Path Mapping | Filename Result | Module Specifier Results
|
|
124217
|
+
// --------------------<----------------------------------------------<------------------------------<-------------------||----------------------------
|
|
124218
|
+
// dist/haha.d.ts <- dist/haha, dist/haha.js <- "@app/*": ["./dist/*.d.ts"] <- @app/haha || (none)
|
|
124219
|
+
// dist/haha.d.ts <- dist/haha, dist/haha.js <- "@app/*": ["./dist/*"] <- (none) || @app/haha, @app/haha.js
|
|
124220
|
+
// dist/foo/index.d.ts <- dist/foo, dist/foo/index, dist/foo/index.js <- "@app/*": ["./dist/*.d.ts"] <- @app/foo/index || (none)
|
|
124221
|
+
// 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
|
|
124222
|
+
// dist/wow.js.js <- dist/wow.js, dist/wow.js.js <- "@app/*": ["./dist/*.js"] <- @app/wow.js || @app/wow, @app/wow.js
|
|
124223
|
+
//
|
|
124224
|
+
// The "Filename Result" can be generated only if `pattern` has an extension. Care must be taken that the list of
|
|
124225
|
+
// relative module specifiers to run the interpolation (a) is actually valid for the module resolution mode, (b) takes
|
|
124226
|
+
// into account the existence of other files (e.g. 'dist/wow.js' cannot refer to 'dist/wow.js.js' if 'dist/wow.js'
|
|
124227
|
+
// exists) and (c) that they are ordered by preference. The last row shows that the filename result and module
|
|
124228
|
+
// specifier results are not mutually exclusive. Note that the filename result is a higher priority in module
|
|
124229
|
+
// resolution, but as long criteria (b) above is met, I don't think its result needs to be the highest priority result
|
|
124230
|
+
// in module specifier generation. I have included it last, as it's difficult to tell exactly where it should be
|
|
124231
|
+
// sorted among the others for a particular value of `importModuleSpecifierEnding`.
|
|
124232
|
+
var candidates = allowedEndings.map(function (ending) { return ({
|
|
124233
|
+
ending: ending,
|
|
124234
|
+
value: removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions)
|
|
124235
|
+
}); });
|
|
124236
|
+
if (ts.tryGetExtensionFromPath(pattern)) {
|
|
124237
|
+
candidates.push({ ending: undefined, value: relativeToBaseUrl });
|
|
124238
|
+
}
|
|
124074
124239
|
if (indexOfStar !== -1) {
|
|
124075
|
-
var prefix = pattern.
|
|
124076
|
-
var suffix = pattern.
|
|
124077
|
-
|
|
124078
|
-
|
|
124079
|
-
|
|
124080
|
-
|
|
124081
|
-
|
|
124082
|
-
|
|
124240
|
+
var prefix = pattern.substring(0, indexOfStar);
|
|
124241
|
+
var suffix = pattern.substring(indexOfStar + 1);
|
|
124242
|
+
for (var _b = 0, candidates_3 = candidates; _b < candidates_3.length; _b++) {
|
|
124243
|
+
var _c = candidates_3[_b], ending = _c.ending, value = _c.value;
|
|
124244
|
+
if (value.length >= prefix.length + suffix.length &&
|
|
124245
|
+
ts.startsWith(value, prefix) &&
|
|
124246
|
+
ts.endsWith(value, suffix) &&
|
|
124247
|
+
validateEnding({ ending: ending, value: value })) {
|
|
124248
|
+
var matchedStar = value.substring(prefix.length, value.length - suffix.length);
|
|
124249
|
+
return { value: key.replace("*", matchedStar) };
|
|
124250
|
+
}
|
|
124083
124251
|
}
|
|
124084
124252
|
}
|
|
124085
|
-
else if (
|
|
124086
|
-
return
|
|
124253
|
+
else if (ts.some(candidates, function (c) { return c.ending !== 0 /* Minimal */ && pattern === c.value; }) ||
|
|
124254
|
+
ts.some(candidates, function (c) { return c.ending === 0 /* Minimal */ && pattern === c.value && validateEnding(c); })) {
|
|
124255
|
+
return { value: key };
|
|
124087
124256
|
}
|
|
124257
|
+
};
|
|
124258
|
+
for (var _i = 0, _a = paths[key]; _i < _a.length; _i++) {
|
|
124259
|
+
var patternText_1 = _a[_i];
|
|
124260
|
+
var state_12 = _loop_36(patternText_1);
|
|
124261
|
+
if (typeof state_12 === "object")
|
|
124262
|
+
return state_12.value;
|
|
124088
124263
|
}
|
|
124089
124264
|
}
|
|
124265
|
+
function validateEnding(_a) {
|
|
124266
|
+
var ending = _a.ending, value = _a.value;
|
|
124267
|
+
// Optimization: `removeExtensionAndIndexPostFix` can query the file system (a good bit) if `ending` is `Minimal`, the basename
|
|
124268
|
+
// is 'index', and a `host` is provided. To avoid that until it's unavoidable, we ran the function with no `host` above. Only
|
|
124269
|
+
// here, after we've checked that the minimal ending is indeed a match (via the length and prefix/suffix checks / `some` calls),
|
|
124270
|
+
// 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
|
|
124271
|
+
// `Ending.Index` result, which should already be in the list of candidates if `Minimal` was. (Note: the assumption here is
|
|
124272
|
+
// that every module resolution mode that supports dropping extensions also supports dropping `/index`. Like literally
|
|
124273
|
+
// everything else in this file, this logic needs to be updated if that's not true in some future module resolution mode.)
|
|
124274
|
+
return ending !== 0 /* Minimal */ || value === removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions, host);
|
|
124275
|
+
}
|
|
124090
124276
|
}
|
|
124091
124277
|
var MatchingMode;
|
|
124092
124278
|
(function (MatchingMode) {
|
|
@@ -124182,10 +124368,10 @@ var ts;
|
|
|
124182
124368
|
return undefined;
|
|
124183
124369
|
}
|
|
124184
124370
|
// Simplify the full file path to something that can be resolved by Node.
|
|
124371
|
+
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
124185
124372
|
var moduleSpecifier = path;
|
|
124186
124373
|
var isPackageRootPath = false;
|
|
124187
124374
|
if (!packageNameOnly) {
|
|
124188
|
-
var preferences = getPreferences(host, userPreferences, options, importingSourceFile);
|
|
124189
124375
|
var packageRootIndex = parts.packageRootIndex;
|
|
124190
124376
|
var moduleFileName = void 0;
|
|
124191
124377
|
while (true) {
|
|
@@ -124234,15 +124420,13 @@ var ts;
|
|
|
124234
124420
|
var packageRootPath = path.substring(0, packageRootIndex);
|
|
124235
124421
|
var packageJsonPath = ts.combinePaths(packageRootPath, "package.json");
|
|
124236
124422
|
var moduleFileToTry = path;
|
|
124423
|
+
var maybeBlockedByTypesVersions = false;
|
|
124237
124424
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
124238
124425
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
124239
124426
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
124427
|
+
var importMode = overrideMode || importingSourceFile.impliedNodeFormat;
|
|
124240
124428
|
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
124241
|
-
|
|
124242
|
-
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
124243
|
-
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
124244
|
-
// with, so for now we just stick with the mode of the file.
|
|
124245
|
-
var conditions = ["node", overrideMode || importingSourceFile.impliedNodeFormat === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
124429
|
+
var conditions = ["node", importMode === ts.ModuleKind.ESNext ? "import" : "require", "types"];
|
|
124246
124430
|
var fromExports = packageJsonContent.exports && typeof packageJsonContent.name === "string"
|
|
124247
124431
|
? tryGetModuleNameFromExports(options, path, packageRootPath, ts.getPackageNameFromTypesPackageName(packageJsonContent.name), packageJsonContent.exports, conditions)
|
|
124248
124432
|
: undefined;
|
|
@@ -124261,16 +124445,26 @@ var ts;
|
|
|
124261
124445
|
: undefined;
|
|
124262
124446
|
if (versionPaths) {
|
|
124263
124447
|
var subModuleName = path.slice(packageRootPath.length + 1);
|
|
124264
|
-
var fromPaths = tryGetModuleNameFromPaths(
|
|
124265
|
-
if (fromPaths
|
|
124448
|
+
var fromPaths = tryGetModuleNameFromPaths(subModuleName, versionPaths.paths, getAllowedEndings(preferences.ending, options, importMode), host, options);
|
|
124449
|
+
if (fromPaths === undefined) {
|
|
124450
|
+
maybeBlockedByTypesVersions = true;
|
|
124451
|
+
}
|
|
124452
|
+
else {
|
|
124266
124453
|
moduleFileToTry = ts.combinePaths(packageRootPath, fromPaths);
|
|
124267
124454
|
}
|
|
124268
124455
|
}
|
|
124269
124456
|
// If the file is the main module, it can be imported by the package name
|
|
124270
124457
|
var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
124271
|
-
if (ts.isString(mainFileRelative)) {
|
|
124458
|
+
if (ts.isString(mainFileRelative) && !(maybeBlockedByTypesVersions && ts.matchPatternOrExact(ts.tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
124459
|
+
// The 'main' file is also subject to mapping through typesVersions, and we couldn't come up with a path
|
|
124460
|
+
// explicitly through typesVersions, so if it matches a key in typesVersions now, it's not reachable.
|
|
124461
|
+
// (The only way this can happen is if some file in a package that's not resolvable from outside the
|
|
124462
|
+
// package got pulled into the program anyway, e.g. transitively through a file that *is* reachable. It
|
|
124463
|
+
// happens very easily in fourslash tests though, since every test file listed gets included. See
|
|
124464
|
+
// importNameCodeFix_typesVersions.ts for an example.)
|
|
124272
124465
|
var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
124273
124466
|
if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(getCanonicalFileName(moduleFileToTry))) {
|
|
124467
|
+
// ^ An arbitrary removal of file extension for this comparison is almost certainly wrong
|
|
124274
124468
|
return { packageRootPath: packageRootPath, moduleFileToTry: moduleFileToTry };
|
|
124275
124469
|
}
|
|
124276
124470
|
}
|
|
@@ -157090,7 +157284,7 @@ var ts;
|
|
|
157090
157284
|
return undefined;
|
|
157091
157285
|
return { kind: 4 /* JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent };
|
|
157092
157286
|
}
|
|
157093
|
-
if (ts.isIdentifier(token) && ts.isCallExpression(parent)) {
|
|
157287
|
+
if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) {
|
|
157094
157288
|
return { kind: 2 /* Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* None */, parentDeclaration: sourceFile };
|
|
157095
157289
|
}
|
|
157096
157290
|
if (!ts.isPropertyAccessExpression(parent))
|
|
@@ -162335,6 +162529,9 @@ var ts;
|
|
|
162335
162529
|
if (!containingDecl) {
|
|
162336
162530
|
return;
|
|
162337
162531
|
}
|
|
162532
|
+
if (ts.isFunctionLikeDeclaration(containingDecl) && containingDecl.body && ts.rangeContainsPosition(containingDecl.body, startPosition)) {
|
|
162533
|
+
return;
|
|
162534
|
+
}
|
|
162338
162535
|
var checker = program.getTypeChecker();
|
|
162339
162536
|
var signatureSymbol = containingDecl.symbol;
|
|
162340
162537
|
if (!signatureSymbol) {
|