typescript 4.7.0-dev.20220502 → 4.7.0-dev.20220505
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/de/diagnosticMessages.generated.json +2 -2
- package/lib/es/diagnosticMessages.generated.json +2 -2
- package/lib/ja/diagnosticMessages.generated.json +2 -2
- package/lib/lib.es2020.bigint.d.ts +4 -4
- package/lib/lib.es5.d.ts +14 -14
- package/lib/pl/diagnosticMessages.generated.json +2 -2
- package/lib/tr/diagnosticMessages.generated.json +2 -2
- package/lib/tsc.js +135 -119
- package/lib/tsserver.js +193 -174
- package/lib/tsserverlibrary.d.ts +7 -7
- package/lib/tsserverlibrary.js +193 -174
- package/lib/typescript.d.ts +7 -7
- package/lib/typescript.js +182 -165
- package/lib/typescriptServices.d.ts +7 -7
- package/lib/typescriptServices.js +182 -165
- package/lib/typingsInstaller.js +151 -144
- 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.20220505";
|
|
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
|
}
|
|
@@ -26377,7 +26377,7 @@ var ts;
|
|
|
26377
26377
|
return node;
|
|
26378
26378
|
}
|
|
26379
26379
|
function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) {
|
|
26380
|
-
var node = baseFactory.createBaseSourceFileNode(305 /* SourceFile */);
|
|
26380
|
+
var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SourceFile */));
|
|
26381
26381
|
for (var p in source) {
|
|
26382
26382
|
if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p))
|
|
26383
26383
|
continue;
|
|
@@ -31502,7 +31502,7 @@ var ts;
|
|
|
31502
31502
|
initializeState("", content, languageVersion, /*syntaxCursor*/ undefined, 1 /* JS */);
|
|
31503
31503
|
// Prime the scanner.
|
|
31504
31504
|
nextToken();
|
|
31505
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
31505
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
31506
31506
|
var isInvalid = token() === 1 /* EndOfFileToken */ && !parseDiagnostics.length;
|
|
31507
31507
|
clearState();
|
|
31508
31508
|
return isInvalid ? entityName : undefined;
|
|
@@ -33102,7 +33102,7 @@ var ts;
|
|
|
33102
33102
|
}
|
|
33103
33103
|
return createMissingList();
|
|
33104
33104
|
}
|
|
33105
|
-
function parseEntityName(allowReservedWords,
|
|
33105
|
+
function parseEntityName(allowReservedWords, diagnosticMessage) {
|
|
33106
33106
|
var pos = getNodePos();
|
|
33107
33107
|
var entity = allowReservedWords ? parseIdentifierName(diagnosticMessage) : parseIdentifier(diagnosticMessage);
|
|
33108
33108
|
var dotPos = getNodePos();
|
|
@@ -33113,7 +33113,7 @@ var ts;
|
|
|
33113
33113
|
break;
|
|
33114
33114
|
}
|
|
33115
33115
|
dotPos = getNodePos();
|
|
33116
|
-
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, allowPrivateIdentifiers)), pos);
|
|
33116
|
+
entity = finishNode(factory.createQualifiedName(entity, parseRightSideOfDot(allowReservedWords, /* allowPrivateIdentifiers */ false)), pos);
|
|
33117
33117
|
}
|
|
33118
33118
|
return entity;
|
|
33119
33119
|
}
|
|
@@ -33246,7 +33246,7 @@ var ts;
|
|
|
33246
33246
|
}
|
|
33247
33247
|
// TYPES
|
|
33248
33248
|
function parseEntityNameOfTypeReference() {
|
|
33249
|
-
return parseEntityName(/*allowReservedWords*/ true,
|
|
33249
|
+
return parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
|
|
33250
33250
|
}
|
|
33251
33251
|
function parseTypeArgumentsOfTypeReference() {
|
|
33252
33252
|
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 29 /* LessThanToken */) {
|
|
@@ -33379,7 +33379,7 @@ var ts;
|
|
|
33379
33379
|
function parseTypeQuery() {
|
|
33380
33380
|
var pos = getNodePos();
|
|
33381
33381
|
parseExpected(112 /* TypeOfKeyword */);
|
|
33382
|
-
var entityName = parseEntityName(/*allowReservedWords*/ true
|
|
33382
|
+
var entityName = parseEntityName(/*allowReservedWords*/ true);
|
|
33383
33383
|
// Make sure we perform ASI to prevent parsing the next line's type arguments as part of an instantiation expression.
|
|
33384
33384
|
var typeArguments = !scanner.hasPrecedingLineBreak() ? tryParseTypeArguments() : undefined;
|
|
33385
33385
|
return finishNode(factory.createTypeQueryNode(entityName, typeArguments), pos);
|
|
@@ -34347,10 +34347,10 @@ var ts;
|
|
|
34347
34347
|
setDecoratorContext(/*val*/ false);
|
|
34348
34348
|
}
|
|
34349
34349
|
var pos = getNodePos();
|
|
34350
|
-
var expr = parseAssignmentExpressionOrHigher(
|
|
34350
|
+
var expr = parseAssignmentExpressionOrHigher();
|
|
34351
34351
|
var operatorToken;
|
|
34352
34352
|
while ((operatorToken = parseOptionalToken(27 /* CommaToken */))) {
|
|
34353
|
-
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(
|
|
34353
|
+
expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher(), pos);
|
|
34354
34354
|
}
|
|
34355
34355
|
if (saveDecoratorContext) {
|
|
34356
34356
|
setDecoratorContext(/*val*/ true);
|
|
@@ -34358,9 +34358,9 @@ var ts;
|
|
|
34358
34358
|
return expr;
|
|
34359
34359
|
}
|
|
34360
34360
|
function parseInitializer() {
|
|
34361
|
-
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher(
|
|
34361
|
+
return parseOptional(63 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
|
|
34362
34362
|
}
|
|
34363
|
-
function parseAssignmentExpressionOrHigher(
|
|
34363
|
+
function parseAssignmentExpressionOrHigher() {
|
|
34364
34364
|
// AssignmentExpression[in,yield]:
|
|
34365
34365
|
// 1) ConditionalExpression[?in,?yield]
|
|
34366
34366
|
// 2) LeftHandSideExpression = AssignmentExpression[?in,?yield]
|
|
@@ -34386,7 +34386,7 @@ var ts;
|
|
|
34386
34386
|
// If we do successfully parse arrow-function, we must *not* recurse for productions 1, 2 or 3. An ArrowFunction is
|
|
34387
34387
|
// not a LeftHandSideExpression, nor does it start a ConditionalExpression. So we are done
|
|
34388
34388
|
// with AssignmentExpression if we see one.
|
|
34389
|
-
var arrowExpression = tryParseParenthesizedArrowFunctionExpression(
|
|
34389
|
+
var arrowExpression = tryParseParenthesizedArrowFunctionExpression() || tryParseAsyncSimpleArrowFunctionExpression();
|
|
34390
34390
|
if (arrowExpression) {
|
|
34391
34391
|
return arrowExpression;
|
|
34392
34392
|
}
|
|
@@ -34405,7 +34405,7 @@ var ts;
|
|
|
34405
34405
|
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
|
|
34406
34406
|
// identifier and the current token is an arrow.
|
|
34407
34407
|
if (expr.kind === 79 /* Identifier */ && token() === 38 /* EqualsGreaterThanToken */) {
|
|
34408
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34408
|
+
return parseSimpleArrowFunctionExpression(pos, expr, /*asyncModifier*/ undefined);
|
|
34409
34409
|
}
|
|
34410
34410
|
// Now see if we might be in cases '2' or '3'.
|
|
34411
34411
|
// If the expression was a LHS expression, and we have an assignment operator, then
|
|
@@ -34414,7 +34414,7 @@ var ts;
|
|
|
34414
34414
|
// Note: we call reScanGreaterToken so that we get an appropriately merged token
|
|
34415
34415
|
// for cases like `> > =` becoming `>>=`
|
|
34416
34416
|
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
|
|
34417
|
-
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(
|
|
34417
|
+
return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher(), pos);
|
|
34418
34418
|
}
|
|
34419
34419
|
// It wasn't an assignment or a lambda. This is a conditional expression:
|
|
34420
34420
|
return parseConditionalExpressionRest(expr, pos);
|
|
@@ -34457,7 +34457,7 @@ var ts;
|
|
|
34457
34457
|
nextToken();
|
|
34458
34458
|
if (!scanner.hasPrecedingLineBreak() &&
|
|
34459
34459
|
(token() === 41 /* AsteriskToken */ || isStartOfExpression())) {
|
|
34460
|
-
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher(
|
|
34460
|
+
return finishNode(factory.createYieldExpression(parseOptionalToken(41 /* AsteriskToken */), parseAssignmentExpressionOrHigher()), pos);
|
|
34461
34461
|
}
|
|
34462
34462
|
else {
|
|
34463
34463
|
// if the next token is not on the same line as yield. or we don't have an '*' or
|
|
@@ -34465,7 +34465,7 @@ var ts;
|
|
|
34465
34465
|
return finishNode(factory.createYieldExpression(/*asteriskToken*/ undefined, /*expression*/ undefined), pos);
|
|
34466
34466
|
}
|
|
34467
34467
|
}
|
|
34468
|
-
function parseSimpleArrowFunctionExpression(pos, identifier,
|
|
34468
|
+
function parseSimpleArrowFunctionExpression(pos, identifier, asyncModifier) {
|
|
34469
34469
|
ts.Debug.assert(token() === 38 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
|
|
34470
34470
|
var parameter = factory.createParameterDeclaration(
|
|
34471
34471
|
/*decorators*/ undefined,
|
|
@@ -34477,11 +34477,11 @@ var ts;
|
|
|
34477
34477
|
finishNode(parameter, identifier.pos);
|
|
34478
34478
|
var parameters = createNodeArray([parameter], parameter.pos, parameter.end);
|
|
34479
34479
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34480
|
-
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier
|
|
34480
|
+
var body = parseArrowFunctionExpressionBody(/*isAsync*/ !!asyncModifier);
|
|
34481
34481
|
var node = factory.createArrowFunction(asyncModifier, /*typeParameters*/ undefined, parameters, /*type*/ undefined, equalsGreaterThanToken, body);
|
|
34482
34482
|
return addJSDocComment(finishNode(node, pos));
|
|
34483
34483
|
}
|
|
34484
|
-
function tryParseParenthesizedArrowFunctionExpression(
|
|
34484
|
+
function tryParseParenthesizedArrowFunctionExpression() {
|
|
34485
34485
|
var triState = isParenthesizedArrowFunctionExpression();
|
|
34486
34486
|
if (triState === 0 /* False */) {
|
|
34487
34487
|
// It's definitely not a parenthesized arrow function expression.
|
|
@@ -34492,8 +34492,8 @@ var ts;
|
|
|
34492
34492
|
// it out, but don't allow any ambiguity, and return 'undefined' if this could be an
|
|
34493
34493
|
// expression instead.
|
|
34494
34494
|
return triState === 1 /* True */ ?
|
|
34495
|
-
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true
|
|
34496
|
-
tryParse(
|
|
34495
|
+
parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ true) :
|
|
34496
|
+
tryParse(parsePossibleParenthesizedArrowFunctionExpression);
|
|
34497
34497
|
}
|
|
34498
34498
|
// True -> We definitely expect a parenthesized arrow function here.
|
|
34499
34499
|
// False -> There *cannot* be a parenthesized arrow function here.
|
|
@@ -34623,25 +34623,25 @@ var ts;
|
|
|
34623
34623
|
return 2 /* Unknown */;
|
|
34624
34624
|
}
|
|
34625
34625
|
}
|
|
34626
|
-
function parsePossibleParenthesizedArrowFunctionExpression(
|
|
34626
|
+
function parsePossibleParenthesizedArrowFunctionExpression() {
|
|
34627
34627
|
var tokenPos = scanner.getTokenPos();
|
|
34628
34628
|
if (notParenthesizedArrow === null || notParenthesizedArrow === void 0 ? void 0 : notParenthesizedArrow.has(tokenPos)) {
|
|
34629
34629
|
return undefined;
|
|
34630
34630
|
}
|
|
34631
|
-
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false
|
|
34631
|
+
var result = parseParenthesizedArrowFunctionExpression(/*allowAmbiguity*/ false);
|
|
34632
34632
|
if (!result) {
|
|
34633
34633
|
(notParenthesizedArrow || (notParenthesizedArrow = new ts.Set())).add(tokenPos);
|
|
34634
34634
|
}
|
|
34635
34635
|
return result;
|
|
34636
34636
|
}
|
|
34637
|
-
function tryParseAsyncSimpleArrowFunctionExpression(
|
|
34637
|
+
function tryParseAsyncSimpleArrowFunctionExpression() {
|
|
34638
34638
|
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
|
|
34639
34639
|
if (token() === 131 /* AsyncKeyword */) {
|
|
34640
34640
|
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
|
|
34641
34641
|
var pos = getNodePos();
|
|
34642
34642
|
var asyncModifier = parseModifiersForArrowFunction();
|
|
34643
34643
|
var expr = parseBinaryExpressionOrHigher(0 /* Lowest */);
|
|
34644
|
-
return parseSimpleArrowFunctionExpression(pos, expr,
|
|
34644
|
+
return parseSimpleArrowFunctionExpression(pos, expr, asyncModifier);
|
|
34645
34645
|
}
|
|
34646
34646
|
}
|
|
34647
34647
|
return undefined;
|
|
@@ -34665,7 +34665,7 @@ var ts;
|
|
|
34665
34665
|
}
|
|
34666
34666
|
return 0 /* False */;
|
|
34667
34667
|
}
|
|
34668
|
-
function parseParenthesizedArrowFunctionExpression(allowAmbiguity
|
|
34668
|
+
function parseParenthesizedArrowFunctionExpression(allowAmbiguity) {
|
|
34669
34669
|
var pos = getNodePos();
|
|
34670
34670
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
34671
34671
|
var modifiers = parseModifiersForArrowFunction();
|
|
@@ -34700,23 +34700,6 @@ var ts;
|
|
|
34700
34700
|
return undefined;
|
|
34701
34701
|
}
|
|
34702
34702
|
}
|
|
34703
|
-
// Given:
|
|
34704
|
-
// x ? y => ({ y }) : z => ({ z })
|
|
34705
|
-
// We try to parse the body of the first arrow function by looking at:
|
|
34706
|
-
// ({ y }) : z => ({ z })
|
|
34707
|
-
// This is a valid arrow function with "z" as the return type.
|
|
34708
|
-
//
|
|
34709
|
-
// But, if we're in the true side of a conditional expression, this colon
|
|
34710
|
-
// terminates the expression, so we cannot allow a return type if we aren't
|
|
34711
|
-
// certain whether or not the preceding text was parsed as a parameter list.
|
|
34712
|
-
//
|
|
34713
|
-
// For example,
|
|
34714
|
-
// a() ? (b: number, c?: string): void => d() : e
|
|
34715
|
-
// is determined by isParenthesizedArrowFunctionExpression to unambiguously
|
|
34716
|
-
// be an arrow expression, so we allow a return type.
|
|
34717
|
-
if (disallowReturnTypeInArrowFunction && token() === 58 /* ColonToken */) {
|
|
34718
|
-
return undefined;
|
|
34719
|
-
}
|
|
34720
34703
|
var type = parseReturnType(58 /* ColonToken */, /*isType*/ false);
|
|
34721
34704
|
if (type && !allowAmbiguity && typeHasArrowFunctionBlockingParseError(type)) {
|
|
34722
34705
|
return undefined;
|
|
@@ -34745,12 +34728,12 @@ var ts;
|
|
|
34745
34728
|
var lastToken = token();
|
|
34746
34729
|
var equalsGreaterThanToken = parseExpectedToken(38 /* EqualsGreaterThanToken */);
|
|
34747
34730
|
var body = (lastToken === 38 /* EqualsGreaterThanToken */ || lastToken === 18 /* OpenBraceToken */)
|
|
34748
|
-
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier)
|
|
34731
|
+
? parseArrowFunctionExpressionBody(ts.some(modifiers, ts.isAsyncModifier))
|
|
34749
34732
|
: parseIdentifier();
|
|
34750
34733
|
var node = factory.createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body);
|
|
34751
34734
|
return withJSDoc(finishNode(node, pos), hasJSDoc);
|
|
34752
34735
|
}
|
|
34753
|
-
function parseArrowFunctionExpressionBody(isAsync
|
|
34736
|
+
function parseArrowFunctionExpressionBody(isAsync) {
|
|
34754
34737
|
if (token() === 18 /* OpenBraceToken */) {
|
|
34755
34738
|
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
|
|
34756
34739
|
}
|
|
@@ -34778,8 +34761,8 @@ var ts;
|
|
|
34778
34761
|
var savedTopLevel = topLevel;
|
|
34779
34762
|
topLevel = false;
|
|
34780
34763
|
var node = isAsync
|
|
34781
|
-
? doInAwaitContext(
|
|
34782
|
-
: doOutsideOfAwaitContext(
|
|
34764
|
+
? doInAwaitContext(parseAssignmentExpressionOrHigher)
|
|
34765
|
+
: doOutsideOfAwaitContext(parseAssignmentExpressionOrHigher);
|
|
34783
34766
|
topLevel = savedTopLevel;
|
|
34784
34767
|
return node;
|
|
34785
34768
|
}
|
|
@@ -34792,8 +34775,8 @@ var ts;
|
|
|
34792
34775
|
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
|
|
34793
34776
|
// we do not that for the 'whenFalse' part.
|
|
34794
34777
|
var colonToken;
|
|
34795
|
-
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext,
|
|
34796
|
-
? parseAssignmentExpressionOrHigher(
|
|
34778
|
+
return finishNode(factory.createConditionalExpression(leftOperand, questionToken, doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher), colonToken = parseExpectedToken(58 /* ColonToken */), ts.nodeIsPresent(colonToken)
|
|
34779
|
+
? parseAssignmentExpressionOrHigher()
|
|
34797
34780
|
: createMissingNode(79 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(58 /* ColonToken */))), pos);
|
|
34798
34781
|
}
|
|
34799
34782
|
function parseBinaryExpressionOrHigher(precedence) {
|
|
@@ -35685,13 +35668,13 @@ var ts;
|
|
|
35685
35668
|
function parseSpreadElement() {
|
|
35686
35669
|
var pos = getNodePos();
|
|
35687
35670
|
parseExpected(25 /* DotDotDotToken */);
|
|
35688
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35671
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35689
35672
|
return finishNode(factory.createSpreadElement(expression), pos);
|
|
35690
35673
|
}
|
|
35691
35674
|
function parseArgumentOrArrayLiteralElement() {
|
|
35692
35675
|
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
|
|
35693
35676
|
token() === 27 /* CommaToken */ ? finishNode(factory.createOmittedExpression(), getNodePos()) :
|
|
35694
|
-
parseAssignmentExpressionOrHigher(
|
|
35677
|
+
parseAssignmentExpressionOrHigher();
|
|
35695
35678
|
}
|
|
35696
35679
|
function parseArgumentExpression() {
|
|
35697
35680
|
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
|
|
@@ -35709,7 +35692,7 @@ var ts;
|
|
|
35709
35692
|
var pos = getNodePos();
|
|
35710
35693
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
35711
35694
|
if (parseOptionalToken(25 /* DotDotDotToken */)) {
|
|
35712
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
35695
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
35713
35696
|
return withJSDoc(finishNode(factory.createSpreadAssignment(expression), pos), hasJSDoc);
|
|
35714
35697
|
}
|
|
35715
35698
|
var decorators = parseDecorators();
|
|
@@ -35738,7 +35721,7 @@ var ts;
|
|
|
35738
35721
|
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 58 /* ColonToken */);
|
|
35739
35722
|
if (isShorthandPropertyAssignment) {
|
|
35740
35723
|
var equalsToken = parseOptionalToken(63 /* EqualsToken */);
|
|
35741
|
-
var objectAssignmentInitializer = equalsToken ? allowInAnd(
|
|
35724
|
+
var objectAssignmentInitializer = equalsToken ? allowInAnd(parseAssignmentExpressionOrHigher) : undefined;
|
|
35742
35725
|
node = factory.createShorthandPropertyAssignment(name, objectAssignmentInitializer);
|
|
35743
35726
|
// Save equals token for error reporting.
|
|
35744
35727
|
// TODO(rbuckton): Consider manufacturing this when we need to report an error as it is otherwise not useful.
|
|
@@ -35746,7 +35729,7 @@ var ts;
|
|
|
35746
35729
|
}
|
|
35747
35730
|
else {
|
|
35748
35731
|
parseExpected(58 /* ColonToken */);
|
|
35749
|
-
var initializer = allowInAnd(
|
|
35732
|
+
var initializer = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35750
35733
|
node = factory.createPropertyAssignment(name, initializer);
|
|
35751
35734
|
}
|
|
35752
35735
|
// Decorators, Modifiers, questionToken, and exclamationToken are not supported by property assignments and are reported in the grammar checker
|
|
@@ -35920,7 +35903,7 @@ var ts;
|
|
|
35920
35903
|
}
|
|
35921
35904
|
var node;
|
|
35922
35905
|
if (awaitToken ? parseExpected(160 /* OfKeyword */) : parseOptional(160 /* OfKeyword */)) {
|
|
35923
|
-
var expression = allowInAnd(
|
|
35906
|
+
var expression = allowInAnd(parseAssignmentExpressionOrHigher);
|
|
35924
35907
|
parseExpected(21 /* CloseParenToken */);
|
|
35925
35908
|
node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement());
|
|
35926
35909
|
}
|
|
@@ -37088,7 +37071,7 @@ var ts;
|
|
|
37088
37071
|
var pos = getNodePos();
|
|
37089
37072
|
var name = ts.tokenIsIdentifierOrKeyword(token()) ? parseIdentifierName() : parseLiteralLikeNode(10 /* StringLiteral */);
|
|
37090
37073
|
parseExpected(58 /* ColonToken */);
|
|
37091
|
-
var value = parseAssignmentExpressionOrHigher(
|
|
37074
|
+
var value = parseAssignmentExpressionOrHigher();
|
|
37092
37075
|
return finishNode(factory.createAssertEntry(name, value), pos);
|
|
37093
37076
|
}
|
|
37094
37077
|
function parseAssertClause(skipAssertKeyword) {
|
|
@@ -37148,7 +37131,7 @@ var ts;
|
|
|
37148
37131
|
function parseModuleReference() {
|
|
37149
37132
|
return isExternalModuleReference()
|
|
37150
37133
|
? parseExternalModuleReference()
|
|
37151
|
-
: parseEntityName(/*allowReservedWords*/ false
|
|
37134
|
+
: parseEntityName(/*allowReservedWords*/ false);
|
|
37152
37135
|
}
|
|
37153
37136
|
function parseExternalModuleReference() {
|
|
37154
37137
|
var pos = getNodePos();
|
|
@@ -37327,7 +37310,7 @@ var ts;
|
|
|
37327
37310
|
else {
|
|
37328
37311
|
parseExpected(88 /* DefaultKeyword */);
|
|
37329
37312
|
}
|
|
37330
|
-
var expression = parseAssignmentExpressionOrHigher(
|
|
37313
|
+
var expression = parseAssignmentExpressionOrHigher();
|
|
37331
37314
|
parseSemicolon();
|
|
37332
37315
|
setAwaitContext(savedAwaitContext);
|
|
37333
37316
|
var node = factory.createExportAssignment(decorators, modifiers, isExportEquals, expression);
|
|
@@ -37401,7 +37384,7 @@ var ts;
|
|
|
37401
37384
|
var pos = getNodePos();
|
|
37402
37385
|
var hasBrace = parseOptional(18 /* OpenBraceToken */);
|
|
37403
37386
|
var p2 = getNodePos();
|
|
37404
|
-
var entityName = parseEntityName(/* allowReservedWords*/ false
|
|
37387
|
+
var entityName = parseEntityName(/* allowReservedWords*/ false);
|
|
37405
37388
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
37406
37389
|
reScanHashToken(); // rescan #id as # id
|
|
37407
37390
|
nextTokenJSDoc(); // then skip the #
|
|
@@ -37844,7 +37827,7 @@ var ts;
|
|
|
37844
37827
|
// parseEntityName logs an error for non-identifier, so create a MissingNode ourselves to avoid the error
|
|
37845
37828
|
var p2 = getNodePos();
|
|
37846
37829
|
var name = ts.tokenIsIdentifierOrKeyword(token())
|
|
37847
|
-
? parseEntityName(/*allowReservedWords*/ true
|
|
37830
|
+
? parseEntityName(/*allowReservedWords*/ true)
|
|
37848
37831
|
: undefined;
|
|
37849
37832
|
if (name) {
|
|
37850
37833
|
while (token() === 80 /* PrivateIdentifier */) {
|
|
@@ -39501,7 +39484,7 @@ var ts;
|
|
|
39501
39484
|
es2020: ts.ModuleKind.ES2020,
|
|
39502
39485
|
es2022: ts.ModuleKind.ES2022,
|
|
39503
39486
|
esnext: ts.ModuleKind.ESNext,
|
|
39504
|
-
|
|
39487
|
+
node16: ts.ModuleKind.Node16,
|
|
39505
39488
|
nodenext: ts.ModuleKind.NodeNext,
|
|
39506
39489
|
})),
|
|
39507
39490
|
affectsModuleResolution: true,
|
|
@@ -39855,7 +39838,7 @@ var ts;
|
|
|
39855
39838
|
type: new ts.Map(ts.getEntries({
|
|
39856
39839
|
node: ts.ModuleResolutionKind.NodeJs,
|
|
39857
39840
|
classic: ts.ModuleResolutionKind.Classic,
|
|
39858
|
-
|
|
39841
|
+
node16: ts.ModuleResolutionKind.Node16,
|
|
39859
39842
|
nodenext: ts.ModuleResolutionKind.NodeNext,
|
|
39860
39843
|
})),
|
|
39861
39844
|
affectsModuleResolution: true,
|
|
@@ -40331,7 +40314,7 @@ var ts;
|
|
|
40331
40314
|
affectsModuleResolution: true,
|
|
40332
40315
|
description: ts.Diagnostics.Control_what_method_is_used_to_detect_module_format_JS_files,
|
|
40333
40316
|
category: ts.Diagnostics.Language_and_Environment,
|
|
40334
|
-
defaultValueDescription: ts.Diagnostics.
|
|
40317
|
+
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
40318
|
}
|
|
40336
40319
|
];
|
|
40337
40320
|
/* @internal */
|
|
@@ -42567,9 +42550,9 @@ var ts;
|
|
|
42567
42550
|
// 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
42551
|
// 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
42552
|
// 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 (`
|
|
42553
|
+
// resolution" should be (`node16`? `nodenext`?). As such, witnessing a mode-overriding triple-slash reference in a non-modal module resolution
|
|
42571
42554
|
// 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.
|
|
42555
|
+
if (resolutionMode === ts.ModuleKind.ESNext && (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext)) {
|
|
42573
42556
|
features |= NodeResolutionFeatures.EsmMode;
|
|
42574
42557
|
}
|
|
42575
42558
|
var conditions = features & NodeResolutionFeatures.Exports ? features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"] : [];
|
|
@@ -42658,7 +42641,7 @@ var ts;
|
|
|
42658
42641
|
}
|
|
42659
42642
|
ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective;
|
|
42660
42643
|
function getDefaultNodeResolutionFeatures(options) {
|
|
42661
|
-
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
42644
|
+
return ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 ? NodeResolutionFeatures.Node16Default :
|
|
42662
42645
|
ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext ? NodeResolutionFeatures.NodeNextDefault :
|
|
42663
42646
|
NodeResolutionFeatures.None;
|
|
42664
42647
|
}
|
|
@@ -43016,8 +42999,8 @@ var ts;
|
|
|
43016
42999
|
case ts.ModuleKind.CommonJS:
|
|
43017
43000
|
moduleResolution = ts.ModuleResolutionKind.NodeJs;
|
|
43018
43001
|
break;
|
|
43019
|
-
case ts.ModuleKind.
|
|
43020
|
-
moduleResolution = ts.ModuleResolutionKind.
|
|
43002
|
+
case ts.ModuleKind.Node16:
|
|
43003
|
+
moduleResolution = ts.ModuleResolutionKind.Node16;
|
|
43021
43004
|
break;
|
|
43022
43005
|
case ts.ModuleKind.NodeNext:
|
|
43023
43006
|
moduleResolution = ts.ModuleResolutionKind.NodeNext;
|
|
@@ -43037,8 +43020,8 @@ var ts;
|
|
|
43037
43020
|
}
|
|
43038
43021
|
ts.perfLogger.logStartResolveModule(moduleName /* , containingFile, ModuleResolutionKind[moduleResolution]*/);
|
|
43039
43022
|
switch (moduleResolution) {
|
|
43040
|
-
case ts.ModuleResolutionKind.
|
|
43041
|
-
result =
|
|
43023
|
+
case ts.ModuleResolutionKind.Node16:
|
|
43024
|
+
result = node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43042
43025
|
break;
|
|
43043
43026
|
case ts.ModuleResolutionKind.NodeNext:
|
|
43044
43027
|
result = nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43272,15 +43255,15 @@ var ts;
|
|
|
43272
43255
|
// respecting the `.exports` member of packages' package.json files and its (conditional) mappings of export names
|
|
43273
43256
|
NodeResolutionFeatures[NodeResolutionFeatures["Exports"] = 8] = "Exports";
|
|
43274
43257
|
// allowing `*` in the LHS of an export to be followed by more content, eg `"./whatever/*.js"`
|
|
43275
|
-
// not
|
|
43258
|
+
// not supported in node 12 - https://github.com/nodejs/Release/issues/690
|
|
43276
43259
|
NodeResolutionFeatures[NodeResolutionFeatures["ExportsPatternTrailers"] = 16] = "ExportsPatternTrailers";
|
|
43277
43260
|
NodeResolutionFeatures[NodeResolutionFeatures["AllFeatures"] = 30] = "AllFeatures";
|
|
43278
|
-
NodeResolutionFeatures[NodeResolutionFeatures["
|
|
43261
|
+
NodeResolutionFeatures[NodeResolutionFeatures["Node16Default"] = 30] = "Node16Default";
|
|
43279
43262
|
NodeResolutionFeatures[NodeResolutionFeatures["NodeNextDefault"] = 30] = "NodeNextDefault";
|
|
43280
43263
|
NodeResolutionFeatures[NodeResolutionFeatures["EsmMode"] = 32] = "EsmMode";
|
|
43281
43264
|
})(NodeResolutionFeatures || (NodeResolutionFeatures = {}));
|
|
43282
|
-
function
|
|
43283
|
-
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.
|
|
43265
|
+
function node16ModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43266
|
+
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.Node16Default, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
43284
43267
|
}
|
|
43285
43268
|
function nodeNextModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode) {
|
|
43286
43269
|
return nodeNextModuleNameResolverWorker(NodeResolutionFeatures.NodeNextDefault, moduleName, containingFile, compilerOptions, host, cache, redirectedReference, resolutionMode);
|
|
@@ -43320,7 +43303,7 @@ var ts;
|
|
|
43320
43303
|
var _a, _b;
|
|
43321
43304
|
var traceEnabled = isTraceEnabled(compilerOptions, host);
|
|
43322
43305
|
var failedLookupLocations = [];
|
|
43323
|
-
// conditions are only used by the
|
|
43306
|
+
// conditions are only used by the node16/nodenext resolver - there's no priority order in the list,
|
|
43324
43307
|
//it's essentially a set (priority is determined by object insertion order in the object we look at).
|
|
43325
43308
|
var conditions = features & NodeResolutionFeatures.EsmMode ? ["node", "import", "types"] : ["node", "require", "types"];
|
|
43326
43309
|
if (compilerOptions.noDtsResolution) {
|
|
@@ -48707,7 +48690,7 @@ var ts;
|
|
|
48707
48690
|
var enumRelation = new ts.Map();
|
|
48708
48691
|
var builtinGlobals = ts.createSymbolTable();
|
|
48709
48692
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
48710
|
-
// Extensions suggested for path imports when module resolution is
|
|
48693
|
+
// Extensions suggested for path imports when module resolution is node16 or higher.
|
|
48711
48694
|
// The first element of each tuple is the extension a file has.
|
|
48712
48695
|
// The second element of each tuple is the extension that should be used in a path import.
|
|
48713
48696
|
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
@@ -50996,7 +50979,7 @@ var ts;
|
|
|
50996
50979
|
if (resolvedModule.isExternalLibraryImport && !ts.resolutionExtensionIsTSOrJson(resolvedModule.extension)) {
|
|
50997
50980
|
errorOnImplicitAnyModule(/*isError*/ false, errorNode, resolvedModule, moduleReference);
|
|
50998
50981
|
}
|
|
50999
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
50982
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
51000
50983
|
var isSyncImport = (currentSourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS && !ts.findAncestor(location, ts.isImportCall)) || !!ts.findAncestor(location, ts.isImportEqualsDeclaration);
|
|
51001
50984
|
var overrideClauseHost = ts.findAncestor(location, function (l) { return ts.isImportTypeNode(l) || ts.isExportDeclaration(l) || ts.isImportDeclaration(l); });
|
|
51002
50985
|
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 +50988,6 @@ var ts;
|
|
|
51005
50988
|
if (isSyncImport && sourceFile.impliedNodeFormat === ts.ModuleKind.ESNext && !ts.getResolutionModeOverrideForClause(overrideClause)) {
|
|
51006
50989
|
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
50990
|
}
|
|
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
50991
|
}
|
|
51012
50992
|
// merged symbol is module declaration symbol combined with all augmentations
|
|
51013
50993
|
return getMergedSymbol(sourceFile.symbol);
|
|
@@ -51060,7 +51040,7 @@ var ts;
|
|
|
51060
51040
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
51061
51041
|
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
51062
51042
|
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
51063
|
-
var
|
|
51043
|
+
var resolutionIsNode16OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node16 ||
|
|
51064
51044
|
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
51065
51045
|
if (tsExtension) {
|
|
51066
51046
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
@@ -51081,17 +51061,17 @@ var ts;
|
|
|
51081
51061
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
51082
51062
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
51083
51063
|
}
|
|
51084
|
-
else if (mode === ts.ModuleKind.ESNext &&
|
|
51064
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode16OrNext && isExtensionlessRelativePathImport) {
|
|
51085
51065
|
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
51086
51066
|
var suggestedExt = (_h = suggestedExtensions.find(function (_a) {
|
|
51087
51067
|
var actualExt = _a[0], _importExt = _a[1];
|
|
51088
51068
|
return host.fileExists(absoluteRef_1 + actualExt);
|
|
51089
51069
|
})) === null || _h === void 0 ? void 0 : _h[1];
|
|
51090
51070
|
if (suggestedExt) {
|
|
51091
|
-
error(errorNode, ts.Diagnostics.
|
|
51071
|
+
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
51072
|
}
|
|
51093
51073
|
else {
|
|
51094
|
-
error(errorNode, ts.Diagnostics.
|
|
51074
|
+
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
51075
|
}
|
|
51096
51076
|
}
|
|
51097
51077
|
else {
|
|
@@ -53413,7 +53393,7 @@ var ts;
|
|
|
53413
53393
|
var targetFile = ts.getSourceFileOfModule(chain[0]);
|
|
53414
53394
|
var specifier = void 0;
|
|
53415
53395
|
var assertion = void 0;
|
|
53416
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53396
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53417
53397
|
// An `import` type directed at an esm format file is only going to resolve in esm mode - set the esm mode assertion
|
|
53418
53398
|
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
53399
|
specifier = getSpecifierForModuleSymbol(chain[0], context, ts.ModuleKind.ESNext);
|
|
@@ -53427,7 +53407,7 @@ var ts;
|
|
|
53427
53407
|
}
|
|
53428
53408
|
if (!(context.flags & 67108864 /* AllowNodeModulesRelativePaths */) && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Classic && specifier.indexOf("/node_modules/") >= 0) {
|
|
53429
53409
|
var oldSpecifier = specifier;
|
|
53430
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
53410
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext) {
|
|
53431
53411
|
// 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
53412
|
var swappedMode = (contextFile === null || contextFile === void 0 ? void 0 : contextFile.impliedNodeFormat) === ts.ModuleKind.ESNext ? ts.ModuleKind.CommonJS : ts.ModuleKind.ESNext;
|
|
53433
53413
|
specifier = getSpecifierForModuleSymbol(chain[0], context, swappedMode);
|
|
@@ -64904,7 +64884,6 @@ var ts;
|
|
|
64904
64884
|
return 0 /* False */;
|
|
64905
64885
|
}
|
|
64906
64886
|
function reportErrorResults(originalSource, originalTarget, source, target, headMessage) {
|
|
64907
|
-
var _a, _b;
|
|
64908
64887
|
var sourceHasBase = !!getSingleBaseForNonAugmentingSubtype(originalSource);
|
|
64909
64888
|
var targetHasBase = !!getSingleBaseForNonAugmentingSubtype(originalTarget);
|
|
64910
64889
|
source = (originalSource.aliasSymbol || sourceHasBase) ? originalSource : source;
|
|
@@ -64945,9 +64924,6 @@ var ts;
|
|
|
64945
64924
|
return;
|
|
64946
64925
|
}
|
|
64947
64926
|
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
64927
|
}
|
|
64952
64928
|
function traceUnionsOrIntersectionsTooLarge(source, target) {
|
|
64953
64929
|
if (!ts.tracing) {
|
|
@@ -65720,7 +65696,7 @@ var ts;
|
|
|
65720
65696
|
// IndexedAccess comparisons are handled above in the `targetFlags & TypeFlage.IndexedAccess` branch
|
|
65721
65697
|
if (!(sourceFlags & 8388608 /* IndexedAccess */ && targetFlags & 8388608 /* IndexedAccess */)) {
|
|
65722
65698
|
var constraint = getConstraintOfType(source);
|
|
65723
|
-
if (!
|
|
65699
|
+
if (!constraint || (sourceFlags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
|
|
65724
65700
|
// A type variable with no constraint is not related to the non-primitive object type.
|
|
65725
65701
|
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864 /* NonPrimitive */), 3 /* Both */)) {
|
|
65726
65702
|
resetErrorInfo(saveErrorInfo);
|
|
@@ -65728,12 +65704,12 @@ var ts;
|
|
|
65728
65704
|
}
|
|
65729
65705
|
}
|
|
65730
65706
|
// 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 (
|
|
65707
|
+
else if (result = isRelatedTo(constraint, target, 1 /* Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState)) {
|
|
65732
65708
|
resetErrorInfo(saveErrorInfo);
|
|
65733
65709
|
return result;
|
|
65734
65710
|
}
|
|
65735
65711
|
// slower, fuller, this-instantiated check (necessary when comparing raw `this` types from base classes), see `subclassWithPolymorphicThisIsAssignable.ts` test for example
|
|
65736
|
-
else if (
|
|
65712
|
+
else if (result = isRelatedTo(getTypeWithThisArgument(constraint, source), target, 1 /* Source */, reportErrors && !(targetFlags & sourceFlags & 262144 /* TypeParameter */), /*headMessage*/ undefined, intersectionState)) {
|
|
65737
65713
|
resetErrorInfo(saveErrorInfo);
|
|
65738
65714
|
return result;
|
|
65739
65715
|
}
|
|
@@ -71396,7 +71372,7 @@ var ts;
|
|
|
71396
71372
|
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
71397
71373
|
var parent = declaration.parent.parent;
|
|
71398
71374
|
if (parent.kind === 254 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 164 /* Parameter */) {
|
|
71399
|
-
var links = getNodeLinks(
|
|
71375
|
+
var links = getNodeLinks(parent);
|
|
71400
71376
|
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
71401
71377
|
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
71402
71378
|
var parentType = getTypeForBindingElementParent(parent, 0 /* Normal */);
|
|
@@ -77259,13 +77235,13 @@ var ts;
|
|
|
77259
77235
|
}
|
|
77260
77236
|
}
|
|
77261
77237
|
function checkImportMetaProperty(node) {
|
|
77262
|
-
if (moduleKind === ts.ModuleKind.
|
|
77238
|
+
if (moduleKind === ts.ModuleKind.Node16 || moduleKind === ts.ModuleKind.NodeNext) {
|
|
77263
77239
|
if (ts.getSourceFileOfNode(node).impliedNodeFormat !== ts.ModuleKind.ESNext) {
|
|
77264
77240
|
error(node, ts.Diagnostics.The_import_meta_meta_property_is_not_allowed_in_files_which_will_build_into_CommonJS_output);
|
|
77265
77241
|
}
|
|
77266
77242
|
}
|
|
77267
77243
|
else if (moduleKind < ts.ModuleKind.ES2020 && moduleKind !== ts.ModuleKind.System) {
|
|
77268
|
-
error(node, ts.Diagnostics.
|
|
77244
|
+
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
77245
|
}
|
|
77270
77246
|
var file = ts.getSourceFileOfNode(node);
|
|
77271
77247
|
ts.Debug.assert(!!(file.flags & 4194304 /* PossiblyContainsImportMeta */), "Containing file is missing import meta node flag.");
|
|
@@ -78216,15 +78192,30 @@ var ts;
|
|
|
78216
78192
|
if (!hasParseDiagnostics(sourceFile)) {
|
|
78217
78193
|
var span = void 0;
|
|
78218
78194
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
78219
|
-
|
|
78220
|
-
span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
|
|
78195
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78221
78196
|
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
78197
|
diagnostics.add(diagnostic);
|
|
78223
78198
|
}
|
|
78224
|
-
|
|
78225
|
-
|
|
78226
|
-
|
|
78227
|
-
|
|
78199
|
+
switch (moduleKind) {
|
|
78200
|
+
case ts.ModuleKind.Node16:
|
|
78201
|
+
case ts.ModuleKind.NodeNext:
|
|
78202
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
78203
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78204
|
+
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));
|
|
78205
|
+
break;
|
|
78206
|
+
}
|
|
78207
|
+
// fallthrough
|
|
78208
|
+
case ts.ModuleKind.ES2022:
|
|
78209
|
+
case ts.ModuleKind.ESNext:
|
|
78210
|
+
case ts.ModuleKind.System:
|
|
78211
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
78212
|
+
break;
|
|
78213
|
+
}
|
|
78214
|
+
// fallthrough
|
|
78215
|
+
default:
|
|
78216
|
+
span !== null && span !== void 0 ? span : (span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
78217
|
+
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));
|
|
78218
|
+
break;
|
|
78228
78219
|
}
|
|
78229
78220
|
}
|
|
78230
78221
|
}
|
|
@@ -80666,8 +80657,8 @@ var ts;
|
|
|
80666
80657
|
if (node.assertions) {
|
|
80667
80658
|
var override = ts.getResolutionModeOverrideForClause(node.assertions.assertClause, grammarErrorOnNode);
|
|
80668
80659
|
if (override) {
|
|
80669
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
80670
|
-
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.
|
|
80660
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
80661
|
+
grammarErrorOnNode(node.assertions.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
80671
80662
|
}
|
|
80672
80663
|
}
|
|
80673
80664
|
}
|
|
@@ -82117,7 +82108,7 @@ var ts;
|
|
|
82117
82108
|
}
|
|
82118
82109
|
function checkCollisionWithRequireExportsInGeneratedCode(node, name) {
|
|
82119
82110
|
// No need to check for require or exports for ES6 modules and later
|
|
82120
|
-
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.
|
|
82111
|
+
if (moduleKind >= ts.ModuleKind.ES2015 && !(moduleKind >= ts.ModuleKind.Node16 && ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) {
|
|
82121
82112
|
return;
|
|
82122
82113
|
}
|
|
82123
82114
|
if (!name || !needCollisionCheckForIdentifier(node, name, "require") && !needCollisionCheckForIdentifier(node, name, "exports")) {
|
|
@@ -85037,8 +85028,8 @@ var ts;
|
|
|
85037
85028
|
var validForTypeAssertions = ts.isExclusivelyTypeOnlyImportOrExport(declaration);
|
|
85038
85029
|
var override = ts.getResolutionModeOverrideForClause(declaration.assertClause, validForTypeAssertions ? grammarErrorOnNode : undefined);
|
|
85039
85030
|
if (validForTypeAssertions && override) {
|
|
85040
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
85041
|
-
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.
|
|
85031
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
85032
|
+
return grammarErrorOnNode(declaration.assertClause, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext);
|
|
85042
85033
|
}
|
|
85043
85034
|
return; // Other grammar checks do not apply to type-only imports with resolution mode assertions
|
|
85044
85035
|
}
|
|
@@ -88225,8 +88216,24 @@ var ts;
|
|
|
88225
88216
|
if (!ts.isEffectiveExternalModule(sourceFile, compilerOptions)) {
|
|
88226
88217
|
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
88218
|
}
|
|
88228
|
-
|
|
88229
|
-
|
|
88219
|
+
switch (moduleKind) {
|
|
88220
|
+
case ts.ModuleKind.Node16:
|
|
88221
|
+
case ts.ModuleKind.NodeNext:
|
|
88222
|
+
if (sourceFile.impliedNodeFormat === ts.ModuleKind.CommonJS) {
|
|
88223
|
+
diagnostics.add(ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level));
|
|
88224
|
+
break;
|
|
88225
|
+
}
|
|
88226
|
+
// fallthrough
|
|
88227
|
+
case ts.ModuleKind.ES2022:
|
|
88228
|
+
case ts.ModuleKind.ESNext:
|
|
88229
|
+
case ts.ModuleKind.System:
|
|
88230
|
+
if (languageVersion >= 4 /* ES2017 */) {
|
|
88231
|
+
break;
|
|
88232
|
+
}
|
|
88233
|
+
// fallthrough
|
|
88234
|
+
default:
|
|
88235
|
+
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));
|
|
88236
|
+
break;
|
|
88230
88237
|
}
|
|
88231
88238
|
}
|
|
88232
88239
|
}
|
|
@@ -88921,7 +88928,7 @@ var ts;
|
|
|
88921
88928
|
}
|
|
88922
88929
|
function checkGrammarImportCallExpression(node) {
|
|
88923
88930
|
if (moduleKind === ts.ModuleKind.ES2015) {
|
|
88924
|
-
return grammarErrorOnNode(node, ts.Diagnostics.
|
|
88931
|
+
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
88932
|
}
|
|
88926
88933
|
if (node.typeArguments) {
|
|
88927
88934
|
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 +88939,7 @@ var ts;
|
|
|
88932
88939
|
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
|
88933
88940
|
if (nodeArguments.length > 1) {
|
|
88934
88941
|
var assertionArgument = nodeArguments[1];
|
|
88935
|
-
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.
|
|
88942
|
+
return grammarErrorOnNode(assertionArgument, ts.Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
|
88936
88943
|
}
|
|
88937
88944
|
}
|
|
88938
88945
|
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
|
|
@@ -109198,7 +109205,7 @@ var ts;
|
|
|
109198
109205
|
return ts.transformECMAScriptModule;
|
|
109199
109206
|
case ts.ModuleKind.System:
|
|
109200
109207
|
return ts.transformSystemModule;
|
|
109201
|
-
case ts.ModuleKind.
|
|
109208
|
+
case ts.ModuleKind.Node16:
|
|
109202
109209
|
case ts.ModuleKind.NodeNext:
|
|
109203
109210
|
return ts.transformNodeModule;
|
|
109204
109211
|
default:
|
|
@@ -116221,7 +116228,7 @@ var ts;
|
|
|
116221
116228
|
*/
|
|
116222
116229
|
function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, options) {
|
|
116223
116230
|
switch (ts.getEmitModuleResolutionKind(options)) {
|
|
116224
|
-
case ts.ModuleResolutionKind.
|
|
116231
|
+
case ts.ModuleResolutionKind.Node16:
|
|
116225
116232
|
case ts.ModuleResolutionKind.NodeNext:
|
|
116226
116233
|
return ts.fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? ts.ModuleKind.ESNext :
|
|
116227
116234
|
ts.fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? ts.ModuleKind.CommonJS :
|
|
@@ -116520,7 +116527,7 @@ var ts;
|
|
|
116520
116527
|
var containingFilename = ts.combinePaths(containingDirectory, ts.inferredTypesContainingFile);
|
|
116521
116528
|
var resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
|
|
116522
116529
|
for (var i = 0; i < typeReferences.length; i++) {
|
|
116523
|
-
// under
|
|
116530
|
+
// under node16/nodenext module resolution, load `types`/ata include names as cjs resolution results by passing an `undefined` mode
|
|
116524
116531
|
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
116532
|
}
|
|
116526
116533
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -118173,8 +118180,8 @@ var ts;
|
|
|
118173
118180
|
var fileName = ts.toFileNameLowerCase(ref.fileName);
|
|
118174
118181
|
ts.setResolvedTypeReferenceDirective(file, fileName, resolvedTypeReferenceDirective);
|
|
118175
118182
|
var mode = ref.resolutionMode || file.impliedNodeFormat;
|
|
118176
|
-
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118177
|
-
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.
|
|
118183
|
+
if (mode && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118184
|
+
programDiagnostics.add(ts.createDiagnosticForRange(file, ref, ts.Diagnostics.Resolution_modes_are_only_supported_when_moduleResolution_is_node16_or_nodenext));
|
|
118178
118185
|
}
|
|
118179
118186
|
processTypeReferenceDirective(fileName, mode, resolvedTypeReferenceDirective, { kind: ts.FileIncludeKind.TypeReferenceDirective, file: file.path, index: index, });
|
|
118180
118187
|
}
|
|
@@ -118536,7 +118543,7 @@ var ts;
|
|
|
118536
118543
|
}
|
|
118537
118544
|
if (options.resolveJsonModule) {
|
|
118538
118545
|
if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs &&
|
|
118539
|
-
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.
|
|
118546
|
+
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.Node16 &&
|
|
118540
118547
|
ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeNext) {
|
|
118541
118548
|
createDiagnosticForOptionName(ts.Diagnostics.Option_resolveJsonModule_cannot_be_specified_without_node_module_resolution_strategy, "resolveJsonModule");
|
|
118542
118549
|
}
|
|
@@ -121676,7 +121683,7 @@ var ts;
|
|
|
121676
121683
|
}
|
|
121677
121684
|
function isFormatRequiringExtensions(compilerOptions, importingSourceFileName, host) {
|
|
121678
121685
|
var _a;
|
|
121679
|
-
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.
|
|
121686
|
+
if (ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.Node16
|
|
121680
121687
|
&& ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeNext) {
|
|
121681
121688
|
return false;
|
|
121682
121689
|
}
|
|
@@ -122261,7 +122268,7 @@ var ts;
|
|
|
122261
122268
|
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
122269
|
if (typeof cachedPackageJson === "object" || cachedPackageJson === undefined && host.fileExists(packageJsonPath)) {
|
|
122263
122270
|
var packageJsonContent = (cachedPackageJson === null || cachedPackageJson === void 0 ? void 0 : cachedPackageJson.packageJsonContent) || JSON.parse(host.readFile(packageJsonPath));
|
|
122264
|
-
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.
|
|
122271
|
+
if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node16 || ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
122265
122272
|
// `conditions` *could* be made to go against `importingSourceFile.impliedNodeFormat` if something wanted to generate
|
|
122266
122273
|
// an ImportEqualsDeclaration in an ESM-implied file or an ImportCall in a CJS-implied file. But since this function is
|
|
122267
122274
|
// usually called to conjure an import out of thin air, we don't have an existing usage to call `getModeForUsageAtIndex`
|
|
@@ -127875,11 +127882,11 @@ var ts;
|
|
|
127875
127882
|
}
|
|
127876
127883
|
ts.getModuleSpecifierResolverHost = getModuleSpecifierResolverHost;
|
|
127877
127884
|
function moduleResolutionRespectsExports(moduleResolution) {
|
|
127878
|
-
return moduleResolution >= ts.ModuleResolutionKind.
|
|
127885
|
+
return moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127879
127886
|
}
|
|
127880
127887
|
ts.moduleResolutionRespectsExports = moduleResolutionRespectsExports;
|
|
127881
127888
|
function moduleResolutionUsesNodeModules(moduleResolution) {
|
|
127882
|
-
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.
|
|
127889
|
+
return moduleResolution === ts.ModuleResolutionKind.NodeJs || moduleResolution >= ts.ModuleResolutionKind.Node16 && moduleResolution <= ts.ModuleResolutionKind.NodeNext;
|
|
127883
127890
|
}
|
|
127884
127891
|
ts.moduleResolutionUsesNodeModules = moduleResolutionUsesNodeModules;
|
|
127885
127892
|
function makeImportIfNecessary(defaultImport, namedImports, moduleSpecifier, quotePreference) {
|
|
@@ -131203,11 +131210,11 @@ var ts;
|
|
|
131203
131210
|
}
|
|
131204
131211
|
function isEmitResolutionKindUsingNodeModules(compilerOptions) {
|
|
131205
131212
|
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs ||
|
|
131206
|
-
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131213
|
+
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131207
131214
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131208
131215
|
}
|
|
131209
131216
|
function isEmitModuleResolutionRespectingExportMaps(compilerOptions) {
|
|
131210
|
-
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.
|
|
131217
|
+
return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.Node16 ||
|
|
131211
131218
|
ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeNext;
|
|
131212
131219
|
}
|
|
131213
131220
|
function getSupportedExtensionsForModuleResolution(compilerOptions) {
|
|
@@ -131767,7 +131774,7 @@ var ts;
|
|
|
131767
131774
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeAssertionKeywords"] = 6] = "TypeAssertionKeywords";
|
|
131768
131775
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeywords"] = 7] = "TypeKeywords";
|
|
131769
131776
|
KeywordCompletionFilters[KeywordCompletionFilters["TypeKeyword"] = 8] = "TypeKeyword";
|
|
131770
|
-
KeywordCompletionFilters[KeywordCompletionFilters["Last"] =
|
|
131777
|
+
KeywordCompletionFilters[KeywordCompletionFilters["Last"] = 8] = "Last";
|
|
131771
131778
|
})(KeywordCompletionFilters || (KeywordCompletionFilters = {}));
|
|
131772
131779
|
var GlobalsSearch;
|
|
131773
131780
|
(function (GlobalsSearch) {
|
|
@@ -132017,7 +132024,7 @@ var ts;
|
|
|
132017
132024
|
var entryNames_1 = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
132018
132025
|
for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) {
|
|
132019
132026
|
var keywordEntry = _a[_i];
|
|
132020
|
-
if (!entryNames_1.has(keywordEntry.name)) {
|
|
132027
|
+
if (isTypeOnlyLocation && ts.isTypeKeyword(ts.stringToToken(keywordEntry.name)) || !entryNames_1.has(keywordEntry.name)) {
|
|
132021
132028
|
ts.insertSorted(entries, keywordEntry, compareCompletionEntries, /*allowDuplicates*/ true);
|
|
132022
132029
|
}
|
|
132023
132030
|
}
|
|
@@ -133756,7 +133763,7 @@ var ts;
|
|
|
133756
133763
|
return;
|
|
133757
133764
|
}
|
|
133758
133765
|
// 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-
|
|
133766
|
+
// due to file location or package.json dependency filtering. For non-node16+
|
|
133760
133767
|
// module resolution modes, getting past this point guarantees that we'll be
|
|
133761
133768
|
// able to generate a suitable module specifier, so we can safely show a completion,
|
|
133762
133769
|
// even if we defer computing the module specifier.
|
|
@@ -133764,7 +133771,7 @@ var ts;
|
|
|
133764
133771
|
if (!firstImportableExportInfo) {
|
|
133765
133772
|
return;
|
|
133766
133773
|
}
|
|
133767
|
-
// In
|
|
133774
|
+
// In node16+, module specifier resolution can fail due to modules being blocked
|
|
133768
133775
|
// by package.json `exports`. If that happens, don't show a completion item.
|
|
133769
133776
|
// N.B. in this resolution mode we always try to resolve module specifiers here,
|
|
133770
133777
|
// because we have to know now if it's going to fail so we can omit the completion
|
|
@@ -134736,7 +134743,7 @@ var ts;
|
|
|
134736
134743
|
function getKeywordCompletions(keywordFilter, filterOutTsOnlyKeywords) {
|
|
134737
134744
|
if (!filterOutTsOnlyKeywords)
|
|
134738
134745
|
return getTypescriptKeywordCompletions(keywordFilter);
|
|
134739
|
-
var index = keywordFilter +
|
|
134746
|
+
var index = keywordFilter + 8 /* Last */ + 1;
|
|
134740
134747
|
return _keywordCompletions[index] ||
|
|
134741
134748
|
(_keywordCompletions[index] = getTypescriptKeywordCompletions(keywordFilter)
|
|
134742
134749
|
.filter(function (entry) { return !isTypeScriptOnlyKeyword(ts.stringToToken(entry.name)); }));
|
|
@@ -139359,7 +139366,7 @@ var ts;
|
|
|
139359
139366
|
(function (ts) {
|
|
139360
139367
|
var GoToDefinition;
|
|
139361
139368
|
(function (GoToDefinition) {
|
|
139362
|
-
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly) {
|
|
139369
|
+
function getDefinitionAtPosition(program, sourceFile, position, searchOtherFilesOnly, stopAtAlias) {
|
|
139363
139370
|
var _a;
|
|
139364
139371
|
var _b;
|
|
139365
139372
|
var resolvedRef = getReferenceAtPosition(sourceFile, position, program);
|
|
@@ -139384,7 +139391,7 @@ var ts;
|
|
|
139384
139391
|
}
|
|
139385
139392
|
if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) {
|
|
139386
139393
|
var classDecl = node.parent.parent;
|
|
139387
|
-
var _c = getSymbol(classDecl, typeChecker), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139394
|
+
var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution;
|
|
139388
139395
|
var staticBlocks = ts.filter(classDecl.members, ts.isClassStaticBlockDeclaration);
|
|
139389
139396
|
var containerName_1 = symbol_1 ? typeChecker.symbolToString(symbol_1, classDecl) : "";
|
|
139390
139397
|
var sourceFile_1 = node.getSourceFile();
|
|
@@ -139394,14 +139401,14 @@ var ts;
|
|
|
139394
139401
|
return createDefinitionInfoFromName(typeChecker, staticBlock, "constructor" /* constructorImplementationElement */, "static {}", containerName_1, /*unverified*/ false, failedAliasResolution_1, { start: pos, length: "static".length });
|
|
139395
139402
|
});
|
|
139396
139403
|
}
|
|
139397
|
-
var _d = getSymbol(node, typeChecker), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139404
|
+
var _d = getSymbol(node, typeChecker, stopAtAlias), symbol = _d.symbol, failedAliasResolution = _d.failedAliasResolution;
|
|
139398
139405
|
var fallbackNode = node;
|
|
139399
139406
|
if (searchOtherFilesOnly && failedAliasResolution) {
|
|
139400
139407
|
// We couldn't resolve the specific import, try on the module specifier.
|
|
139401
139408
|
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
139409
|
var moduleSpecifier = importDeclaration && ts.tryGetModuleSpecifierFromDeclaration(importDeclaration);
|
|
139403
139410
|
if (moduleSpecifier) {
|
|
139404
|
-
(_a = getSymbol(moduleSpecifier, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139411
|
+
(_a = getSymbol(moduleSpecifier, typeChecker, stopAtAlias), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution);
|
|
139405
139412
|
fallbackNode = moduleSpecifier;
|
|
139406
139413
|
}
|
|
139407
139414
|
}
|
|
@@ -139575,7 +139582,7 @@ var ts;
|
|
|
139575
139582
|
if (ts.isImportMeta(node.parent) && node.parent.name === node) {
|
|
139576
139583
|
return definitionFromType(typeChecker.getTypeAtLocation(node.parent), typeChecker, node.parent, /*failedAliasResolution*/ false);
|
|
139577
139584
|
}
|
|
139578
|
-
var _a = getSymbol(node, typeChecker), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139585
|
+
var _a = getSymbol(node, typeChecker, /*stopAtAlias*/ false), symbol = _a.symbol, failedAliasResolution = _a.failedAliasResolution;
|
|
139579
139586
|
if (!symbol)
|
|
139580
139587
|
return undefined;
|
|
139581
139588
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
@@ -139626,14 +139633,14 @@ var ts;
|
|
|
139626
139633
|
function getDefinitionInfoForIndexSignatures(node, checker) {
|
|
139627
139634
|
return ts.mapDefined(checker.getIndexInfosAtLocation(node), function (info) { return info.declaration && createDefinitionFromSignatureDeclaration(checker, info.declaration); });
|
|
139628
139635
|
}
|
|
139629
|
-
function getSymbol(node, checker) {
|
|
139636
|
+
function getSymbol(node, checker, stopAtAlias) {
|
|
139630
139637
|
var symbol = checker.getSymbolAtLocation(node);
|
|
139631
139638
|
// If this is an alias, and the request came at the declaration location
|
|
139632
139639
|
// get the aliased symbol instead. This allows for goto def on an import e.g.
|
|
139633
139640
|
// import {A, B} from "mod";
|
|
139634
139641
|
// to jump to the implementation directly.
|
|
139635
139642
|
var failedAliasResolution = false;
|
|
139636
|
-
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139643
|
+
if ((symbol === null || symbol === void 0 ? void 0 : symbol.declarations) && symbol.flags & 2097152 /* Alias */ && !stopAtAlias && shouldSkipAlias(node, symbol.declarations[0])) {
|
|
139637
139644
|
var aliased = checker.getAliasedSymbol(symbol);
|
|
139638
139645
|
if (aliased.declarations) {
|
|
139639
139646
|
return { symbol: aliased };
|
|
@@ -147161,6 +147168,9 @@ var ts;
|
|
|
147161
147168
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
147162
147169
|
}
|
|
147163
147170
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
147171
|
+
if (ts.nodeIsMissing(child)) {
|
|
147172
|
+
return inheritedIndentation;
|
|
147173
|
+
}
|
|
147164
147174
|
var childStartPos = child.getStart(sourceFile);
|
|
147165
147175
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
147166
147176
|
var undecoratedChildStartLine = childStartLine;
|
|
@@ -147227,6 +147237,13 @@ var ts;
|
|
|
147227
147237
|
var listStartToken = getOpenTokenForList(parent, nodes);
|
|
147228
147238
|
var listDynamicIndentation = parentDynamicIndentation;
|
|
147229
147239
|
var startLine = parentStartLine;
|
|
147240
|
+
// node range is outside the target range - do not dive inside
|
|
147241
|
+
if (!ts.rangeOverlapsWithStartEnd(originalRange, nodes.pos, nodes.end)) {
|
|
147242
|
+
if (nodes.end < originalRange.pos) {
|
|
147243
|
+
formattingScanner.skipToEndOf(nodes);
|
|
147244
|
+
}
|
|
147245
|
+
return;
|
|
147246
|
+
}
|
|
147230
147247
|
if (listStartToken !== 0 /* Unknown */) {
|
|
147231
147248
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
147232
147249
|
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
@@ -153219,7 +153236,7 @@ var ts;
|
|
|
153219
153236
|
case ts.ModuleKind.None:
|
|
153220
153237
|
// Fall back to the `import * as ns` style import.
|
|
153221
153238
|
return 2 /* Namespace */;
|
|
153222
|
-
case ts.ModuleKind.
|
|
153239
|
+
case ts.ModuleKind.Node16:
|
|
153223
153240
|
case ts.ModuleKind.NodeNext:
|
|
153224
153241
|
return importingFile.impliedNodeFormat === ts.ModuleKind.ESNext ? 2 /* Namespace */ : 3 /* CommonJS */;
|
|
153225
153242
|
default:
|
|
@@ -155132,8 +155149,8 @@ var ts;
|
|
|
155132
155149
|
(function (codefix) {
|
|
155133
155150
|
codefix.registerCodeFix({
|
|
155134
155151
|
errorCodes: [
|
|
155135
|
-
ts.Diagnostics.
|
|
155136
|
-
ts.Diagnostics.
|
|
155152
|
+
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,
|
|
155153
|
+
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
155154
|
],
|
|
155138
155155
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
155139
155156
|
var compilerOptions = context.program.getCompilerOptions();
|
|
@@ -165016,9 +165033,9 @@ var ts;
|
|
|
165016
165033
|
}
|
|
165017
165034
|
}
|
|
165018
165035
|
/// Goto definition
|
|
165019
|
-
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly) {
|
|
165036
|
+
function getDefinitionAtPosition(fileName, position, searchOtherFilesOnly, stopAtAlias) {
|
|
165020
165037
|
synchronizeHostData();
|
|
165021
|
-
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly);
|
|
165038
|
+
return ts.GoToDefinition.getDefinitionAtPosition(program, getValidSourceFile(fileName), position, searchOtherFilesOnly, stopAtAlias);
|
|
165022
165039
|
}
|
|
165023
165040
|
function getDefinitionAndBoundSpan(fileName, position) {
|
|
165024
165041
|
synchronizeHostData();
|