@typescript-deploys/pr-build 5.4.0-pr-57008-39 → 5.4.0-pr-57114-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.4";
21
- var version = `${versionMajorMinor}.0-insiders.20240116`;
21
+ var version = `${versionMajorMinor}.0-insiders.20240121`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -3567,7 +3567,7 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags2) => {
3567
3567
  SymbolFlags2[SymbolFlags2["Transient"] = 33554432] = "Transient";
3568
3568
  SymbolFlags2[SymbolFlags2["Assignment"] = 67108864] = "Assignment";
3569
3569
  SymbolFlags2[SymbolFlags2["ModuleExports"] = 134217728] = "ModuleExports";
3570
- SymbolFlags2[SymbolFlags2["All"] = 67108863] = "All";
3570
+ SymbolFlags2[SymbolFlags2["All"] = -1] = "All";
3571
3571
  SymbolFlags2[SymbolFlags2["Enum"] = 384] = "Enum";
3572
3572
  SymbolFlags2[SymbolFlags2["Variable"] = 3] = "Variable";
3573
3573
  SymbolFlags2[SymbolFlags2["Value"] = 111551] = "Value";
@@ -3768,6 +3768,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
3768
3768
  ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
3769
3769
  ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
3770
3770
  ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
3771
+ ModuleKind2[ModuleKind2["Preserve"] = 200] = "Preserve";
3771
3772
  return ModuleKind2;
3772
3773
  })(ModuleKind || {});
3773
3774
  var ScriptKind = /* @__PURE__ */ ((ScriptKind3) => {
@@ -3959,9 +3960,6 @@ var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
3959
3960
  var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
3960
3961
  var unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
3961
3962
  function setCustomPollingValues(system) {
3962
- if (!system.getEnvironmentVariable) {
3963
- return;
3964
- }
3965
3963
  const pollingIntervalChanged = setCustomLevels("TSC_WATCH_POLLINGINTERVAL", PollingInterval);
3966
3964
  pollingChunkSize = getCustomPollingBasedLevels("TSC_WATCH_POLLINGCHUNKSIZE", defaultChunkLevels) || pollingChunkSize;
3967
3965
  unchangedPollThresholds = getCustomPollingBasedLevels("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS", defaultChunkLevels) || unchangedPollThresholds;
@@ -6006,7 +6004,7 @@ var Diagnostics = {
6006
6004
  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, 1 /* 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."),
6007
6005
  _0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
6008
6006
  _0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
6009
- 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, 1 /* 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."),
6007
+ Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1378, 1 /* 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6010
6008
  An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type: diag(1379, 1 /* 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'."),
6011
6009
  An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type: diag(1380, 1 /* 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'."),
6012
6010
  Unexpected_token_Did_you_mean_or_rbrace: diag(1381, 1 /* Error */, "Unexpected_token_Did_you_mean_or_rbrace_1381", "Unexpected token. Did you mean `{'}'}` or `}`?"),
@@ -6057,7 +6055,7 @@ var Diagnostics = {
6057
6055
  File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
6058
6056
  The_file_is_in_the_program_because_Colon: diag(1430, 3 /* Message */, "The_file_is_in_the_program_because_Colon_1430", "The file is in the program because:"),
6059
6057
  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, 1 /* 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."),
6060
- 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, 1 /* 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."),
6058
+ Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(1432, 1 /* 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', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6061
6059
  Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters: diag(1433, 1 /* Error */, "Neither_decorators_nor_modifiers_may_be_applied_to_this_parameters_1433", "Neither decorators nor modifiers may be applied to 'this' parameters."),
6062
6060
  Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
6063
6061
  Unknown_keyword_or_identifier_Did_you_mean_0: diag(1435, 1 /* Error */, "Unknown_keyword_or_identifier_Did_you_mean_0_1435", "Unknown keyword or identifier. Did you mean '{0}'?"),
@@ -6640,9 +6638,9 @@ var Diagnostics = {
6640
6638
  Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializers: diag(2818, 1 /* Error */, "Duplicate_identifier_0_Compiler_reserves_name_1_when_emitting_super_references_in_static_initializer_2818", "Duplicate identifier '{0}'. Compiler reserves name '{1}' when emitting 'super' references in static initializers."),
6641
6639
  Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
6642
6640
  Type_0_is_not_assignable_to_type_1_Did_you_mean_2: diag(2820, 1 /* Error */, "Type_0_is_not_assignable_to_type_1_Did_you_mean_2_2820", "Type '{0}' is not assignable to type '{1}'. Did you mean '{2}'?"),
6643
- Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2821, 1 /* 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'."),
6641
+ Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2821, 1 /* Error */, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2821", "Import assertions are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
6644
6642
  Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, 1 /* Error */, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
6645
- Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext_2823", "Import attributes are only supported when the '--module' option is set to 'esnext' or 'nodenext'."),
6643
+ Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve: diag(2823, 1 /* Error */, "Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve_2823", "Import attributes are only supported when the '--module' option is set to 'esnext', 'nodenext', or 'preserve'."),
6646
6644
  Cannot_find_namespace_0_Did_you_mean_1: diag(2833, 1 /* Error */, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
6647
6645
  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, 1 /* 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."),
6648
6646
  Relative_import_paths_need_explicit_file_extensions_in_ECMAScript_imports_when_moduleResolution_is_node16_or_nodenext_Did_you_mean_0: diag(2835, 1 /* 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}'?"),
@@ -6662,7 +6660,7 @@ var Diagnostics = {
6662
6660
  The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined: diag(2851, 1 /* Error */, "The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_2851", "The initializer of an 'await using' declaration must be either an object with a '[Symbol.asyncDispose]()' or '[Symbol.dispose]()' method, or be 'null' or 'undefined'."),
6663
6661
  await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(2852, 1 /* Error */, "await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_2852", "'await using' statements are only allowed within async functions and at the top levels of modules."),
6664
6662
  await_using_statements_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(2853, 1 /* Error */, "await_using_statements_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_th_2853", "'await using' statements 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."),
6665
- Top_level_await_using_statements_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(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements 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."),
6663
+ Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher: diag(2854, 1 /* Error */, "Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_sys_2854", "Top-level 'await using' statements are only allowed when the 'module' option is set to 'es2022', 'esnext', 'system', 'node16', 'nodenext', or 'preserve', and the 'target' option is set to 'es2017' or higher."),
6666
6664
  Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super: diag(2855, 1 /* Error */, "Class_field_0_defined_by_the_parent_class_is_not_accessible_in_the_child_class_via_super_2855", "Class field '{0}' defined by the parent class is not accessible in the child class via super."),
6667
6665
  Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls: diag(2856, 1 /* Error */, "Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls_2856", "Import attributes are not allowed on statements that compile to CommonJS 'require' calls."),
6668
6666
  Import_attributes_cannot_be_used_with_type_only_imports_or_exports: diag(2857, 1 /* Error */, "Import_attributes_cannot_be_used_with_type_only_imports_or_exports_2857", "Import attributes cannot be used with type-only imports or exports."),
@@ -6818,7 +6816,7 @@ var Diagnostics = {
6818
6816
  Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(5068, 1 /* Error */, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."),
6819
6817
  Option_0_cannot_be_specified_without_specifying_option_1_or_option_2: diag(5069, 1 /* Error */, "Option_0_cannot_be_specified_without_specifying_option_1_or_option_2_5069", "Option '{0}' cannot be specified without specifying option '{1}' or option '{2}'."),
6820
6818
  Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic: diag(5070, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic_5070", "Option '--resolveJsonModule' cannot be specified when 'moduleResolution' is set to 'classic'."),
6821
- Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, 1 /* Error */, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
6819
+ Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd: diag(5071, 1 /* Error */, "Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd_5071", "Option '--resolveJsonModule' cannot be specified when 'module' is set to 'none', 'system', or 'umd'."),
6822
6820
  Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
6823
6821
  Build_option_0_requires_a_value_of_type_1: diag(5073, 1 /* Error */, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
6824
6822
  Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, 1 /* Error */, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option '--tsBuildInfoFile' is specified."),
@@ -6841,7 +6839,7 @@ var Diagnostics = {
6841
6839
  The_root_value_of_a_0_file_must_be_an_object: diag(5092, 1 /* Error */, "The_root_value_of_a_0_file_must_be_an_object_5092", "The root value of a '{0}' file must be an object."),
6842
6840
  Compiler_option_0_may_only_be_used_with_build: diag(5093, 1 /* Error */, "Compiler_option_0_may_only_be_used_with_build_5093", "Compiler option '--{0}' may only be used with '--build'."),
6843
6841
  Compiler_option_0_may_not_be_used_with_build: diag(5094, 1 /* Error */, "Compiler_option_0_may_not_be_used_with_build_5094", "Compiler option '--{0}' may not be used with '--build'."),
6844
- Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'es2015' or later."),
6842
+ Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later: diag(5095, 1 /* Error */, "Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later_5095", "Option '{0}' can only be used when 'module' is set to 'preserve' or to 'es2015' or later."),
6845
6843
  Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
6846
6844
  An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
6847
6845
  Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
@@ -7761,6 +7759,12 @@ var Diagnostics = {
7761
7759
  Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
7762
7760
  Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
7763
7761
  Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
7762
+ Add_missing_parameter_to_0: diag(95188, 3 /* Message */, "Add_missing_parameter_to_0_95188", "Add missing parameter to '{0}'"),
7763
+ Add_missing_parameters_to_0: diag(95189, 3 /* Message */, "Add_missing_parameters_to_0_95189", "Add missing parameters to '{0}'"),
7764
+ Add_all_missing_parameters: diag(95190, 3 /* Message */, "Add_all_missing_parameters_95190", "Add all missing parameters"),
7765
+ Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
7766
+ Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
7767
+ Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
7764
7768
  No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, 1 /* Error */, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
7765
7769
  Classes_may_not_have_a_field_named_constructor: diag(18006, 1 /* Error */, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
7766
7770
  JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, 1 /* Error */, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"),
@@ -11583,14 +11587,12 @@ function packageIdToString(packageId) {
11583
11587
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
11584
11588
  return oldResolution === newResolution || oldResolution.resolvedTypeReferenceDirective === newResolution.resolvedTypeReferenceDirective || !!oldResolution.resolvedTypeReferenceDirective && !!newResolution.resolvedTypeReferenceDirective && oldResolution.resolvedTypeReferenceDirective.resolvedFileName === newResolution.resolvedTypeReferenceDirective.resolvedFileName && !!oldResolution.resolvedTypeReferenceDirective.primary === !!newResolution.resolvedTypeReferenceDirective.primary && oldResolution.resolvedTypeReferenceDirective.originalPath === newResolution.resolvedTypeReferenceDirective.originalPath;
11585
11589
  }
11586
- function hasChangesInResolutions(names, newSourceFile, newResolutions, getOldResolution, comparer, nameAndModeGetter) {
11590
+ function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
11587
11591
  Debug.assert(names.length === newResolutions.length);
11588
11592
  for (let i = 0; i < names.length; i++) {
11589
11593
  const newResolution = newResolutions[i];
11590
11594
  const entry = names[i];
11591
- const name = nameAndModeGetter.getName(entry);
11592
- const mode = nameAndModeGetter.getMode(entry, newSourceFile);
11593
- const oldResolution = getOldResolution(name, mode);
11595
+ const oldResolution = getOldResolution(entry);
11594
11596
  const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
11595
11597
  if (changed) {
11596
11598
  return true;
@@ -16443,6 +16445,9 @@ var computedOptions = createComputedCompilerOptions({
16443
16445
  case 199 /* NodeNext */:
16444
16446
  moduleResolution = 99 /* NodeNext */;
16445
16447
  break;
16448
+ case 200 /* Preserve */:
16449
+ moduleResolution = 100 /* Bundler */;
16450
+ break;
16446
16451
  default:
16447
16452
  moduleResolution = 1 /* Classic */;
16448
16453
  break;
@@ -16472,6 +16477,7 @@ var computedOptions = createComputedCompilerOptions({
16472
16477
  switch (computedOptions.module.computeValue(compilerOptions)) {
16473
16478
  case 100 /* Node16 */:
16474
16479
  case 199 /* NodeNext */:
16480
+ case 200 /* Preserve */:
16475
16481
  return true;
16476
16482
  }
16477
16483
  return false;
@@ -16639,18 +16645,12 @@ function emitModuleKindIsNonNodeESM(moduleKind) {
16639
16645
  }
16640
16646
  function hasJsonModuleEmitEnabled(options) {
16641
16647
  switch (getEmitModuleKind(options)) {
16642
- case 1 /* CommonJS */:
16643
- case 2 /* AMD */:
16644
- case 5 /* ES2015 */:
16645
- case 6 /* ES2020 */:
16646
- case 7 /* ES2022 */:
16647
- case 99 /* ESNext */:
16648
- case 100 /* Node16 */:
16649
- case 199 /* NodeNext */:
16650
- return true;
16651
- default:
16648
+ case 0 /* None */:
16649
+ case 4 /* System */:
16650
+ case 3 /* UMD */:
16652
16651
  return false;
16653
16652
  }
16653
+ return true;
16654
16654
  }
16655
16655
  function unreachableCodeIsError(options) {
16656
16656
  return options.allowUnreachableCode === false;
@@ -16661,9 +16661,6 @@ function unusedLabelIsError(options) {
16661
16661
  function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
16662
16662
  return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
16663
16663
  }
16664
- function shouldResolveJsRequire(compilerOptions) {
16665
- return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
16666
- }
16667
16664
  function getStrictOptionValue(compilerOptions, flag) {
16668
16665
  return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
16669
16666
  }
@@ -16827,7 +16824,7 @@ function getPatternFromSpec(spec, basePath, usage) {
16827
16824
  const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
16828
16825
  return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`;
16829
16826
  }
16830
- function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 }) {
16827
+ function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
16831
16828
  let subpattern = "";
16832
16829
  let hasWrittenComponent = false;
16833
16830
  const components = getNormalizedPathComponents(spec, basePath);
@@ -17040,7 +17037,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
17040
17037
  return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
17041
17038
  }
17042
17039
  function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
17043
- if (preference === "js" || resolutionMode === 99 /* ESNext */) {
17040
+ const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
17041
+ if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
17044
17042
  if (!shouldAllowImportingTsExtension(compilerOptions)) {
17045
17043
  return 2 /* JsExtension */;
17046
17044
  }
@@ -24624,6 +24622,9 @@ function isOmittedExpression(node) {
24624
24622
  function isExpressionWithTypeArguments(node) {
24625
24623
  return node.kind === 233 /* ExpressionWithTypeArguments */;
24626
24624
  }
24625
+ function isSatisfiesExpression(node) {
24626
+ return node.kind === 238 /* SatisfiesExpression */;
24627
+ }
24627
24628
  function isNonNullExpression(node) {
24628
24629
  return node.kind === 235 /* NonNullExpression */;
24629
24630
  }
@@ -34429,7 +34430,8 @@ var moduleOptionDeclaration = {
34429
34430
  es2022: 7 /* ES2022 */,
34430
34431
  esnext: 99 /* ESNext */,
34431
34432
  node16: 100 /* Node16 */,
34432
- nodenext: 199 /* NodeNext */
34433
+ nodenext: 199 /* NodeNext */,
34434
+ preserve: 200 /* Preserve */
34433
34435
  })),
34434
34436
  affectsSourceFile: true,
34435
34437
  affectsModuleResolution: true,
@@ -38027,20 +38029,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
38027
38029
  } else {
38028
38030
  let moduleResolution = compilerOptions.moduleResolution;
38029
38031
  if (moduleResolution === void 0) {
38030
- switch (getEmitModuleKind(compilerOptions)) {
38031
- case 1 /* CommonJS */:
38032
- moduleResolution = 2 /* Node10 */;
38033
- break;
38034
- case 100 /* Node16 */:
38035
- moduleResolution = 3 /* Node16 */;
38036
- break;
38037
- case 199 /* NodeNext */:
38038
- moduleResolution = 99 /* NodeNext */;
38039
- break;
38040
- default:
38041
- moduleResolution = 1 /* Classic */;
38042
- break;
38043
- }
38032
+ moduleResolution = getEmitModuleResolutionKind(compilerOptions);
38044
38033
  if (traceEnabled) {
38045
38034
  trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
38046
38035
  }
@@ -41772,7 +41761,7 @@ function createBinder() {
41772
41761
  } else if (isJsonSourceFile(file)) {
41773
41762
  bindSourceFileAsExternalModule();
41774
41763
  const originalSymbol = file.symbol;
41775
- declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, 67108863 /* All */);
41764
+ declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, -1 /* All */);
41776
41765
  file.symbol = originalSymbol;
41777
41766
  }
41778
41767
  }
@@ -41784,7 +41773,7 @@ function createBinder() {
41784
41773
  bindAnonymousDeclaration(node, 111551 /* Value */, getDeclarationName(node));
41785
41774
  } else {
41786
41775
  const flags = exportAssignmentIsAlias(node) ? 2097152 /* Alias */ : 4 /* Property */;
41787
- const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, 67108863 /* All */);
41776
+ const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, -1 /* All */);
41788
41777
  if (node.isExportEquals) {
41789
41778
  setValueDeclaration(symbol, node);
41790
41779
  }
@@ -42237,7 +42226,7 @@ function createBinder() {
42237
42226
  }
42238
42227
  if (!isBindingPattern(node.name)) {
42239
42228
  const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
42240
- if (isInJSFile(node) && shouldResolveJsRequire(options) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
42229
+ if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
42241
42230
  declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
42242
42231
  } else if (isBlockOrCatchScoped(node)) {
42243
42232
  bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
@@ -42766,7 +42755,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
42766
42755
  (reason) => {
42767
42756
  if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
42768
42757
  return void 0;
42769
- if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
42758
+ if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
42770
42759
  return void 0;
42771
42760
  const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
42772
42761
  return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
@@ -43259,7 +43248,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
43259
43248
  return processEnding(shortest, allowedEndings, compilerOptions);
43260
43249
  }
43261
43250
  function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
43262
- if (!host.fileExists || !host.readFile) {
43251
+ if (!host.readFile) {
43263
43252
  return void 0;
43264
43253
  }
43265
43254
  const parts = getNodeModulePathParts(path);
@@ -43366,8 +43355,6 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
43366
43355
  }
43367
43356
  }
43368
43357
  function tryGetAnyFileFromPath(host, path) {
43369
- if (!host.fileExists)
43370
- return;
43371
43358
  const extensions = flatten(getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]));
43372
43359
  for (const e of extensions) {
43373
43360
  const fullPath = path + e;
@@ -44359,14 +44346,6 @@ function createTypeChecker(host) {
44359
44346
  emptyArray,
44360
44347
  emptyArray
44361
44348
  );
44362
- var resolvingApparentMappedType = createAnonymousType(
44363
- /*symbol*/
44364
- void 0,
44365
- emptySymbols,
44366
- emptyArray,
44367
- emptyArray,
44368
- emptyArray
44369
- );
44370
44349
  var markerSuperType = createTypeParameter();
44371
44350
  var markerSubType = createTypeParameter();
44372
44351
  markerSubType.constraint = markerSuperType;
@@ -46022,7 +46001,7 @@ function createTypeChecker(host) {
46022
46001
  return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
46023
46002
  }
46024
46003
  function getUsageModeForExpression(usage) {
46025
- return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
46004
+ return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
46026
46005
  }
46027
46006
  function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
46028
46007
  return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
@@ -46033,7 +46012,7 @@ function createTypeChecker(host) {
46033
46012
  }
46034
46013
  function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
46035
46014
  const usageMode = file && getUsageModeForExpression(usage);
46036
- if (file && usageMode !== void 0) {
46015
+ if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
46037
46016
  const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
46038
46017
  if (usageMode === 99 /* ESNext */ || result) {
46039
46018
  return result;
@@ -46566,7 +46545,7 @@ function createTypeChecker(host) {
46566
46545
  break;
46567
46546
  }
46568
46547
  if (target === unknownSymbol) {
46569
- return 67108863 /* All */;
46548
+ return -1 /* All */;
46570
46549
  }
46571
46550
  if (target === symbol || (seenSymbols == null ? void 0 : seenSymbols.has(target))) {
46572
46551
  break;
@@ -46927,8 +46906,12 @@ function createTypeChecker(host) {
46927
46906
  return ambientModule;
46928
46907
  }
46929
46908
  const currentSourceFile = getSourceFileOfNode(location);
46930
- const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = findAncestor(location, isImportCall)) == null ? void 0 : _a.arguments[0]) || ((_b = findAncestor(location, isImportDeclaration)) == null ? void 0 : _b.moduleSpecifier) || ((_c = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _c.moduleReference.expression) || ((_d = findAncestor(location, isExportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _e.name) || ((_f = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _f.argument.literal);
46931
- const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46909
+ const contextSpecifier = isStringLiteralLike(location) ? location : ((_a = isModuleDeclaration(location) ? location : location.parent && isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : void 0) == null ? void 0 : _a.name) || ((_b = isLiteralImportTypeNode(location) ? location : void 0) == null ? void 0 : _b.argument.literal) || (isVariableDeclaration(location) && location.initializer && isRequireCall(
46910
+ location.initializer,
46911
+ /*requireStringLiteralLikeArgument*/
46912
+ true
46913
+ ) ? location.initializer.arguments[0] : void 0) || ((_c = findAncestor(location, isImportCall)) == null ? void 0 : _c.arguments[0]) || ((_d = findAncestor(location, isImportDeclaration)) == null ? void 0 : _d.moduleSpecifier) || ((_e = findAncestor(location, isExternalModuleImportEqualsDeclaration)) == null ? void 0 : _e.moduleReference.expression) || ((_f = findAncestor(location, isExportDeclaration)) == null ? void 0 : _f.moduleSpecifier);
46914
+ const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
46932
46915
  const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
46933
46916
  const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
46934
46917
  const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
@@ -50082,7 +50065,7 @@ function createTypeChecker(host) {
50082
50065
  }
50083
50066
  const sym = resolveEntityName(
50084
50067
  leftmost,
50085
- 67108863 /* All */,
50068
+ -1 /* All */,
50086
50069
  /*ignoreErrors*/
50087
50070
  true,
50088
50071
  /*dontResolveAlias*/
@@ -50092,13 +50075,13 @@ function createTypeChecker(host) {
50092
50075
  if (isSymbolAccessible(
50093
50076
  sym,
50094
50077
  context.enclosingDeclaration,
50095
- 67108863 /* All */,
50078
+ -1 /* All */,
50096
50079
  /*shouldComputeAliasesToMakeVisible*/
50097
50080
  false
50098
50081
  ).accessibility !== 0 /* Accessible */) {
50099
50082
  introducesError = true;
50100
50083
  } else {
50101
- context.tracker.trackSymbol(sym, context.enclosingDeclaration, 67108863 /* All */);
50084
+ context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
50102
50085
  includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
50103
50086
  }
50104
50087
  if (isIdentifier(node)) {
@@ -51210,7 +51193,7 @@ function createTypeChecker(host) {
51210
51193
  isLocalImport ? symbolToName(
51211
51194
  target,
51212
51195
  context,
51213
- 67108863 /* All */,
51196
+ -1 /* All */,
51214
51197
  /*expectsIdentifier*/
51215
51198
  false
51216
51199
  ) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
@@ -51369,7 +51352,7 @@ function createTypeChecker(host) {
51369
51352
  const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0;
51370
51353
  const referenced = first2 && resolveEntityName(
51371
51354
  first2,
51372
- 67108863 /* All */,
51355
+ -1 /* All */,
51373
51356
  /*ignoreErrors*/
51374
51357
  true,
51375
51358
  /*dontResolveAlias*/
@@ -51386,7 +51369,7 @@ function createTypeChecker(host) {
51386
51369
  /*modifiers*/
51387
51370
  void 0,
51388
51371
  isExportEquals,
51389
- symbolToExpression(target, context, 67108863 /* All */)
51372
+ symbolToExpression(target, context, -1 /* All */)
51390
51373
  ));
51391
51374
  } else {
51392
51375
  if (first2 === expr && first2) {
@@ -51405,7 +51388,7 @@ function createTypeChecker(host) {
51405
51388
  symbolToName(
51406
51389
  target,
51407
51390
  context,
51408
- 67108863 /* All */,
51391
+ -1 /* All */,
51409
51392
  /*expectsIdentifier*/
51410
51393
  false
51411
51394
  )
@@ -55318,30 +55301,14 @@ function createTypeChecker(host) {
55318
55301
  return !!(typeParameter.symbol && forEach(typeParameter.symbol.declarations, (decl) => isTypeParameterDeclaration(decl) && decl.default));
55319
55302
  }
55320
55303
  function getApparentTypeOfMappedType(type) {
55321
- if (type.resolvedApparentType) {
55322
- if (type.resolvedApparentType === resolvingApparentMappedType) {
55323
- return type.resolvedApparentType = type;
55324
- }
55325
- return type.resolvedApparentType;
55326
- }
55327
- type.resolvedApparentType = resolvingApparentMappedType;
55328
- return type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type);
55304
+ return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
55329
55305
  }
55330
55306
  function getResolvedApparentTypeOfMappedType(type) {
55331
- const mappedType = type.target || type;
55332
- const typeVariable = getHomomorphicTypeVariable(mappedType);
55333
- if (typeVariable && !mappedType.declaration.nameType) {
55334
- let constraint;
55335
- if (!type.target) {
55336
- constraint = getConstraintOfTypeParameter(typeVariable);
55337
- } else {
55338
- const modifiersConstraint = getConstraintOfType(getModifiersTypeFromMappedType(type));
55339
- if (modifiersConstraint) {
55340
- constraint = getApparentType(modifiersConstraint);
55341
- }
55342
- }
55307
+ const typeVariable = getHomomorphicTypeVariable(type);
55308
+ if (typeVariable && !type.declaration.nameType) {
55309
+ const constraint = getConstraintOfTypeParameter(typeVariable);
55343
55310
  if (constraint && everyType(constraint, isArrayOrTupleType)) {
55344
- return instantiateType(mappedType, prependTypeMapping(typeVariable, constraint, mappedType.mapper));
55311
+ return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
55345
55312
  }
55346
55313
  }
55347
55314
  return type;
@@ -56665,7 +56632,7 @@ function createTypeChecker(host) {
56665
56632
  if (constraint) {
56666
56633
  constraints = append(constraints, constraint);
56667
56634
  }
56668
- } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
56635
+ } else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && !parent.nameType && node === parent.type) {
56669
56636
  const mappedType = getTypeFromTypeNode(parent);
56670
56637
  if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
56671
56638
  const typeParameter = getHomomorphicTypeVariable(mappedType);
@@ -59725,11 +59692,8 @@ function createTypeChecker(host) {
59725
59692
  if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
59726
59693
  return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
59727
59694
  }
59728
- if (isGenericTupleType(t)) {
59729
- return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
59730
- }
59731
59695
  if (isTupleType(t)) {
59732
- return instantiateMappedTupleType(t, type, prependTypeMapping(typeVariable, t, mapper));
59696
+ return instantiateMappedTupleType(t, type, typeVariable, mapper);
59733
59697
  }
59734
59698
  }
59735
59699
  return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
@@ -59746,17 +59710,18 @@ function createTypeChecker(host) {
59746
59710
  function getModifiedReadonlyState(state, modifiers) {
59747
59711
  return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
59748
59712
  }
59749
- function instantiateMappedGenericTupleType(tupleType, mappedType, typeVariable, mapper) {
59713
+ function instantiateMappedTupleType(tupleType, mappedType, typeVariable, mapper) {
59750
59714
  const elementFlags = tupleType.target.elementFlags;
59751
- const elementTypes = map(getElementTypes(tupleType), (t, i) => {
59752
- const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
59753
- if (singleton === typeVariable) {
59754
- return mappedType;
59755
- }
59756
- return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
59715
+ const fixedLength = tupleType.target.fixedLength;
59716
+ const fixedMapper = fixedLength ? prependTypeMapping(typeVariable, tupleType, mapper) : mapper;
59717
+ const newElementTypes = map(getElementTypes(tupleType), (type, i) => {
59718
+ const flags = elementFlags[i];
59719
+ return i < fixedLength ? instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(flags & 2 /* Optional */), fixedMapper) : flags & 8 /* Variadic */ ? instantiateType(mappedType, prependTypeMapping(typeVariable, type, mapper)) : getElementTypeOfArrayType(instantiateType(mappedType, prependTypeMapping(typeVariable, createArrayType(type), mapper))) ?? unknownType;
59757
59720
  });
59721
+ const modifiers = getMappedTypeModifiers(mappedType);
59722
+ const newElementFlags = modifiers & 4 /* IncludeOptional */ ? map(elementFlags, (f) => f & 1 /* Required */ ? 2 /* Optional */ : f) : modifiers & 8 /* ExcludeOptional */ ? map(elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : elementFlags;
59758
59723
  const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
59759
- return createTupleType(elementTypes, map(elementTypes, (_) => 8 /* Variadic */), newReadonly);
59724
+ return contains(newElementTypes, errorType) ? errorType : createTupleType(newElementTypes, newElementFlags, newReadonly, tupleType.target.labeledElementDeclarations);
59760
59725
  }
59761
59726
  function instantiateMappedArrayType(arrayType, mappedType, mapper) {
59762
59727
  const elementType = instantiateMappedTypeTemplate(
@@ -59768,14 +59733,6 @@ function createTypeChecker(host) {
59768
59733
  );
59769
59734
  return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
59770
59735
  }
59771
- function instantiateMappedTupleType(tupleType, mappedType, mapper) {
59772
- const elementFlags = tupleType.target.elementFlags;
59773
- const elementTypes = map(getElementTypes(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper));
59774
- const modifiers = getMappedTypeModifiers(mappedType);
59775
- const newTupleModifiers = modifiers & 4 /* IncludeOptional */ ? map(elementFlags, (f) => f & 1 /* Required */ ? 2 /* Optional */ : f) : modifiers & 8 /* ExcludeOptional */ ? map(elementFlags, (f) => f & 2 /* Optional */ ? 1 /* Required */ : f) : elementFlags;
59776
- const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers);
59777
- return contains(elementTypes, errorType) ? errorType : createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations);
59778
- }
59779
59736
  function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
59780
59737
  const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
59781
59738
  const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
@@ -60547,7 +60504,8 @@ function createTypeChecker(host) {
60547
60504
  if (isOmittedExpression(elem))
60548
60505
  continue;
60549
60506
  const nameType = getNumberLiteralType(i);
60550
- yield { errorNode: elem, innerExpression: elem, nameType };
60507
+ const checkNode = getEffectiveCheckNode(elem);
60508
+ yield { errorNode: checkNode, innerExpression: checkNode, nameType };
60551
60509
  }
60552
60510
  }
60553
60511
  function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
@@ -70053,7 +70011,12 @@ function createTypeChecker(host) {
70053
70011
  }
70054
70012
  const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
70055
70013
  const errorMessage = isClassic ? Diagnostics.Cannot_find_module_0_Did_you_mean_to_set_the_moduleResolution_option_to_nodenext_or_to_add_aliases_to_the_paths_option : Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations;
70056
- const mod = resolveExternalModule(location, runtimeImportSpecifier, errorMessage, location);
70014
+ const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
70015
+ const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
70016
+ if (specifier) {
70017
+ Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
70018
+ }
70019
+ const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
70057
70020
  const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
70058
70021
  if (links) {
70059
70022
  links.jsxImplicitImportContainer = result || false;
@@ -70296,7 +70259,7 @@ function createTypeChecker(host) {
70296
70259
  );
70297
70260
  }
70298
70261
  if (jsxFactorySym) {
70299
- jsxFactorySym.isReferenced = 67108863 /* All */;
70262
+ jsxFactorySym.isReferenced = -1 /* All */;
70300
70263
  if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
70301
70264
  markAliasSymbolAsReferenced(jsxFactorySym);
70302
70265
  }
@@ -71136,7 +71099,7 @@ function createTypeChecker(host) {
71136
71099
  return;
71137
71100
  }
71138
71101
  }
71139
- (getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = 67108863 /* All */;
71102
+ (getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = -1 /* All */;
71140
71103
  }
71141
71104
  function isSelfTypeAccess(name, parent) {
71142
71105
  return name.kind === 110 /* ThisKeyword */ || !!parent && isEntityNameExpression(name) && parent === getResolvedSymbol(getFirstIdentifier(name));
@@ -71699,6 +71662,10 @@ function createTypeChecker(host) {
71699
71662
  return false;
71700
71663
  }
71701
71664
  }
71665
+ function getEffectiveCheckNode(argument) {
71666
+ argument = skipParentheses(argument);
71667
+ return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
71668
+ }
71702
71669
  function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
71703
71670
  const errorOutputContainer = { errors: void 0, skipLogging: true };
71704
71671
  if (isJsxOpeningLikeElement(node)) {
@@ -71734,7 +71701,8 @@ function createTypeChecker(host) {
71734
71701
  checkMode
71735
71702
  );
71736
71703
  const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
71737
- if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? arg : void 0, arg, headMessage, containingMessageChain, errorOutputContainer)) {
71704
+ const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
71705
+ if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
71738
71706
  Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
71739
71707
  maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
71740
71708
  return errorOutputContainer.errors || emptyArray;
@@ -71752,7 +71720,7 @@ function createTypeChecker(host) {
71752
71720
  checkMode
71753
71721
  );
71754
71722
  const restArgCount = args.length - argCount;
71755
- const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? args[argCount] : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
71723
+ const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? getEffectiveCheckNode(args[argCount]) : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
71756
71724
  if (!checkTypeRelatedTo(
71757
71725
  spreadType,
71758
71726
  restType,
@@ -73094,7 +73062,7 @@ function createTypeChecker(host) {
73094
73062
  return anyType;
73095
73063
  }
73096
73064
  }
73097
- if (isInJSFile(node) && shouldResolveJsRequire(compilerOptions) && isCommonJsRequire(node)) {
73065
+ if (isInJSFile(node) && isCommonJsRequire(node)) {
73098
73066
  return resolveExternalModuleTypeByLiteral(node.arguments[0]);
73099
73067
  }
73100
73068
  const returnType = getReturnTypeOfSignature(signature);
@@ -74574,17 +74542,18 @@ function createTypeChecker(host) {
74574
74542
  const exprType = checkExpression(node.body);
74575
74543
  const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
74576
74544
  if (returnOrPromisedType) {
74545
+ const effectiveCheckNode = getEffectiveCheckNode(node.body);
74577
74546
  if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
74578
74547
  const awaitedType = checkAwaitedType(
74579
74548
  exprType,
74580
74549
  /*withAlias*/
74581
74550
  false,
74582
- node.body,
74551
+ effectiveCheckNode,
74583
74552
  Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
74584
74553
  );
74585
- checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, node.body, node.body);
74554
+ checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
74586
74555
  } else {
74587
- checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, node.body, node.body);
74556
+ checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
74588
74557
  }
74589
74558
  }
74590
74559
  }
@@ -74746,13 +74715,14 @@ function createTypeChecker(host) {
74746
74715
  }
74747
74716
  case 7 /* ES2022 */:
74748
74717
  case 99 /* ESNext */:
74718
+ case 200 /* Preserve */:
74749
74719
  case 4 /* System */:
74750
74720
  if (languageVersion >= 4 /* ES2017 */) {
74751
74721
  break;
74752
74722
  }
74753
74723
  default:
74754
74724
  span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
74755
- const message = isAwaitExpression(node) ? 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 : Diagnostics.Top_level_await_using_statements_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;
74725
+ const message = isAwaitExpression(node) ? Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher : Diagnostics.Top_level_await_using_statements_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher;
74756
74726
  diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
74757
74727
  hasError = true;
74758
74728
  break;
@@ -77000,11 +76970,10 @@ function createTypeChecker(host) {
77000
76970
  checkSourceElement(node.elementType);
77001
76971
  }
77002
76972
  function checkTupleType(node) {
77003
- const elementTypes = node.elements;
77004
76973
  let seenOptionalElement = false;
77005
76974
  let seenRestElement = false;
77006
- for (const e of elementTypes) {
77007
- const flags = getTupleElementFlags(e);
76975
+ for (const e of node.elements) {
76976
+ let flags = getTupleElementFlags(e);
77008
76977
  if (flags & 8 /* Variadic */) {
77009
76978
  const type = getTypeFromTypeNode(e.type);
77010
76979
  if (!isArrayLikeType(type)) {
@@ -77012,9 +76981,10 @@ function createTypeChecker(host) {
77012
76981
  break;
77013
76982
  }
77014
76983
  if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
77015
- seenRestElement = true;
76984
+ flags |= 4 /* Rest */;
77016
76985
  }
77017
- } else if (flags & 4 /* Rest */) {
76986
+ }
76987
+ if (flags & 4 /* Rest */) {
77018
76988
  if (seenRestElement) {
77019
76989
  grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
77020
76990
  break;
@@ -77026,7 +76996,7 @@ function createTypeChecker(host) {
77026
76996
  break;
77027
76997
  }
77028
76998
  seenOptionalElement = true;
77029
- } else if (seenOptionalElement) {
76999
+ } else if (flags & 1 /* Required */ && seenOptionalElement) {
77030
77000
  grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
77031
77001
  break;
77032
77002
  }
@@ -78822,7 +78792,7 @@ function createTypeChecker(host) {
78822
78792
  }
78823
78793
  }
78824
78794
  function helper(condExpr2, body2) {
78825
- const location = isLogicalOrCoalescingBinaryExpression(condExpr2) ? skipParentheses(condExpr2.right) : condExpr2;
78795
+ const location = isLogicalOrCoalescingBinaryExpression(condExpr2) ? skipParentheses(condExpr2.right) : isPrefixUnaryExpression(condExpr2) ? condExpr2.operand : condExpr2;
78826
78796
  if (isModuleExportsAccessExpression(location)) {
78827
78797
  return;
78828
78798
  }
@@ -78834,7 +78804,8 @@ function createTypeChecker(host) {
78834
78804
  const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
78835
78805
  if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
78836
78806
  return;
78837
- const callSignatures = getSignaturesOfType(type, 0 /* Call */);
78807
+ const testedType = isPrefixUnaryExpression(condExpr2) ? checkExpression(location) : type;
78808
+ const callSignatures = getSignaturesOfType(testedType, 0 /* Call */);
78838
78809
  const isPromise = !!getAwaitedTypeOfPromise(type);
78839
78810
  if (callSignatures.length === 0 && !isPromise) {
78840
78811
  return;
@@ -81267,8 +81238,8 @@ function createTypeChecker(host) {
81267
81238
  return;
81268
81239
  }
81269
81240
  const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
81270
- if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
81271
- const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_or_nodenext;
81241
+ if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
81242
+ const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve : moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_nodenext_or_preserve;
81272
81243
  return grammarErrorOnNode(node, message);
81273
81244
  }
81274
81245
  if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
@@ -81340,7 +81311,7 @@ function createTypeChecker(host) {
81340
81311
  grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
81341
81312
  }
81342
81313
  } else {
81343
- if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
81314
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
81344
81315
  grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
81345
81316
  }
81346
81317
  }
@@ -81501,7 +81472,7 @@ function createTypeChecker(host) {
81501
81472
  const id = node.expression;
81502
81473
  const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
81503
81474
  id,
81504
- 67108863 /* All */,
81475
+ -1 /* All */,
81505
81476
  /*ignoreErrors*/
81506
81477
  true,
81507
81478
  /*dontResolveAlias*/
@@ -81575,7 +81546,7 @@ function createTypeChecker(host) {
81575
81546
  grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
81576
81547
  }
81577
81548
  if (node.isExportEquals) {
81578
- if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
81549
+ if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
81579
81550
  grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
81580
81551
  } else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
81581
81552
  grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
@@ -82567,7 +82538,7 @@ function createTypeChecker(host) {
82567
82538
  return void 0;
82568
82539
  case 11 /* StringLiteral */:
82569
82540
  case 15 /* NoSubstitutionTemplateLiteral */:
82570
- if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */ && isRequireCall(
82541
+ if (isExternalModuleImportEqualsDeclaration(node.parent.parent) && getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node || (node.parent.kind === 272 /* ImportDeclaration */ || node.parent.kind === 278 /* ExportDeclaration */) && node.parent.moduleSpecifier === node || (isInJSFile(node) && isRequireCall(
82571
82542
  node.parent,
82572
82543
  /*requireStringLiteralLikeArgument*/
82573
82544
  false
@@ -84629,7 +84600,7 @@ function createTypeChecker(host) {
84629
84600
  }
84630
84601
  default:
84631
84602
  diagnostics.add(
84632
- createDiagnosticForNode(forInOrOfStatement.awaitModifier, 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)
84603
+ createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_node16_nodenext_or_preserve_and_the_target_option_is_set_to_es2017_or_higher)
84633
84604
  );
84634
84605
  break;
84635
84606
  }
@@ -107974,7 +107945,7 @@ function transformECMAScriptModule(context) {
107974
107945
  setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
107975
107946
  );
107976
107947
  }
107977
- if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
107948
+ if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
107978
107949
  return result;
107979
107950
  }
107980
107951
  return factory2.updateSourceFile(
@@ -108017,6 +107988,14 @@ function transformECMAScriptModule(context) {
108017
107988
  if (moduleName) {
108018
107989
  args.push(moduleName);
108019
107990
  }
107991
+ if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
107992
+ return factory2.createCallExpression(
107993
+ factory2.createIdentifier("require"),
107994
+ /*typeArguments*/
107995
+ void 0,
107996
+ args
107997
+ );
107998
+ }
108020
107999
  if (!importRequireStatements) {
108021
108000
  const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
108022
108001
  const importStatement = factory2.createImportDeclaration(
@@ -108131,7 +108110,25 @@ function transformECMAScriptModule(context) {
108131
108110
  return statements;
108132
108111
  }
108133
108112
  function visitExportAssignment(node) {
108134
- return node.isExportEquals ? void 0 : node;
108113
+ if (node.isExportEquals) {
108114
+ if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
108115
+ const statement = setOriginalNode(
108116
+ factory2.createExpressionStatement(
108117
+ factory2.createAssignment(
108118
+ factory2.createPropertyAccessExpression(
108119
+ factory2.createIdentifier("module"),
108120
+ "exports"
108121
+ ),
108122
+ node.expression
108123
+ )
108124
+ ),
108125
+ node
108126
+ );
108127
+ return statement;
108128
+ }
108129
+ return void 0;
108130
+ }
108131
+ return node;
108135
108132
  }
108136
108133
  function visitExportDeclaration(node) {
108137
108134
  if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
@@ -108592,7 +108589,7 @@ function transformDeclarations(context) {
108592
108589
  }
108593
108590
  }
108594
108591
  function trackReferencedAmbientModule(node, symbol) {
108595
- const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, 67108863 /* All */);
108592
+ const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
108596
108593
  if (length(directives)) {
108597
108594
  return recordTypeReferenceDirectivesIfNecessary(directives);
108598
108595
  }
@@ -110258,6 +110255,7 @@ function getModuleTransformer(moduleKind) {
110258
110255
  case 7 /* ES2022 */:
110259
110256
  case 6 /* ES2020 */:
110260
110257
  case 5 /* ES2015 */:
110258
+ case 200 /* Preserve */:
110261
110259
  return transformECMAScriptModule;
110262
110260
  case 4 /* System */:
110263
110261
  return transformSystemModule;
@@ -117031,8 +117029,8 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
117031
117029
  function getModeForFileReference(ref, containingFileMode) {
117032
117030
  return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
117033
117031
  }
117034
- function getModeForResolutionAtIndex(file, index) {
117035
- return getModeForUsageLocation(file, getModuleNameStringLiteralAt(file, index));
117032
+ function getModeForResolutionAtIndex(file, index, compilerOptions) {
117033
+ return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
117036
117034
  }
117037
117035
  function isExclusivelyTypeOnlyImportOrExport(decl) {
117038
117036
  var _a;
@@ -117044,7 +117042,10 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
117044
117042
  }
117045
117043
  return false;
117046
117044
  }
117047
- function getModeForUsageLocation(file, usage) {
117045
+ function getModeForUsageLocation(file, usage, compilerOptions) {
117046
+ return getModeForUsageLocationWorker(file, usage, compilerOptions);
117047
+ }
117048
+ function getModeForUsageLocationWorker(file, usage, compilerOptions) {
117048
117049
  var _a;
117049
117050
  if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
117050
117051
  const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
@@ -117061,6 +117062,13 @@ function getModeForUsageLocation(file, usage) {
117061
117062
  return override;
117062
117063
  }
117063
117064
  }
117065
+ if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
117066
+ return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
117067
+ usage.parent,
117068
+ /*requireStringLiteralLikeArgument*/
117069
+ false
117070
+ ) ? 1 /* CommonJS */ : 99 /* ESNext */;
117071
+ }
117064
117072
  if (file.impliedNodeFormat === void 0)
117065
117073
  return void 0;
117066
117074
  if (file.impliedNodeFormat !== 99 /* ESNext */) {
@@ -117106,7 +117114,7 @@ function getModuleResolutionName(literal) {
117106
117114
  }
117107
117115
  var moduleResolutionNameAndModeGetter = {
117108
117116
  getName: getModuleResolutionName,
117109
- getMode: (entry, file) => getModeForUsageLocation(file, entry)
117117
+ getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
117110
117118
  };
117111
117119
  function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
117112
117120
  return {
@@ -117151,7 +117159,7 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
117151
117159
  const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
117152
117160
  for (const entry of entries) {
117153
117161
  const name = loader.nameAndMode.getName(entry);
117154
- const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
117162
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
117155
117163
  const key = createModeAwareCacheKey(name, mode);
117156
117164
  let result = cache.get(key);
117157
117165
  if (!result) {
@@ -117237,7 +117245,7 @@ function getReferencedFileLocation(program, ref) {
117237
117245
  switch (kind) {
117238
117246
  case 3 /* Import */:
117239
117247
  const importLiteral = getModuleNameStringLiteralAt(file, index);
117240
- packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, getModeForResolutionAtIndex(file, index))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
117248
+ packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, program.getModeForUsageLocation(file, importLiteral))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
117241
117249
  if (importLiteral.pos === -1)
117242
117250
  return { file, packageId, text: importLiteral.text };
117243
117251
  pos = skipTrivia(file.text, importLiteral.pos);
@@ -117766,6 +117774,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117766
117774
  getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
117767
117775
  isSourceFileFromExternalLibrary,
117768
117776
  isSourceFileDefaultLibrary,
117777
+ getModeForUsageLocation: getModeForUsageLocation2,
117778
+ getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
117769
117779
  getSourceFileFromReference,
117770
117780
  getLibFileFromReference,
117771
117781
  sourceFileToPackageName,
@@ -117775,6 +117785,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117775
117785
  resolvedTypeReferenceDirectiveNames,
117776
117786
  resolvedLibReferences,
117777
117787
  getResolvedModule,
117788
+ getResolvedModuleFromModuleSpecifier,
117778
117789
  getResolvedTypeReferenceDirective,
117779
117790
  forEachResolvedModule,
117780
117791
  forEachResolvedTypeReferenceDirective,
@@ -117825,6 +117836,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117825
117836
  var _a2;
117826
117837
  return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
117827
117838
  }
117839
+ function getResolvedModuleFromModuleSpecifier(moduleSpecifier) {
117840
+ const sourceFile = getSourceFileOfNode(moduleSpecifier);
117841
+ Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode.");
117842
+ return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation2(sourceFile, moduleSpecifier));
117843
+ }
117828
117844
  function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
117829
117845
  var _a2;
117830
117846
  return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
@@ -117997,8 +118013,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
117997
118013
  for (let i = 0; i < moduleNames.length; i++) {
117998
118014
  const moduleName = moduleNames[i];
117999
118015
  if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
118000
- const mode = getModeForUsageLocation(file, moduleName);
118001
- const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
118016
+ const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
118002
118017
  if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
118003
118018
  if (isTraceEnabled(options, host)) {
118004
118019
  trace(
@@ -118046,7 +118061,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118046
118061
  return result;
118047
118062
  function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
118048
118063
  var _a2;
118049
- const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
118064
+ const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
118050
118065
  const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
118051
118066
  if (resolutionToFile && resolvedFile) {
118052
118067
  return false;
@@ -118264,11 +118279,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118264
118279
  (resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
118265
118280
  const resolutionsChanged = hasChangesInResolutions(
118266
118281
  moduleNames,
118267
- newSourceFile,
118268
118282
  resolutions,
118269
- (name, mode) => oldProgram.getResolvedModule(newSourceFile, name, mode),
118270
- moduleResolutionIsEqualTo,
118271
- moduleResolutionNameAndModeGetter
118283
+ (name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation2(newSourceFile, name)),
118284
+ moduleResolutionIsEqualTo
118272
118285
  );
118273
118286
  if (resolutionsChanged)
118274
118287
  structureIsReused = 1 /* SafeModules */;
@@ -118277,11 +118290,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118277
118290
  (resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
118278
118291
  const typeReferenceResolutionsChanged = hasChangesInResolutions(
118279
118292
  typesReferenceDirectives,
118280
- newSourceFile,
118281
118293
  typeReferenceResolutions,
118282
- (name, mode) => oldProgram == null ? void 0 : oldProgram.getResolvedTypeReferenceDirective(newSourceFile, name, mode),
118283
- typeDirectiveIsEqualTo,
118284
- typeReferenceResolutionNameAndModeGetter
118294
+ (name) => oldProgram.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)),
118295
+ typeDirectiveIsEqualTo
118285
118296
  );
118286
118297
  if (typeReferenceResolutionsChanged)
118287
118298
  structureIsReused = 1 /* SafeModules */;
@@ -118948,8 +118959,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118948
118959
  false
118949
118960
  );
118950
118961
  }
118951
- const shouldProcessRequires = isJavaScriptFile && shouldResolveJsRequire(options);
118952
- if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
118962
+ if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
118953
118963
  collectDynamicImportOrRequireCalls(file);
118954
118964
  }
118955
118965
  file.imports = imports || emptyArray;
@@ -118998,7 +119008,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
118998
119008
  const r = /import|require/g;
118999
119009
  while (r.exec(file2.text) !== null) {
119000
119010
  const node = getNodeAtPosition(file2, r.lastIndex);
119001
- if (shouldProcessRequires && isRequireCall(
119011
+ if (isJavaScriptFile && isRequireCall(
119002
119012
  node,
119003
119013
  /*requireStringLiteralLikeArgument*/
119004
119014
  true
@@ -119553,13 +119563,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119553
119563
  const moduleNames = getModuleNames(file);
119554
119564
  const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
119555
119565
  Debug.assert(resolutions.length === moduleNames.length);
119556
- const optionsForFile = (useSourceOfProjectReferenceRedirect ? (_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options : void 0) || options;
119566
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
119557
119567
  const resolutionsInFile = createModeAwareCache();
119558
119568
  (resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
119559
119569
  for (let index = 0; index < moduleNames.length; index++) {
119560
119570
  const resolution = resolutions[index].resolvedModule;
119561
119571
  const moduleName = moduleNames[index].text;
119562
- const mode = getModeForUsageLocation(file, moduleNames[index]);
119572
+ const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile);
119563
119573
  resolutionsInFile.set(moduleName, mode, resolutions[index]);
119564
119574
  addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
119565
119575
  if (!resolution) {
@@ -119839,7 +119849,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119839
119849
  if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
119840
119850
  createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
119841
119851
  } else if (!hasJsonModuleEmitEnabled(options)) {
119842
- createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext, "resolveJsonModule", "module");
119852
+ createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
119843
119853
  }
119844
119854
  }
119845
119855
  if (options.outDir || // there is --outDir specified
@@ -119903,7 +119913,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119903
119913
  }
119904
119914
  }
119905
119915
  if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
119906
- createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "preserveValueImports");
119916
+ createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
119907
119917
  }
119908
119918
  const moduleKind = getEmitModuleKind(options);
119909
119919
  if (options.verbatimModuleSyntax) {
@@ -119930,8 +119940,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
119930
119940
  if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
119931
119941
  createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
119932
119942
  }
119933
- if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
119934
- createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_es2015_or_later, "bundler");
119943
+ if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
119944
+ createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
119935
119945
  }
119936
119946
  if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
119937
119947
  const moduleKindName = ModuleKind[moduleKind];
@@ -120438,6 +120448,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
120438
120448
  }
120439
120449
  return symlinks;
120440
120450
  }
120451
+ function getModeForUsageLocation2(file, usage) {
120452
+ var _a2;
120453
+ const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
120454
+ return getModeForUsageLocationWorker(file, usage, optionsForFile);
120455
+ }
120456
+ function getModeForResolutionAtIndex2(file, index) {
120457
+ return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
120458
+ }
120441
120459
  }
120442
120460
  function updateHostForUseSourceOfProjectReferenceRedirect(host) {
120443
120461
  let setOfDeclarationDirectories;
@@ -122868,7 +122886,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122868
122886
  const seenNamesInFile = createModeAwareCache();
122869
122887
  for (const entry of entries) {
122870
122888
  const name = loader.nameAndMode.getName(entry);
122871
- const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
122889
+ const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
122872
122890
  let resolution = resolutionsInFile.get(name, mode);
122873
122891
  if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
122874
122892
  hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
@@ -122909,7 +122927,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
122909
122927
  reusedNames == null ? void 0 : reusedNames.forEach(
122910
122928
  (entry) => seenNamesInFile.set(
122911
122929
  loader.nameAndMode.getName(entry),
122912
- loader.nameAndMode.getMode(entry, containingSourceFile),
122930
+ loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
122913
122931
  true
122914
122932
  )
122915
122933
  );