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
|
@@ -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.20220504";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -5470,10 +5470,11 @@ var ts;
|
|
|
5470
5470
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5471
5471
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5472
5472
|
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5473
|
-
// to better support ecmascript modules and their use within node - more features are still being added
|
|
5474
|
-
//
|
|
5475
|
-
// version-
|
|
5476
|
-
|
|
5473
|
+
// to better support ecmascript modules and their use within node - however more features are still being added.
|
|
5474
|
+
// TypeScript's Node ESM support was introduced after Node 12 went end-of-life, and Node 14 is the earliest stable
|
|
5475
|
+
// version that supports both pattern trailers - *but*, Node 16 is the first version that also supports ECMASCript 2022.
|
|
5476
|
+
// In turn, we offer both a `NodeNext` moving resolution target, and a `Node16` version-anchored resolution target
|
|
5477
|
+
ModuleResolutionKind[ModuleResolutionKind["Node16"] = 3] = "Node16";
|
|
5477
5478
|
ModuleResolutionKind[ModuleResolutionKind["NodeNext"] = 99] = "NodeNext";
|
|
5478
5479
|
})(ModuleResolutionKind = ts.ModuleResolutionKind || (ts.ModuleResolutionKind = {}));
|
|
5479
5480
|
var ModuleDetectionKind;
|
|
@@ -5483,7 +5484,7 @@ var ts;
|
|
|
5483
5484
|
*/
|
|
5484
5485
|
ModuleDetectionKind[ModuleDetectionKind["Legacy"] = 1] = "Legacy";
|
|
5485
5486
|
/**
|
|
5486
|
-
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution:
|
|
5487
|
+
* Legacy, but also files with jsx under react-jsx or react-jsxdev and esm mode files under moduleResolution: node16+
|
|
5487
5488
|
*/
|
|
5488
5489
|
ModuleDetectionKind[ModuleDetectionKind["Auto"] = 2] = "Auto";
|
|
5489
5490
|
/**
|
|
@@ -5528,8 +5529,8 @@ var ts;
|
|
|
5528
5529
|
ModuleKind[ModuleKind["ES2020"] = 6] = "ES2020";
|
|
5529
5530
|
ModuleKind[ModuleKind["ES2022"] = 7] = "ES2022";
|
|
5530
5531
|
ModuleKind[ModuleKind["ESNext"] = 99] = "ESNext";
|
|
5531
|
-
//
|
|
5532
|
-
ModuleKind[ModuleKind["
|
|
5532
|
+
// Node16+ is an amalgam of commonjs (albeit updated) and es2022+, and represents a distinct module system from es2020/esnext
|
|
5533
|
+
ModuleKind[ModuleKind["Node16"] = 100] = "Node16";
|
|
5533
5534
|
ModuleKind[ModuleKind["NodeNext"] = 199] = "NodeNext";
|
|
5534
5535
|
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
|
|
5535
5536
|
var JsxEmit;
|
|
@@ -8451,6 +8452,7 @@ var ts;
|
|
|
8451
8452
|
_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"),
|
|
8452
8453
|
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."),
|
|
8453
8454
|
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."),
|
|
8455
|
+
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."),
|
|
8454
8456
|
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."),
|
|
8455
8457
|
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."),
|
|
8456
8458
|
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."),
|
|
@@ -8462,8 +8464,8 @@ var ts;
|
|
|
8462
8464
|
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."),
|
|
8463
8465
|
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."),
|
|
8464
8466
|
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."),
|
|
8465
|
-
|
|
8466
|
-
|
|
8467
|
+
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'."),
|
|
8468
|
+
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'."),
|
|
8467
8469
|
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."),
|
|
8468
8470
|
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."),
|
|
8469
8471
|
String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."),
|
|
@@ -8480,7 +8482,7 @@ var ts;
|
|
|
8480
8482
|
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."),
|
|
8481
8483
|
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}')'?"),
|
|
8482
8484
|
Type_arguments_cannot_be_used_here: diag(1342, ts.DiagnosticCategory.Error, "Type_arguments_cannot_be_used_here_1342", "Type arguments cannot be used here."),
|
|
8483
|
-
|
|
8485
|
+
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'."),
|
|
8484
8486
|
A_label_is_not_allowed_here: diag(1344, ts.DiagnosticCategory.Error, "A_label_is_not_allowed_here_1344", "'A label is not allowed here."),
|
|
8485
8487
|
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."),
|
|
8486
8488
|
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."),
|
|
@@ -8511,7 +8513,7 @@ var ts;
|
|
|
8511
8513
|
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."),
|
|
8512
8514
|
_0_was_imported_here: diag(1376, ts.DiagnosticCategory.Message, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
8513
8515
|
_0_was_exported_here: diag(1377, ts.DiagnosticCategory.Message, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
8514
|
-
|
|
8516
|
+
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."),
|
|
8515
8517
|
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'."),
|
|
8516
8518
|
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'."),
|
|
8517
8519
|
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 `}`?"),
|
|
@@ -8563,7 +8565,7 @@ var ts;
|
|
|
8563
8565
|
File_redirects_to_file_0: diag(1429, ts.DiagnosticCategory.Message, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
8564
8566
|
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:"),
|
|
8565
8567
|
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."),
|
|
8566
|
-
|
|
8568
|
+
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."),
|
|
8567
8569
|
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."),
|
|
8568
8570
|
Unexpected_keyword_or_identifier: diag(1434, ts.DiagnosticCategory.Error, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
8569
8571
|
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}'?"),
|
|
@@ -8581,7 +8583,7 @@ var ts;
|
|
|
8581
8583
|
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."),
|
|
8582
8584
|
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"),
|
|
8583
8585
|
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"),
|
|
8584
|
-
|
|
8586
|
+
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`."),
|
|
8585
8587
|
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`."),
|
|
8586
8588
|
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."),
|
|
8587
8589
|
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."),
|
|
@@ -8592,7 +8594,7 @@ var ts;
|
|
|
8592
8594
|
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."),
|
|
8593
8595
|
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."),
|
|
8594
8596
|
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."),
|
|
8595
|
-
|
|
8597
|
+
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."),
|
|
8596
8598
|
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."),
|
|
8597
8599
|
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."),
|
|
8598
8600
|
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),
|
|
@@ -8601,7 +8603,6 @@ var ts;
|
|
|
8601
8603
|
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),
|
|
8602
8604
|
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."),
|
|
8603
8605
|
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."),
|
|
8604
|
-
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."),
|
|
8605
8606
|
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
|
|
8606
8607
|
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."),
|
|
8607
8608
|
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."),
|
|
@@ -9079,8 +9080,8 @@ var ts;
|
|
|
9079
9080
|
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'."),
|
|
9080
9081
|
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."),
|
|
9081
9082
|
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}'?"),
|
|
9082
|
-
|
|
9083
|
-
|
|
9083
|
+
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."),
|
|
9084
|
+
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}'?"),
|
|
9084
9085
|
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."),
|
|
9085
9086
|
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."),
|
|
9086
9087
|
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."),
|
|
@@ -9746,7 +9747,6 @@ var ts;
|
|
|
9746
9747
|
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."),
|
|
9747
9748
|
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."),
|
|
9748
9749
|
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."),
|
|
9749
|
-
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."),
|
|
9750
9750
|
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
|
|
9751
9751
|
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."),
|
|
9752
9752
|
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."),
|
|
@@ -15039,7 +15039,7 @@ var ts;
|
|
|
15039
15039
|
}
|
|
15040
15040
|
ts.getNonAugmentationDeclaration = getNonAugmentationDeclaration;
|
|
15041
15041
|
function isCommonJSContainingModuleKind(kind) {
|
|
15042
|
-
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.
|
|
15042
|
+
return kind === ts.ModuleKind.CommonJS || kind === ts.ModuleKind.Node16 || kind === ts.ModuleKind.NodeNext;
|
|
15043
15043
|
}
|
|
15044
15044
|
function isEffectiveExternalModule(node, compilerOptions) {
|
|
15045
15045
|
return ts.isExternalModule(node) || compilerOptions.isolatedModules || (isCommonJSContainingModuleKind(getEmitModuleKind(compilerOptions)) && !!node.commonJsModuleIndicator);
|
|
@@ -20207,7 +20207,7 @@ var ts;
|
|
|
20207
20207
|
file.externalModuleIndicator = ts.isFileProbablyExternalModule(file);
|
|
20208
20208
|
};
|
|
20209
20209
|
case ts.ModuleDetectionKind.Auto:
|
|
20210
|
-
// If module is nodenext or
|
|
20210
|
+
// If module is nodenext or node16, all esm format files are modules
|
|
20211
20211
|
// If jsx is react-jsx or react-jsxdev then jsx tags force module-ness
|
|
20212
20212
|
// otherwise, the presence of import or export statments (or import.meta) implies module-ness
|
|
20213
20213
|
var checks = [ts.isFileProbablyExternalModule];
|
|
@@ -20215,7 +20215,7 @@ var ts;
|
|
|
20215
20215
|
checks.push(isFileModuleFromUsingJSXTag);
|
|
20216
20216
|
}
|
|
20217
20217
|
var moduleKind = getEmitModuleKind(options);
|
|
20218
|
-
if (moduleKind === ts.ModuleKind.
|
|
20218
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
20219
20219
|
checks.push(isFileForcedToBeModuleByFormat);
|
|
20220
20220
|
}
|
|
20221
20221
|
var combined_1 = ts.or.apply(void 0, checks);
|
|
@@ -20226,7 +20226,7 @@ var ts;
|
|
|
20226
20226
|
ts.getSetExternalModuleIndicator = getSetExternalModuleIndicator;
|
|
20227
20227
|
function getEmitScriptTarget(compilerOptions) {
|
|
20228
20228
|
return compilerOptions.target ||
|
|
20229
|
-
(compilerOptions.module === ts.ModuleKind.
|
|
20229
|
+
(compilerOptions.module === ts.ModuleKind.Node16 && 9 /* ES2022 */) ||
|
|
20230
20230
|
(compilerOptions.module === ts.ModuleKind.NodeNext && 99 /* ESNext */) ||
|
|
20231
20231
|
0 /* ES3 */;
|
|
20232
20232
|
}
|
|
@@ -20244,8 +20244,8 @@ var ts;
|
|
|
20244
20244
|
case ts.ModuleKind.CommonJS:
|
|
20245
20245
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
20246
20246
|
break;
|
|
20247
|
-
case ts.ModuleKind.
|
|
20248
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
20247
|
+
case ts.ModuleKind.Node16:
|
|
20248
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
20249
20249
|
break;
|
|
20250
20250
|
case ts.ModuleKind.NodeNext:
|
|
20251
20251
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -20270,7 +20270,7 @@ var ts;
|
|
|
20270
20270
|
case ts.ModuleKind.ES2020:
|
|
20271
20271
|
case ts.ModuleKind.ES2022:
|
|
20272
20272
|
case ts.ModuleKind.ESNext:
|
|
20273
|
-
case ts.ModuleKind.
|
|
20273
|
+
case ts.ModuleKind.Node16:
|
|
20274
20274
|
case ts.ModuleKind.NodeNext:
|
|
20275
20275
|
return true;
|
|
20276
20276
|
default:
|
|
@@ -20295,7 +20295,7 @@ var ts;
|
|
|
20295
20295
|
return compilerOptions.esModuleInterop;
|
|
20296
20296
|
}
|
|
20297
20297
|
switch (getEmitModuleKind(compilerOptions)) {
|
|
20298
|
-
case ts.ModuleKind.
|
|
20298
|
+
case ts.ModuleKind.Node16:
|
|
20299
20299
|
case ts.ModuleKind.NodeNext:
|
|
20300
20300
|
return true;
|
|
20301
20301
|
}
|
|
@@ -39501,7 +39501,7 @@ var ts;
|
|
|
39501
39501
|
es2020: ts.ModuleKind.ES2020,
|
|
39502
39502
|
es2022: ts.ModuleKind.ES2022,
|
|
39503
39503
|
esnext: ts.ModuleKind.ESNext,
|
|
39504
|
-
|
|
39504
|
+
node16: ts.ModuleKind.Node16,
|
|
39505
39505
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39506
39506
|
})),
|
|
39507
39507
|
affectsModuleResolution: true,
|
|
@@ -39855,7 +39855,7 @@ var ts;
|
|
|
39855
39855
|
type: new ts.Map(ts.getEntries({
|
|
39856
39856
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39857
39857
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39858
|
-
|
|
39858
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39859
39859
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39860
39860
|
})),
|
|
39861
39861
|
affectsModuleResolution: true,
|
|
@@ -40331,7 +40331,7 @@ var ts;
|
|
|
40331
40331
|
affectsModuleResolution: true,
|
|
40332
40332
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40333
40333
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40334
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40334
|
+
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,
|
|
40335
40335
|
}
|
|
40336
40336
|
];
|
|
40337
40337
|
/* @internal */
|
|
@@ -42567,9 +42567,9 @@ var ts;
|
|
|
42567
42567
|
// set in a non-modal module resolution setting here. Do note that our behavior is not particularly well defined when these mode-overriding imports
|
|
42568
42568
|
// 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,
|
|
42569
42569
|
// 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
|
|
42570
|
-
// resolution" should be (`
|
|
42570
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42571
42571
|
// context should _probably_ be an error - and that should likely be handled by the `Program` (which is what we do).
|
|
42572
|
-
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42572
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42573
42573
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42574
42574
|
}
|
|
42575
42575
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42658,7 +42658,7 @@ var ts;
|
|
|
42658
42658
|
}
|
|
42659
42659
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42660
42660
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42661
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42661
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42662
42662
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42663
42663
|
NodeResolutionFeatures.None;
|
|
42664
42664
|
}
|
|
@@ -43016,8 +43016,8 @@ var ts;
|
|
|
43016
43016
|
case ts.ModuleKind.CommonJS:
|
|
43017
43017
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
43018
43018
|
break;
|
|
43019
|
-
case ts.ModuleKind.
|
|
43020
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
43019
|
+
case ts.ModuleKind.Node16:
|
|
43020
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
43021
43021
|
break;
|
|
43022
43022
|
case ts.ModuleKind.NodeNext:
|
|
43023
43023
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -43037,8 +43037,8 @@ var ts;
|
|
|
43037
43037
|
}
|
|
43038
43038
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
43039
43039
|
switch (moduleResolution) {
|
|
43040
|
-
case ts.ModuleResolutionKind.
|
|
43041
|
-
result =
|
|
43040
|
+
case ts.ModuleResolutionKind.Node16:
|
|
43041
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43042
43042
|
break;
|
|
43043
43043
|
case ts.ModuleResolutionKind.NodeNext:
|
|
43044
43044
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43272,15 +43272,15 @@ var ts;
|
|
|
43272
43272
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43273
43273
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43274
43274
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43275
|
-
// not
|
|
43275
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43276
43276
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43277
43277
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43278
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43278
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43279
43279
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43280
43280
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43281
43281
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43282
|
-
function
|
|
43283
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43282
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43283
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43284
43284
|
}
|
|
43285
43285
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43286
43286
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43320,7 +43320,7 @@ var ts;
|
|
|
43320
43320
|
var _a, _b;
|
|
43321
43321
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43322
43322
|
var failedLookupLocations = [];
|
|
43323
|
-
// conditions are only used by the
|
|
43323
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43324
43324
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43325
43325
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43326
43326
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48707,7 +48707,7 @@ var ts;
|
|
|
48707
48707
|
var enumRelation = new ts.Map();
|
|
48708
48708
|
var builtinGlobals = ts.createSymbolTable();
|
|
48709
48709
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48710
|
-
// Extensions suggested for path imports when module resolution is
|
|
48710
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48711
48711
|
// The first element of each tuple is the extension a file has.
|
|
48712
48712
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48713
48713
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50996,7 +50996,7 @@ var ts;
|
|
|
50996
50996
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50997
50997
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50998
50998
|
}
|
|
50999
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50999
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
51000
51000
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
51001
51001
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
51002
51002
|
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;
|
|
@@ -51005,9 +51005,6 @@ var ts;
|
|
|
51005
51005
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51006
51006
|
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);
|
|
51007
51007
|
}
|
|
51008
|
-
if (mode === ts.ModuleKind.ESNext && compilerOptions.resolveJsonModule && resolvedModule.extension === ".json" /* Json */) {
|
|
51009
|
-
error(errorNode, ts.Diagnostics.JSON_imports_are_experimental_in_ES_module_mode_imports);
|
|
51010
|
-
}
|
|
51011
51008
|
}
|
|
51012
51009
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
51013
51010
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -51060,7 +51057,7 @@ var ts;
|
|
|
51060
51057
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
51061
51058
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
51062
51059
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
51063
|
-
var
|
|
51060
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
51064
51061
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
51065
51062
|
if (tsExtension) {
|
|
51066
51063
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -51081,17 +51078,17 @@ var ts;
|
|
|
51081
51078
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
51082
51079
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51083
51080
|
}
|
|
51084
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51081
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51085
51082
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
51086
51083
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
51087
51084
|
var actualExt = _a[0], _importExt = _a[1];
|
|
51088
51085
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
51089
51086
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
51090
51087
|
if (suggestedExt) {
|
|
51091
|
-
error(errorNode, ts.Diagnostics.
|
|
51088
|
+
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);
|
|
51092
51089
|
}
|
|
51093
51090
|
else {
|
|
51094
|
-
error(errorNode, ts.Diagnostics.
|
|
51091
|
+
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);
|
|
51095
51092
|
}
|
|
51096
51093
|
}
|
|
51097
51094
|
else {
|
|
@@ -53413,7 +53410,7 @@ var ts;
|
|
|
53413
53410
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53414
53411
|
var specifier = void 0;
|
|
53415
53412
|
var assertion = void 0;
|
|
53416
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53413
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53417
53414
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53418
53415
|
if ((targetFile === null || targetFile === void 0 ? void 0 : targetFile.impliedNodeFormat) === ts.ModuleKind.ESNext && targetFile.impliedNodeFormat !== (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat)) {
|
|
53419
53416
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53427,7 +53424,7 @@ var ts;
|
|
|
53427
53424
|
}
|
|
53428
53425
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53429
53426
|
var oldSpecifier = specifier;
|
|
53430
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53427
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53431
53428
|
// We might be able to write a portable import type using a mode override; try specifier generation again, but with a different mode set
|
|
53432
53429
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53433
53430
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -64904,7 +64901,6 @@ var ts;
|
|
|
64904
64901
|
return 0 /* False */;
|
|
64905
64902
|
}
|
|
64906
64903
|
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
64907
|
-
var _a, _b;
|
|
64908
64904
|
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
64909
64905
|
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
64910
64906
|
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
@@ -64945,9 +64941,6 @@ var ts;
|
|
|
64945
64941
|
return;
|
|
64946
64942
|
}
|
|
64947
64943
|
reportRelationError(headMessage, source, target);
|
|
64948
|
-
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 */))) {
|
|
64949
|
-
associateRelatedInfo(ts.createDiagnosticForNode(source.symbol.declarations[0], ts.Diagnostics.This_type_parameter_probably_needs_an_extends_object_constraint));
|
|
64950
|
-
}
|
|
64951
64944
|
}
|
|
64952
64945
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
64953
64946
|
if (!ts.tracing) {
|
|
@@ -65720,7 +65713,7 @@ var ts;
|
|
|
65720
65713
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65721
65714
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65722
65715
|
var constraint = getConstraintOfType(source);
|
|
65723
|
-
if (!
|
|
65716
|
+
if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65724
65717
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65725
65718
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65726
65719
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65728,12 +65721,12 @@ var ts;
|
|
|
65728
65721
|
}
|
|
65729
65722
|
}
|
|
65730
65723
|
// 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
|
|
65731
|
-
else if (
|
|
65724
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65732
65725
|
resetErrorInfo(saveErrorInfo);
|
|
65733
65726
|
return result;
|
|
65734
65727
|
}
|
|
65735
65728
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65736
|
-
else if (
|
|
65729
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65737
65730
|
resetErrorInfo(saveErrorInfo);
|
|
65738
65731
|
return result;
|
|
65739
65732
|
}
|
|
@@ -71396,7 +71389,7 @@ var ts;
|
|
|
71396
71389
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71397
71390
|
var parent = declaration.parent.parent;
|
|
71398
71391
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71399
|
-
var links = getNodeLinks(
|
|
71392
|
+
var links = getNodeLinks(parent);
|
|
71400
71393
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71401
71394
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71402
71395
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77259,13 +77252,13 @@ var ts;
|
|
|
77259
77252
|
}
|
|
77260
77253
|
}
|
|
77261
77254
|
function checkImportMetaProperty(node) {
|
|
77262
|
-
if (moduleKind === ts.ModuleKind.
|
|
77255
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77263
77256
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77264
77257
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77265
77258
|
}
|
|
77266
77259
|
}
|
|
77267
77260
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77268
|
-
error(node, ts.Diagnostics.
|
|
77261
|
+
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_when_the_module_option_is_es2020_es2022_esnext_system_node16_or_nodenext);
|
|
77269
77262
|
}
|
|
77270
77263
|
var file = ts.getSourceFileOfNode(node);
|
|
77271
77264
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78216,15 +78209,30 @@ var ts;
|
|
|
78216
78209
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78217
78210
|
var span = void 0;
|
|
78218
78211
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78219
|
-
|
|
78220
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78212
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78221
78213
|
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);
|
|
78222
78214
|
diagnostics.add(diagnostic);
|
|
78223
78215
|
}
|
|
78224
|
-
|
|
78225
|
-
|
|
78226
|
-
|
|
78227
|
-
|
|
78216
|
+
switch (moduleKind) {
|
|
78217
|
+
case ts.ModuleKind.Node16:
|
|
78218
|
+
case ts.ModuleKind.NodeNext:
|
|
78219
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78220
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78221
|
+
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));
|
|
78222
|
+
break;
|
|
78223
|
+
}
|
|
78224
|
+
// fallthrough
|
|
78225
|
+
case ts.ModuleKind.ES2022:
|
|
78226
|
+
case ts.ModuleKind.ESNext:
|
|
78227
|
+
case ts.ModuleKind.System:
|
|
78228
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78229
|
+
break;
|
|
78230
|
+
}
|
|
78231
|
+
// fallthrough
|
|
78232
|
+
default:
|
|
78233
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78234
|
+
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));
|
|
78235
|
+
break;
|
|
78228
78236
|
}
|
|
78229
78237
|
}
|
|
78230
78238
|
}
|
|
@@ -80666,8 +80674,8 @@ var ts;
|
|
|
80666
80674
|
if (node.assertions) {
|
|
80667
80675
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80668
80676
|
if (override) {
|
|
80669
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80670
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80677
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80678
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80671
80679
|
}
|
|
80672
80680
|
}
|
|
80673
80681
|
}
|
|
@@ -82117,7 +82125,7 @@ var ts;
|
|
|
82117
82125
|
}
|
|
82118
82126
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
82119
82127
|
// No need to check for require or exports for ES6 modules and later
|
|
82120
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82128
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
82121
82129
|
return;
|
|
82122
82130
|
}
|
|
82123
82131
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -85037,8 +85045,8 @@ var ts;
|
|
|
85037
85045
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85038
85046
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85039
85047
|
if (validForTypeAssertions && override) {
|
|
85040
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
85041
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85048
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85049
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85042
85050
|
}
|
|
85043
85051
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85044
85052
|
}
|
|
@@ -88225,8 +88233,24 @@ var ts;
|
|
|
88225
88233
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88226
88234
|
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));
|
|
88227
88235
|
}
|
|
88228
|
-
|
|
88229
|
-
|
|
88236
|
+
switch (moduleKind) {
|
|
88237
|
+
case ts.ModuleKind.Node16:
|
|
88238
|
+
case ts.ModuleKind.NodeNext:
|
|
88239
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88240
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88241
|
+
break;
|
|
88242
|
+
}
|
|
88243
|
+
// fallthrough
|
|
88244
|
+
case ts.ModuleKind.ES2022:
|
|
88245
|
+
case ts.ModuleKind.ESNext:
|
|
88246
|
+
case ts.ModuleKind.System:
|
|
88247
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88248
|
+
break;
|
|
88249
|
+
}
|
|
88250
|
+
// fallthrough
|
|
88251
|
+
default:
|
|
88252
|
+
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));
|
|
88253
|
+
break;
|
|
88230
88254
|
}
|
|
88231
88255
|
}
|
|
88232
88256
|
}
|
|
@@ -88921,7 +88945,7 @@ var ts;
|
|
|
88921
88945
|
}
|
|
88922
88946
|
function checkGrammarImportCallExpression(node) {
|
|
88923
88947
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88924
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88948
|
+
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);
|
|
88925
88949
|
}
|
|
88926
88950
|
if (node.typeArguments) {
|
|
88927
88951
|
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);
|
|
@@ -88932,7 +88956,7 @@ var ts;
|
|
|
88932
88956
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88933
88957
|
if (nodeArguments.length > 1) {
|
|
88934
88958
|
var assertionArgument = nodeArguments[1];
|
|
88935
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88959
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88936
88960
|
}
|
|
88937
88961
|
}
|
|
88938
88962
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -109198,7 +109222,7 @@ var ts;
|
|
|
109198
109222
|
return ts.transformECMAScriptModule;
|
|
109199
109223
|
case ts.ModuleKind.System:
|
|
109200
109224
|
return ts.transformSystemModule;
|
|
109201
|
-
case ts.ModuleKind.
|
|
109225
|
+
case ts.ModuleKind.Node16:
|
|
109202
109226
|
case ts.ModuleKind.NodeNext:
|
|
109203
109227
|
return ts.transformNodeModule;
|
|
109204
109228
|
default:
|
|
@@ -116221,7 +116245,7 @@ var ts;
|
|
|
116221
116245
|
*/
|
|
116222
116246
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116223
116247
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116224
|
-
case ts.ModuleResolutionKind.
|
|
116248
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116225
116249
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116226
116250
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116227
116251
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116520,7 +116544,7 @@ var ts;
|
|
|
116520
116544
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116521
116545
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116522
116546
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116523
|
-
// under
|
|
116547
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116524
116548
|
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 });
|
|
116525
116549
|
}
|
|
116526
116550
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118173,8 +118197,8 @@ var ts;
|
|
|
118173
118197
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
118174
118198
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118175
118199
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118176
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118177
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118200
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118201
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118178
118202
|
}
|
|
118179
118203
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118180
118204
|
}
|
|
@@ -118536,7 +118560,7 @@ var ts;
|
|
|
118536
118560
|
}
|
|
118537
118561
|
if (options.resolveJsonModule) {
|
|
118538
118562
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118539
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118563
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118540
118564
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118541
118565
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118542
118566
|
}
|
|
@@ -121676,7 +121700,7 @@ var ts;
|
|
|
121676
121700
|
}
|
|
121677
121701
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121678
121702
|
var _a;
|
|
121679
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121703
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121680
121704
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121681
121705
|
return false;
|
|
121682
121706
|
}
|
|
@@ -122261,7 +122285,7 @@ var ts;
|
|
|
122261
122285
|
var cachedPackageJson = (_b = (_a = host.getPackageJsonInfoCache) === null || _a === void 0 ? void 0 : _a.call(host)) === null || _b === void 0 ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
122262
122286
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122263
122287
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122264
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122288
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122265
122289
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122266
122290
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122267
122291
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127875,11 +127899,11 @@ var ts;
|
|
|
127875
127899
|
}
|
|
127876
127900
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127877
127901
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127878
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127902
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127879
127903
|
}
|
|
127880
127904
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127881
127905
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127882
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127906
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127883
127907
|
}
|
|
127884
127908
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127885
127909
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -131203,11 +131227,11 @@ var ts;
|
|
|
131203
131227
|
}
|
|
131204
131228
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
131205
131229
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
131206
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131230
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131207
131231
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131208
131232
|
}
|
|
131209
131233
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
131210
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131234
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131211
131235
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131212
131236
|
}
|
|
131213
131237
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -133756,7 +133780,7 @@ var ts;
|
|
|
133756
133780
|
return;
|
|
133757
133781
|
}
|
|
133758
133782
|
// Do a relatively cheap check to bail early if all re-exports are non-importable
|
|
133759
|
-
// due to file location or package.json dependency filtering. For non-
|
|
133783
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133760
133784
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133761
133785
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133762
133786
|
// even if we defer computing the module specifier.
|
|
@@ -133764,7 +133788,7 @@ var ts;
|
|
|
133764
133788
|
if (!firstImportableExportInfo) {
|
|
133765
133789
|
return;
|
|
133766
133790
|
}
|
|
133767
|
-
// In
|
|
133791
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133768
133792
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133769
133793
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133770
133794
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -139359,7 +139383,7 @@ var ts;
|
|
|
139359
139383
|
(function (ts) {
|
|
139360
139384
|
var GoToDefinition;
|
|
139361
139385
|
(function (GoToDefinition) {
|
|
139362
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139386
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
139363
139387
|
var _a;
|
|
139364
139388
|
var _b;
|
|
139365
139389
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -139384,7 +139408,7 @@ var ts;
|
|
|
139384
139408
|
}
|
|
139385
139409
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139386
139410
|
var classDecl = node.parent.parent;
|
|
139387
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139411
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139388
139412
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139389
139413
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139390
139414
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -139394,14 +139418,14 @@ var ts;
|
|
|
139394
139418
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139395
139419
|
});
|
|
139396
139420
|
}
|
|
139397
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139421
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139398
139422
|
var fallbackNode = node;
|
|
139399
139423
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139400
139424
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
139401
139425
|
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); });
|
|
139402
139426
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139403
139427
|
if (moduleSpecifier) {
|
|
139404
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139428
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139405
139429
|
fallbackNode = moduleSpecifier;
|
|
139406
139430
|
}
|
|
139407
139431
|
}
|
|
@@ -139575,7 +139599,7 @@ var ts;
|
|
|
139575
139599
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139576
139600
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139577
139601
|
}
|
|
139578
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139602
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139579
139603
|
if (!symbol)
|
|
139580
139604
|
return undefined;
|
|
139581
139605
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139626,14 +139650,14 @@ var ts;
|
|
|
139626
139650
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139627
139651
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139628
139652
|
}
|
|
139629
|
-
function getSymbol(node, checker) {
|
|
139653
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139630
139654
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139631
139655
|
// If this is an alias, and the request came at the declaration location
|
|
139632
139656
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139633
139657
|
// import {A, B} from "mod";
|
|
139634
139658
|
// to jump to the implementation directly.
|
|
139635
139659
|
var failedAliasResolution = false;
|
|
139636
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139660
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139637
139661
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139638
139662
|
if (aliased.declarations) {
|
|
139639
139663
|
return { symbol: aliased };
|
|
@@ -147227,6 +147251,13 @@ var ts;
|
|
|
147227
147251
|
var listStartToken = getOpenTokenForList(parent, nodes);
|
|
147228
147252
|
var listDynamicIndentation = parentDynamicIndentation;
|
|
147229
147253
|
var startLine = parentStartLine;
|
|
147254
|
+
// node range is outside the target range - do not dive inside
|
|
147255
|
+
if (!ts.rangeOverlapsWithStartEnd(originalRange, nodes.pos, nodes.end)) {
|
|
147256
|
+
if (nodes.end < originalRange.pos) {
|
|
147257
|
+
formattingScanner.skipToEndOf(nodes);
|
|
147258
|
+
}
|
|
147259
|
+
return;
|
|
147260
|
+
}
|
|
147230
147261
|
if (listStartToken !== 0 /* Unknown */) {
|
|
147231
147262
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
147232
147263
|
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
@@ -153219,7 +153250,7 @@ var ts;
|
|
|
153219
153250
|
case ts.ModuleKind.None:
|
|
153220
153251
|
// Fall back to the `import * as ns` style import.
|
|
153221
153252
|
return 2 /* Namespace */;
|
|
153222
|
-
case ts.ModuleKind.
|
|
153253
|
+
case ts.ModuleKind.Node16:
|
|
153223
153254
|
case ts.ModuleKind.NodeNext:
|
|
153224
153255
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153225
153256
|
default:
|
|
@@ -155132,8 +155163,8 @@ var ts;
|
|
|
155132
155163
|
(function (codefix) {
|
|
155133
155164
|
codefix.registerCodeFix({
|
|
155134
155165
|
errorCodes: [
|
|
155135
|
-
ts.Diagnostics.
|
|
155136
|
-
ts.Diagnostics.
|
|
155166
|
+
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,
|
|
155167
|
+
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,
|
|
155137
155168
|
],
|
|
155138
155169
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
155139
155170
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -165016,9 +165047,9 @@ var ts;
|
|
|
165016
165047
|
}
|
|
165017
165048
|
}
|
|
165018
165049
|
/// Goto definition
|
|
165019
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
165050
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
165020
165051
|
synchronizeHostData();
|
|
165021
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
165052
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
165022
165053
|
}
|
|
165023
165054
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
165024
165055
|
synchronizeHostData();
|