typescript 4.7.0-dev.20220501 → 4.7.0-dev.20220504
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/AUTHORS.md +1 -0
- package/lib/cs/diagnosticMessages.generated.json +2 -2
- package/lib/de/diagnosticMessages.generated.json +2 -2
- package/lib/es/diagnosticMessages.generated.json +2 -2
- package/lib/fr/diagnosticMessages.generated.json +2 -2
- package/lib/it/diagnosticMessages.generated.json +2 -2
- package/lib/ja/diagnosticMessages.generated.json +2 -2
- package/lib/ko/diagnosticMessages.generated.json +2 -2
- package/lib/lib.es2020.bigint.d.ts +4 -4
- package/lib/lib.es5.d.ts +12 -12
- package/lib/pl/diagnosticMessages.generated.json +2 -2
- package/lib/pt-br/diagnosticMessages.generated.json +2 -2
- package/lib/ru/diagnosticMessages.generated.json +2 -2
- package/lib/tr/diagnosticMessages.generated.json +2 -2
- package/lib/tsc.js +94 -75
- package/lib/tsserver.js +146 -113
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +146 -113
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +135 -104
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +135 -104
- package/lib/typingsInstaller.js +110 -86
- package/lib/zh-cn/diagnosticMessages.generated.json +2 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +2 -2
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220504";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -5276,10 +5276,11 @@ var ts;
|
|
|
5276
5276
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5277
5277
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5278
5278
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5279
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5280
|
-
//
|
|
5281
|
-
// version-
|
|
5282
|
-
|
|
5279
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5280
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5281
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5282
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5283
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5283
5284
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5284
5285
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5285
5286
|
var ModuleDetectionKind;
|
|
@@ -5289,7 +5290,7 @@ var ts;
|
|
|
5289
5290
|
*/
|
|
5290
5291
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5291
5292
|
/**
|
|
5292
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5293
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5293
5294
|
*/
|
|
5294
5295
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5295
5296
|
/**
|
|
@@ -5334,8 +5335,8 @@ var ts;
|
|
|
5334
5335
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5335
5336
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5336
5337
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5337
|
-
//
|
|
5338
|
-
ModuleKind[ModuleKind["
|
|
5338
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5339
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5339
5340
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5340
5341
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5341
5342
|
var JsxEmit;
|
|
@@ -8257,6 +8258,7 @@ var ts;
|
|
|
8257
8258
|
_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"),
|
|
8258
8259
|
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
|
|
8259
8260
|
await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."),
|
|
8261
|
+
The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."),
|
|
8260
8262
|
Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern: diag(1312, ts.DiagnosticCategory.Error, "Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_1312", "Did you mean to use a ':'? An '=' can only follow a property name when the containing object literal is part of a destructuring pattern."),
|
|
8261
8263
|
The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."),
|
|
8262
8264
|
Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."),
|
|
@@ -8268,8 +8270,8 @@ var ts;
|
|
|
8268
8270
|
Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8269
8271
|
Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."),
|
|
8270
8272
|
Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."),
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
+
Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd__1323", "Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', or 'nodenext'."),
|
|
8274
|
+
Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nod_1324", "Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'."),
|
|
8273
8275
|
Argument_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Argument_of_dynamic_import_cannot_be_spread_element_1325", "Argument of dynamic import cannot be spread element."),
|
|
8274
8276
|
This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326", "This use of 'import' is invalid. 'import()' calls can be written, but they must have parentheses and cannot have type arguments."),
|
|
8275
8277
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8286,7 +8288,7 @@ var ts;
|
|
|
8286
8288
|
Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here: diag(1339, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_value_but_is_used_as_a_value_here_1339", "Module '{0}' does not refer to a value, but is used as a value here."),
|
|
8287
8289
|
Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0: diag(1340, ts.DiagnosticCategory.Error, "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340", "Module '{0}' does not refer to a type, but is used as a type here. Did you mean 'typeof import('{0}')'?"),
|
|
8288
8290
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8289
|
-
|
|
8291
|
+
The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext: diag(1343, ts.DiagnosticCategory.Error, "The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system__1343", "The 'import.meta' meta-property is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext', 'system', 'node16', or 'nodenext'."),
|
|
8290
8292
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8291
8293
|
An_expression_of_type_void_cannot_be_tested_for_truthiness: diag(1345, ts.DiagnosticCategory.Error, "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345", "An expression of type 'void' cannot be tested for truthiness."),
|
|
8292
8294
|
This_parameter_is_not_allowed_with_use_strict_directive: diag(1346, ts.DiagnosticCategory.Error, "This_parameter_is_not_allowed_with_use_strict_directive_1346", "This parameter is not allowed with 'use strict' directive."),
|
|
@@ -8317,7 +8319,7 @@ var ts;
|
|
|
8317
8319
|
await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1375, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_fi_1375", "'await' expressions are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8318
8320
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8319
8321
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8320
|
-
|
|
8322
|
+
Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, ts.DiagnosticCategory.Error, "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378", "Top-level 'await' expressions are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8321
8323
|
An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379", "An import alias cannot reference a declaration that was exported using 'export type'."),
|
|
8322
8324
|
An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, ts.DiagnosticCategory.Error, "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380", "An import alias cannot reference a declaration that was imported using 'import type'."),
|
|
8323
8325
|
Unexpected_token_Did_you_mean_or_rbrace: diag(1381, ts.DiagnosticCategory.Error, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
|
|
@@ -8369,7 +8371,7 @@ var ts;
|
|
|
8369
8371
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8370
8372
|
The_file_is_in_the_program_because_Colon: diag(1430, ts.DiagnosticCategory.Message, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
|
|
8371
8373
|
for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module: diag(1431, ts.DiagnosticCategory.Error, "for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_1431", "'for await' loops are only allowed at the top level of a file when that file is a module, but this file has no imports or exports. Consider adding an empty 'export {}' to make this file a module."),
|
|
8372
|
-
|
|
8374
|
+
Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, ts.DiagnosticCategory.Error, "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432", "Top-level 'for await' loops are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', or 'nodenext', and the 'target' option is set to 'es2017' or higher."),
|
|
8373
8375
|
Decorators_may_not_be_applied_to_this_parameters: diag(1433, ts.DiagnosticCategory.Error, "Decorators_may_not_be_applied_to_this_parameters_1433", "Decorators may not be applied to 'this' parameters."),
|
|
8374
8376
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8375
8377
|
Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, ts.DiagnosticCategory.Error, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
|
|
@@ -8387,7 +8389,7 @@ var ts;
|
|
|
8387
8389
|
Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed: diag(1449, ts.DiagnosticCategory.Message, "Preserve_unused_imported_values_in_the_JavaScript_output_that_would_otherwise_be_removed_1449", "Preserve unused imported values in the JavaScript output that would otherwise be removed."),
|
|
8388
8390
|
Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments: diag(1450, ts.DiagnosticCategory.Message, "Dynamic_imports_can_only_accept_a_module_specifier_and_an_optional_assertion_as_arguments_1450", "Dynamic imports can only accept a module specifier and an optional assertion as arguments"),
|
|
8389
8391
|
Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression: diag(1451, ts.DiagnosticCategory.Error, "Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member__1451", "Private identifiers are only allowed in class bodies and may only be used as part of a class member declaration, property access, or on the left-hand-side of an 'in' expression"),
|
|
8390
|
-
|
|
8392
|
+
Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext: diag(1452, ts.DiagnosticCategory.Error, "Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452", "Resolution modes are only supported when `moduleResolution` is `node16` or `nodenext`."),
|
|
8391
8393
|
resolution_mode_should_be_either_require_or_import: diag(1453, ts.DiagnosticCategory.Error, "resolution_mode_should_be_either_require_or_import_1453", "`resolution-mode` should be either `require` or `import`."),
|
|
8392
8394
|
resolution_mode_can_only_be_set_for_type_only_imports: diag(1454, ts.DiagnosticCategory.Error, "resolution_mode_can_only_be_set_for_type_only_imports_1454", "`resolution-mode` can only be set for type-only imports."),
|
|
8393
8395
|
resolution_mode_is_the_only_valid_key_for_type_import_assertions: diag(1455, ts.DiagnosticCategory.Error, "resolution_mode_is_the_only_valid_key_for_type_import_assertions_1455", "`resolution-mode` is the only valid key for type import assertions."),
|
|
@@ -8398,7 +8400,7 @@ var ts;
|
|
|
8398
8400
|
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."),
|
|
8399
8401
|
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."),
|
|
8400
8402
|
Control_what_method_is_used_to_detect_module_format_JS_files: diag(1475, ts.DiagnosticCategory.Message, "Control_what_method_is_used_to_detect_module_format_JS_files_1475", "Control what method is used to detect module-format JS files."),
|
|
8401
|
-
|
|
8403
|
+
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."),
|
|
8402
8404
|
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."),
|
|
8403
8405
|
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."),
|
|
8404
8406
|
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),
|
|
@@ -8407,7 +8409,6 @@ var ts;
|
|
|
8407
8409
|
Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1: diag(2205, ts.DiagnosticCategory.Error, "Construct_signatures_with_no_arguments_have_incompatible_return_types_0_and_1_2205", "Construct signatures with no arguments have incompatible return types '{0}' and '{1}'.", /*reportsUnnecessary*/ undefined, /*elidedInCompatabilityPyramid*/ true),
|
|
8408
8410
|
The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement: diag(2206, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement_2206", "The 'type' modifier cannot be used on a named import when 'import type' is used on its import statement."),
|
|
8409
8411
|
The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement: diag(2207, ts.DiagnosticCategory.Error, "The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement_2207", "The 'type' modifier cannot be used on a named export when 'export type' is used on its export statement."),
|
|
8410
|
-
This_type_parameter_probably_needs_an_extends_object_constraint: diag(2208, ts.DiagnosticCategory.Error, "This_type_parameter_probably_needs_an_extends_object_constraint_2208", "This type parameter probably needs an `extends object` constraint."),
|
|
8411
8412
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8412
8413
|
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
|
|
8413
8414
|
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
|
|
@@ -8885,8 +8886,8 @@ var ts;
|
|
|
8885
8886
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
|
|
8886
8887
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8887
8888
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8888
|
-
|
|
8889
|
-
|
|
8889
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path."),
|
|
8890
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '{0}'?"),
|
|
8890
8891
|
Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls: diag(2836, ts.DiagnosticCategory.Error, "Import_assertions_are_not_allowed_on_statements_that_transpile_to_commonjs_require_calls_2836", "Import assertions are not allowed on statements that transpile to commonjs 'require' calls."),
|
|
8891
8892
|
Import_assertion_values_must_be_string_literal_expressions: diag(2837, ts.DiagnosticCategory.Error, "Import_assertion_values_must_be_string_literal_expressions_2837", "Import assertion values must be string literal expressions."),
|
|
8892
8893
|
All_declarations_of_0_must_have_identical_constraints: diag(2838, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_constraints_2838", "All declarations of '{0}' must have identical constraints."),
|
|
@@ -9552,7 +9553,6 @@ var ts;
|
|
|
9552
9553
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead: diag(7059, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead_7059", "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead."),
|
|
9553
9554
|
This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_constraint: diag(7060, ts.DiagnosticCategory.Error, "This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Add_a_trailing_comma_or_explicit_cons_7060", "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma or explicit constraint."),
|
|
9554
9555
|
A_mapped_type_may_not_declare_properties_or_methods: diag(7061, ts.DiagnosticCategory.Error, "A_mapped_type_may_not_declare_properties_or_methods_7061", "A mapped type may not declare properties or methods."),
|
|
9555
|
-
JSON_imports_are_experimental_in_ES_module_mode_imports: diag(7062, ts.DiagnosticCategory.Error, "JSON_imports_are_experimental_in_ES_module_mode_imports_7062", "JSON imports are experimental in ES module mode imports."),
|
|
9556
9556
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9557
9557
|
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
|
|
9558
9558
|
import_can_only_be_used_in_TypeScript_files: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_TypeScript_files_8002", "'import ... =' can only be used in TypeScript files."),
|
|
@@ -14845,7 +14845,7 @@ var ts;
|
|
|
14845
14845
|
}
|
|
14846
14846
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
14847
14847
|
function isCommonJSContainingModuleKind(kind) {
|
|
14848
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
14848
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
14849
14849
|
}
|
|
14850
14850
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
14851
14851
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -20013,7 +20013,7 @@ var ts;
|
|
|
20013
20013
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20014
20014
|
};
|
|
20015
20015
|
case ts.ModuleDetectionKind.Auto:
|
|
20016
|
-
// If module is nodenext or
|
|
20016
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20017
20017
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20018
20018
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20019
20019
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20021,7 +20021,7 @@ var ts;
|
|
|
20021
20021
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20022
20022
|
}
|
|
20023
20023
|
var moduleKind = getEmitModuleKind(options);
|
|
20024
|
-
if (moduleKind === ts.ModuleKind.
|
|
20024
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20025
20025
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20026
20026
|
}
|
|
20027
20027
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20032,7 +20032,7 @@ var ts;
|
|
|
20032
20032
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20033
20033
|
function getEmitScriptTarget(compilerOptions) {
|
|
20034
20034
|
return compilerOptions.target ||
|
|
20035
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20035
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20036
20036
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20037
20037
|
0 /* ES3 */;
|
|
20038
20038
|
}
|
|
@@ -20050,8 +20050,8 @@ var ts;
|
|
|
20050
20050
|
case ts.ModuleKind.CommonJS:
|
|
20051
20051
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20052
20052
|
break;
|
|
20053
|
-
case ts.ModuleKind.
|
|
20054
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20053
|
+
case ts.ModuleKind.Node16:
|
|
20054
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20055
20055
|
break;
|
|
20056
20056
|
case ts.ModuleKind.NodeNext:
|
|
20057
20057
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20076,7 +20076,7 @@ var ts;
|
|
|
20076
20076
|
case ts.ModuleKind.ES2020:
|
|
20077
20077
|
case ts.ModuleKind.ES2022:
|
|
20078
20078
|
case ts.ModuleKind.ESNext:
|
|
20079
|
-
case ts.ModuleKind.
|
|
20079
|
+
case ts.ModuleKind.Node16:
|
|
20080
20080
|
case ts.ModuleKind.NodeNext:
|
|
20081
20081
|
return true;
|
|
20082
20082
|
default:
|
|
@@ -20101,7 +20101,7 @@ var ts;
|
|
|
20101
20101
|
return compilerOptions.esModuleInterop;
|
|
20102
20102
|
}
|
|
20103
20103
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20104
|
-
case ts.ModuleKind.
|
|
20104
|
+
case ts.ModuleKind.Node16:
|
|
20105
20105
|
case ts.ModuleKind.NodeNext:
|
|
20106
20106
|
return true;
|
|
20107
20107
|
}
|
|
@@ -39307,7 +39307,7 @@ var ts;
|
|
|
39307
39307
|
es2020: ts.ModuleKind.ES2020,
|
|
39308
39308
|
es2022: ts.ModuleKind.ES2022,
|
|
39309
39309
|
esnext: ts.ModuleKind.ESNext,
|
|
39310
|
-
|
|
39310
|
+
node16: ts.ModuleKind.Node16,
|
|
39311
39311
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39312
39312
|
})),
|
|
39313
39313
|
affectsModuleResolution: true,
|
|
@@ -39661,7 +39661,7 @@ var ts;
|
|
|
39661
39661
|
type: new ts.Map(ts.getEntries({
|
|
39662
39662
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39663
39663
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39664
|
-
|
|
39664
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39665
39665
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39666
39666
|
})),
|
|
39667
39667
|
affectsModuleResolution: true,
|
|
@@ -40137,7 +40137,7 @@ var ts;
|
|
|
40137
40137
|
affectsModuleResolution: true,
|
|
40138
40138
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40139
40139
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40140
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40140
|
+
defaultValueDescription: ts.Diagnostics.auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_with_module_Colon_node16_as_modules,
|
|
40141
40141
|
}
|
|
40142
40142
|
];
|
|
40143
40143
|
/* @internal */
|
|
@@ -42373,9 +42373,9 @@ var ts;
|
|
|
42373
42373
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42374
42374
|
// are present in a non-modal project; while in theory we'd like to either ignore the mode or provide faithful modern resolution, depending on what we feel is best,
|
|
42375
42375
|
// in practice, not every cache has the options available to intelligently make the choice to ignore the mode request, and it's unclear how modern "faithful modern
|
|
42376
|
-
// resolution" should be (`
|
|
42376
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42377
42377
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42378
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42378
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42379
42379
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42380
42380
|
}
|
|
42381
42381
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42464,7 +42464,7 @@ var ts;
|
|
|
42464
42464
|
}
|
|
42465
42465
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42466
42466
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42467
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42467
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42468
42468
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42469
42469
|
NodeResolutionFeatures.None;
|
|
42470
42470
|
}
|
|
@@ -42822,8 +42822,8 @@ var ts;
|
|
|
42822
42822
|
case ts.ModuleKind.CommonJS:
|
|
42823
42823
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
42824
42824
|
break;
|
|
42825
|
-
case ts.ModuleKind.
|
|
42826
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
42825
|
+
case ts.ModuleKind.Node16:
|
|
42826
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
42827
42827
|
break;
|
|
42828
42828
|
case ts.ModuleKind.NodeNext:
|
|
42829
42829
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -42843,8 +42843,8 @@ var ts;
|
|
|
42843
42843
|
}
|
|
42844
42844
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
42845
42845
|
switch (moduleResolution) {
|
|
42846
|
-
case ts.ModuleResolutionKind.
|
|
42847
|
-
result =
|
|
42846
|
+
case ts.ModuleResolutionKind.Node16:
|
|
42847
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
42848
42848
|
break;
|
|
42849
42849
|
case ts.ModuleResolutionKind.NodeNext:
|
|
42850
42850
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43078,15 +43078,15 @@ var ts;
|
|
|
43078
43078
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43079
43079
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43080
43080
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43081
|
-
// not
|
|
43081
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43082
43082
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43083
43083
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43084
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43084
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43085
43085
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43086
43086
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43087
43087
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43088
|
-
function
|
|
43089
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43088
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43089
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43090
43090
|
}
|
|
43091
43091
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43092
43092
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43126,7 +43126,7 @@ var ts;
|
|
|
43126
43126
|
var _a, _b;
|
|
43127
43127
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43128
43128
|
var failedLookupLocations = [];
|
|
43129
|
-
// conditions are only used by the
|
|
43129
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43130
43130
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43131
43131
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43132
43132
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48513,7 +48513,7 @@ var ts;
|
|
|
48513
48513
|
var enumRelation = new ts.Map();
|
|
48514
48514
|
var builtinGlobals = ts.createSymbolTable();
|
|
48515
48515
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48516
|
-
// Extensions suggested for path imports when module resolution is
|
|
48516
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48517
48517
|
// The first element of each tuple is the extension a file has.
|
|
48518
48518
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48519
48519
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50802,7 +50802,7 @@ var ts;
|
|
|
50802
50802
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50803
50803
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50804
50804
|
}
|
|
50805
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50805
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
50806
50806
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
50807
50807
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
50808
50808
|
var overrideClause = overrideClauseHost && ts.isImportTypeNode(overrideClauseHost) ? (_g = overrideClauseHost.assertions) === null || _g === void 0 ? void 0 : _g.assertClause : overrideClauseHost === null || overrideClauseHost === void 0 ? void 0 : overrideClauseHost.assertClause;
|
|
@@ -50811,9 +50811,6 @@ var ts;
|
|
|
50811
50811
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
50812
50812
|
error(errorNode, ts.Diagnostics.Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_cannot_be_imported_synchronously_Use_dynamic_import_instead, moduleReference);
|
|
50813
50813
|
}
|
|
50814
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
50815
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
50816
|
-
}
|
|
50817
50814
|
}
|
|
50818
50815
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
50819
50816
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -50866,7 +50863,7 @@ var ts;
|
|
|
50866
50863
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
50867
50864
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
50868
50865
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
50869
|
-
var
|
|
50866
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
50870
50867
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
50871
50868
|
if (tsExtension) {
|
|
50872
50869
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -50887,17 +50884,17 @@ var ts;
|
|
|
50887
50884
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
50888
50885
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
50889
50886
|
}
|
|
50890
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
50887
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
50891
50888
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
50892
50889
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
50893
50890
|
var actualExt = _a[0], _importExt = _a[1];
|
|
50894
50891
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
50895
50892
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
50896
50893
|
if (suggestedExt) {
|
|
50897
|
-
error(errorNode, ts.Diagnostics.
|
|
50894
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
50898
50895
|
}
|
|
50899
50896
|
else {
|
|
50900
|
-
error(errorNode, ts.Diagnostics.
|
|
50897
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node16_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
50901
50898
|
}
|
|
50902
50899
|
}
|
|
50903
50900
|
else {
|
|
@@ -53219,7 +53216,7 @@ var ts;
|
|
|
53219
53216
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53220
53217
|
var specifier = void 0;
|
|
53221
53218
|
var assertion = void 0;
|
|
53222
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53219
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53223
53220
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53224
53221
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53225
53222
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53233,7 +53230,7 @@ var ts;
|
|
|
53233
53230
|
}
|
|
53234
53231
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53235
53232
|
var oldSpecifier = specifier;
|
|
53236
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53233
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53237
53234
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53238
53235
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53239
53236
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -64710,7 +64707,6 @@ var ts;
|
|
|
64710
64707
|
return 0 /* False */;
|
|
64711
64708
|
}
|
|
64712
64709
|
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
64713
|
-
var _a, _b;
|
|
64714
64710
|
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
64715
64711
|
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
64716
64712
|
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
@@ -64751,9 +64747,6 @@ var ts;
|
|
|
64751
64747
|
return;
|
|
64752
64748
|
}
|
|
64753
64749
|
reportRelationError(headMessage, source, target);
|
|
64754
|
-
if (strictNullChecks && source.flags & 8650752 /* TypeVariable */ && ((_b = (_a = source.symbol) === null || _a === void 0 ? void 0 : _a.declarations) === null || _b === void 0 ? void 0 : _b[0]) && !getConstraintOfType(source) && isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */))) {
|
|
64755
|
-
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
|
|
64756
|
-
}
|
|
64757
64750
|
}
|
|
64758
64751
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
64759
64752
|
if (!ts.tracing) {
|
|
@@ -65526,7 +65519,7 @@ var ts;
|
|
|
65526
65519
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65527
65520
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65528
65521
|
var constraint = getConstraintOfType(source);
|
|
65529
|
-
if (!
|
|
65522
|
+
if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65530
65523
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65531
65524
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65532
65525
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65534,12 +65527,12 @@ var ts;
|
|
|
65534
65527
|
}
|
|
65535
65528
|
}
|
|
65536
65529
|
// hi-speed no-this-instantiation check (less accurate, but avoids costly `this`-instantiation when the constraint will suffice), see #28231 for report on why this is needed
|
|
65537
|
-
else if (
|
|
65530
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65538
65531
|
resetErrorInfo(saveErrorInfo);
|
|
65539
65532
|
return result;
|
|
65540
65533
|
}
|
|
65541
65534
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65542
|
-
else if (
|
|
65535
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65543
65536
|
resetErrorInfo(saveErrorInfo);
|
|
65544
65537
|
return result;
|
|
65545
65538
|
}
|
|
@@ -71202,7 +71195,7 @@ var ts;
|
|
|
71202
71195
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71203
71196
|
var parent = declaration.parent.parent;
|
|
71204
71197
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71205
|
-
var links = getNodeLinks(
|
|
71198
|
+
var links = getNodeLinks(parent);
|
|
71206
71199
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71207
71200
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71208
71201
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77065,13 +77058,13 @@ var ts;
|
|
|
77065
77058
|
}
|
|
77066
77059
|
}
|
|
77067
77060
|
function checkImportMetaProperty(node) {
|
|
77068
|
-
if (moduleKind === ts.ModuleKind.
|
|
77061
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77069
77062
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77070
77063
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77071
77064
|
}
|
|
77072
77065
|
}
|
|
77073
77066
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77074
|
-
error(node, ts.Diagnostics.
|
|
77067
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77075
77068
|
}
|
|
77076
77069
|
var file = ts.getSourceFileOfNode(node);
|
|
77077
77070
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78022,15 +78015,30 @@ var ts;
|
|
|
78022
78015
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78023
78016
|
var span = void 0;
|
|
78024
78017
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78025
|
-
|
|
78026
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78018
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78027
78019
|
var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module);
|
|
78028
78020
|
diagnostics.add(diagnostic);
|
|
78029
78021
|
}
|
|
78030
|
-
|
|
78031
|
-
|
|
78032
|
-
|
|
78033
|
-
|
|
78022
|
+
switch (moduleKind) {
|
|
78023
|
+
case ts.ModuleKind.Node16:
|
|
78024
|
+
case ts.ModuleKind.NodeNext:
|
|
78025
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78026
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78027
|
+
diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
78028
|
+
break;
|
|
78029
|
+
}
|
|
78030
|
+
// fallthrough
|
|
78031
|
+
case ts.ModuleKind.ES2022:
|
|
78032
|
+
case ts.ModuleKind.ESNext:
|
|
78033
|
+
case ts.ModuleKind.System:
|
|
78034
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78035
|
+
break;
|
|
78036
|
+
}
|
|
78037
|
+
// fallthrough
|
|
78038
|
+
default:
|
|
78039
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78040
|
+
diagnostics.add(ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
|
|
78041
|
+
break;
|
|
78034
78042
|
}
|
|
78035
78043
|
}
|
|
78036
78044
|
}
|
|
@@ -80472,8 +80480,8 @@ var ts;
|
|
|
80472
80480
|
if (node.assertions) {
|
|
80473
80481
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80474
80482
|
if (override) {
|
|
80475
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80476
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80483
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80484
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80477
80485
|
}
|
|
80478
80486
|
}
|
|
80479
80487
|
}
|
|
@@ -81923,7 +81931,7 @@ var ts;
|
|
|
81923
81931
|
}
|
|
81924
81932
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
81925
81933
|
// No need to check for require or exports for ES6 modules and later
|
|
81926
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
81934
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
81927
81935
|
return;
|
|
81928
81936
|
}
|
|
81929
81937
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -84843,8 +84851,8 @@ var ts;
|
|
|
84843
84851
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
84844
84852
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
84845
84853
|
if (validForTypeAssertions && override) {
|
|
84846
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
84847
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
84854
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
84855
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
84848
84856
|
}
|
|
84849
84857
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
84850
84858
|
}
|
|
@@ -88031,8 +88039,24 @@ var ts;
|
|
|
88031
88039
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88032
88040
|
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module));
|
|
88033
88041
|
}
|
|
88034
|
-
|
|
88035
|
-
|
|
88042
|
+
switch (moduleKind) {
|
|
88043
|
+
case ts.ModuleKind.Node16:
|
|
88044
|
+
case ts.ModuleKind.NodeNext:
|
|
88045
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88046
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88047
|
+
break;
|
|
88048
|
+
}
|
|
88049
|
+
// fallthrough
|
|
88050
|
+
case ts.ModuleKind.ES2022:
|
|
88051
|
+
case ts.ModuleKind.ESNext:
|
|
88052
|
+
case ts.ModuleKind.System:
|
|
88053
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88054
|
+
break;
|
|
88055
|
+
}
|
|
88056
|
+
// fallthrough
|
|
88057
|
+
default:
|
|
88058
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher));
|
|
88059
|
+
break;
|
|
88036
88060
|
}
|
|
88037
88061
|
}
|
|
88038
88062
|
}
|
|
@@ -88727,7 +88751,7 @@ var ts;
|
|
|
88727
88751
|
}
|
|
88728
88752
|
function checkGrammarImportCallExpression(node) {
|
|
88729
88753
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88730
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88754
|
+
return grammarErrorOnNode(node, ts.Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_es2022_esnext_commonjs_amd_system_umd_node16_or_nodenext);
|
|
88731
88755
|
}
|
|
88732
88756
|
if (node.typeArguments) {
|
|
88733
88757
|
return grammarErrorOnNode(node, ts.Diagnostics.This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot_have_type_arguments);
|
|
@@ -88738,7 +88762,7 @@ var ts;
|
|
|
88738
88762
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88739
88763
|
if (nodeArguments.length > 1) {
|
|
88740
88764
|
var assertionArgument = nodeArguments[1];
|
|
88741
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88765
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88742
88766
|
}
|
|
88743
88767
|
}
|
|
88744
88768
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -109004,7 +109028,7 @@ var ts;
|
|
|
109004
109028
|
return ts.transformECMAScriptModule;
|
|
109005
109029
|
case ts.ModuleKind.System:
|
|
109006
109030
|
return ts.transformSystemModule;
|
|
109007
|
-
case ts.ModuleKind.
|
|
109031
|
+
case ts.ModuleKind.Node16:
|
|
109008
109032
|
case ts.ModuleKind.NodeNext:
|
|
109009
109033
|
return ts.transformNodeModule;
|
|
109010
109034
|
default:
|
|
@@ -116027,7 +116051,7 @@ var ts;
|
|
|
116027
116051
|
*/
|
|
116028
116052
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116029
116053
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116030
|
-
case ts.ModuleResolutionKind.
|
|
116054
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116031
116055
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116032
116056
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116033
116057
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116326,7 +116350,7 @@ var ts;
|
|
|
116326
116350
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116327
116351
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116328
116352
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116329
|
-
// under
|
|
116353
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116330
116354
|
processTypeReferenceDirective(typeReferences[i], /*mode*/ undefined, resolutions[i], { kind: ts.FileIncludeKind.AutomaticTypeDirectiveFile, typeReference: typeReferences[i], packageId: (_c = resolutions[i]) === null || _c === void 0 ? void 0 : _c.packageId });
|
|
116331
116355
|
}
|
|
116332
116356
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -117979,8 +118003,8 @@ var ts;
|
|
|
117979
118003
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
117980
118004
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
117981
118005
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
117982
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
117983
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118006
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118007
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
117984
118008
|
}
|
|
117985
118009
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
117986
118010
|
}
|
|
@@ -118342,7 +118366,7 @@ var ts;
|
|
|
118342
118366
|
}
|
|
118343
118367
|
if (options.resolveJsonModule) {
|
|
118344
118368
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118345
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118369
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118346
118370
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118347
118371
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118348
118372
|
}
|
|
@@ -121482,7 +121506,7 @@ var ts;
|
|
|
121482
121506
|
}
|
|
121483
121507
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121484
121508
|
var _a;
|
|
121485
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121509
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121486
121510
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121487
121511
|
return false;
|
|
121488
121512
|
}
|
|
@@ -122067,7 +122091,7 @@ var ts;
|
|
|
122067
122091
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122068
122092
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122069
122093
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122070
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122094
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122071
122095
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122072
122096
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122073
122097
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127264,11 +127288,11 @@ var ts;
|
|
|
127264
127288
|
}
|
|
127265
127289
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127266
127290
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127267
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127291
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127268
127292
|
}
|
|
127269
127293
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127270
127294
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127271
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127295
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127272
127296
|
}
|
|
127273
127297
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127274
127298
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -130592,11 +130616,11 @@ var ts;
|
|
|
130592
130616
|
}
|
|
130593
130617
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
130594
130618
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
130595
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130619
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130596
130620
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130597
130621
|
}
|
|
130598
130622
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
130599
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
130623
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
130600
130624
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
130601
130625
|
}
|
|
130602
130626
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -133145,7 +133169,7 @@ var ts;
|
|
|
133145
133169
|
return;
|
|
133146
133170
|
}
|
|
133147
133171
|
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133148
|
-
// due to file location or package.json dependency filtering. For non-
|
|
133172
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133149
133173
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133150
133174
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133151
133175
|
// even if we defer computing the module specifier.
|
|
@@ -133153,7 +133177,7 @@ var ts;
|
|
|
133153
133177
|
if (!firstImportableExportInfo) {
|
|
133154
133178
|
return;
|
|
133155
133179
|
}
|
|
133156
|
-
// In
|
|
133180
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133157
133181
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133158
133182
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133159
133183
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -138748,7 +138772,7 @@ var ts;
|
|
|
138748
138772
|
(function (ts) {
|
|
138749
138773
|
var GoToDefinition;
|
|
138750
138774
|
(function (GoToDefinition) {
|
|
138751
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
138775
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
138752
138776
|
var _a;
|
|
138753
138777
|
var _b;
|
|
138754
138778
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -138773,7 +138797,7 @@ var ts;
|
|
|
138773
138797
|
}
|
|
138774
138798
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
138775
138799
|
var classDecl = node.parent.parent;
|
|
138776
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138800
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
138777
138801
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
138778
138802
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
138779
138803
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -138783,14 +138807,14 @@ var ts;
|
|
|
138783
138807
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
138784
138808
|
});
|
|
138785
138809
|
}
|
|
138786
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138810
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
138787
138811
|
var fallbackNode = node;
|
|
138788
138812
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
138789
138813
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
138790
138814
|
var importDeclaration = ts.forEach(__spreadArray([node], (symbol === null || symbol === void 0 ? void 0 : symbol.declarations) || ts.emptyArray, true), function (n) { return ts.findAncestor(n, ts.isAnyImportOrBareOrAccessedRequire); });
|
|
138791
138815
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
138792
138816
|
if (moduleSpecifier) {
|
|
138793
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138817
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
138794
138818
|
fallbackNode = moduleSpecifier;
|
|
138795
138819
|
}
|
|
138796
138820
|
}
|
|
@@ -138964,7 +138988,7 @@ var ts;
|
|
|
138964
138988
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
138965
138989
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
138966
138990
|
}
|
|
138967
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138991
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
138968
138992
|
if (!symbol)
|
|
138969
138993
|
return undefined;
|
|
138970
138994
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139015,14 +139039,14 @@ var ts;
|
|
|
139015
139039
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139016
139040
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139017
139041
|
}
|
|
139018
|
-
function getSymbol(node, checker) {
|
|
139042
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139019
139043
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139020
139044
|
// If this is an alias, and the request came at the declaration location
|
|
139021
139045
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139022
139046
|
// import {A, B} from "mod";
|
|
139023
139047
|
// to jump to the implementation directly.
|
|
139024
139048
|
var failedAliasResolution = false;
|
|
139025
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139049
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139026
139050
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139027
139051
|
if (aliased.declarations) {
|
|
139028
139052
|
return { symbol: aliased };
|
|
@@ -146616,6 +146640,13 @@ var ts;
|
|
|
146616
146640
|
var listStartToken = getOpenTokenForList(parent, nodes);
|
|
146617
146641
|
var listDynamicIndentation = parentDynamicIndentation;
|
|
146618
146642
|
var startLine = parentStartLine;
|
|
146643
|
+
// node range is outside the target range - do not dive inside
|
|
146644
|
+
if (!ts.rangeOverlapsWithStartEnd(originalRange, nodes.pos, nodes.end)) {
|
|
146645
|
+
if (nodes.end < originalRange.pos) {
|
|
146646
|
+
formattingScanner.skipToEndOf(nodes);
|
|
146647
|
+
}
|
|
146648
|
+
return;
|
|
146649
|
+
}
|
|
146619
146650
|
if (listStartToken !== 0 /* Unknown */) {
|
|
146620
146651
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
146621
146652
|
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
@@ -152608,7 +152639,7 @@ var ts;
|
|
|
152608
152639
|
case ts.ModuleKind.None:
|
|
152609
152640
|
// Fall back to the `import * as ns` style import.
|
|
152610
152641
|
return 2 /* Namespace */;
|
|
152611
|
-
case ts.ModuleKind.
|
|
152642
|
+
case ts.ModuleKind.Node16:
|
|
152612
152643
|
case ts.ModuleKind.NodeNext:
|
|
152613
152644
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
152614
152645
|
default:
|
|
@@ -154521,8 +154552,8 @@ var ts;
|
|
|
154521
154552
|
(function (codefix) {
|
|
154522
154553
|
codefix.registerCodeFix({
|
|
154523
154554
|
errorCodes: [
|
|
154524
|
-
ts.Diagnostics.
|
|
154525
|
-
ts.Diagnostics.
|
|
154555
|
+
ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
154556
|
+
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
154526
154557
|
],
|
|
154527
154558
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
154528
154559
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -164405,9 +164436,9 @@ var ts;
|
|
|
164405
164436
|
}
|
|
164406
164437
|
}
|
|
164407
164438
|
/// Goto definition
|
|
164408
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
164439
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
164409
164440
|
synchronizeHostData();
|
|
164410
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
164441
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
164411
164442
|
}
|
|
164412
164443
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
164413
164444
|
synchronizeHostData();
|
|
@@ -174357,7 +174388,8 @@ var ts;
|
|
|
174357
174388
|
var providePrefixAndSuffixTextForRename = _a.providePrefixAndSuffixTextForRename;
|
|
174358
174389
|
var outputs = [];
|
|
174359
174390
|
var seen = createDocumentSpanSet();
|
|
174360
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174391
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174392
|
+
/*isForRename*/ true, function (project, location, tryAddToTodo) {
|
|
174361
174393
|
var projectOutputs = project.getLanguageService().findRenameLocations(location.fileName, location.pos, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
|
|
174362
174394
|
if (projectOutputs) {
|
|
174363
174395
|
for (var _i = 0, projectOutputs_1 = projectOutputs; _i < projectOutputs_1.length; _i++) {
|
|
@@ -174371,14 +174403,15 @@ var ts;
|
|
|
174371
174403
|
});
|
|
174372
174404
|
return outputs;
|
|
174373
174405
|
}
|
|
174374
|
-
function getDefinitionLocation(defaultProject, initialLocation) {
|
|
174375
|
-
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos);
|
|
174406
|
+
function getDefinitionLocation(defaultProject, initialLocation, isForRename) {
|
|
174407
|
+
var infos = defaultProject.getLanguageService().getDefinitionAtPosition(initialLocation.fileName, initialLocation.pos, /*searchOtherFilesOnly*/ false, isForRename);
|
|
174376
174408
|
var info = infos && ts.firstOrUndefined(infos);
|
|
174377
174409
|
return info && !info.isLocal ? { fileName: info.fileName, pos: info.textSpan.start } : undefined;
|
|
174378
174410
|
}
|
|
174379
174411
|
function combineProjectOutputForReferences(projects, defaultProject, initialLocation, logger) {
|
|
174380
174412
|
var outputs = [];
|
|
174381
|
-
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174413
|
+
combineProjectOutputWorker(projects, defaultProject, initialLocation,
|
|
174414
|
+
/*isForRename*/ false, function (project, location, getMappedLocation) {
|
|
174382
174415
|
logger.info("Finding references to " + location.fileName + " position " + location.pos + " in project " + project.getProjectName());
|
|
174383
174416
|
var projectOutputs = project.getLanguageService().findReferences(location.fileName, location.pos);
|
|
174384
174417
|
if (projectOutputs) {
|
|
@@ -174425,7 +174458,7 @@ var ts;
|
|
|
174425
174458
|
});
|
|
174426
174459
|
}
|
|
174427
174460
|
}
|
|
174428
|
-
function combineProjectOutputWorker(projects, defaultProject, initialLocation, cb) {
|
|
174461
|
+
function combineProjectOutputWorker(projects, defaultProject, initialLocation, isForRename, cb) {
|
|
174429
174462
|
var projectService = defaultProject.projectService;
|
|
174430
174463
|
var toDo;
|
|
174431
174464
|
var seenProjects = new ts.Set();
|
|
@@ -174436,7 +174469,7 @@ var ts;
|
|
|
174436
174469
|
});
|
|
174437
174470
|
// After initial references are collected, go over every other project and see if it has a reference for the symbol definition.
|
|
174438
174471
|
if (initialLocation) {
|
|
174439
|
-
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation);
|
|
174472
|
+
var defaultDefinition_1 = getDefinitionLocation(defaultProject, initialLocation, isForRename);
|
|
174440
174473
|
if (defaultDefinition_1) {
|
|
174441
174474
|
var getGeneratedDefinition_1 = ts.memoize(function () { return defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition_1.fileName) ?
|
|
174442
174475
|
defaultDefinition_1 :
|
|
@@ -175492,7 +175525,7 @@ var ts;
|
|
|
175492
175525
|
definitions === null || definitions === void 0 ? void 0 : definitions.forEach(function (d) { return definitionSet_1.add(d); });
|
|
175493
175526
|
var noDtsProject = project.getNoDtsResolutionProject([file]);
|
|
175494
175527
|
var ls = noDtsProject.getLanguageService();
|
|
175495
|
-
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175528
|
+
var jsDefinitions = (_a = ls.getDefinitionAtPosition(file, position, /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file; });
|
|
175496
175529
|
if (ts.some(jsDefinitions)) {
|
|
175497
175530
|
for (var _i = 0, jsDefinitions_1 = jsDefinitions; _i < jsDefinitions_1.length; _i++) {
|
|
175498
175531
|
var jsDefinition = jsDefinitions_1[_i];
|
|
@@ -175540,7 +175573,7 @@ var ts;
|
|
|
175540
175573
|
var packageJson = ts.getPackageScopeForPath(project.toPath(packageDirectory + "/package.json"), packageJsonCache, project, compilerOptions);
|
|
175541
175574
|
if (!packageJson)
|
|
175542
175575
|
return undefined;
|
|
175543
|
-
// Use fake options instead of actual compiler options to avoid following export map if the project uses
|
|
175576
|
+
// Use fake options instead of actual compiler options to avoid following export map if the project uses node16 or nodenext -
|
|
175544
175577
|
// Mapping from an export map entry across packages is out of scope for now. Returned entrypoints will only be what can be
|
|
175545
175578
|
// resolved from the package root under --moduleResolution node
|
|
175546
175579
|
var entrypoints = ts.getEntrypointsFromPackageJsonInfo(packageJson, { moduleResolution: ts.ModuleResolutionKind.NodeJs }, project, project.getModuleResolutionCache());
|
|
@@ -175577,7 +175610,7 @@ var ts;
|
|
|
175577
175610
|
var _a;
|
|
175578
175611
|
if (nameInChain === initialNode)
|
|
175579
175612
|
return undefined;
|
|
175580
|
-
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175613
|
+
var candidates = (_a = ls.getDefinitionAtPosition(file, nameInChain.getStart(), /*searchOtherFilesOnly*/ true, /*stopAtAlias*/ false)) === null || _a === void 0 ? void 0 : _a.filter(function (d) { return server.toNormalizedPath(d.fileName) !== file && d.isAmbient; }).map(function (d) { return ({
|
|
175581
175614
|
fileName: d.fileName,
|
|
175582
175615
|
name: ts.getTextOfIdentifierOrLiteral(initialNode)
|
|
175583
175616
|
}); });
|