typescript 5.4.0-dev.20240119 → 5.4.0-dev.20240120
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/cancellationToken.js +0 -1
- package/lib/tsc.js +186 -164
- package/lib/tsserver.js +683 -434
- package/lib/typescript.d.ts +51 -11
- package/lib/typescript.js +726 -467
- package/lib/typingsInstaller.js +23 -25
- package/package.json +28 -28
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-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240120`;
|
|
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"] =
|
|
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) => {
|
|
@@ -6006,7 +6007,7 @@ var Diagnostics = {
|
|
|
6006
6007
|
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
6008
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
6008
6009
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
6009
|
-
|
|
6010
|
+
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
6011
|
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
6012
|
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
6013
|
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 +6058,7 @@ var Diagnostics = {
|
|
|
6057
6058
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
6058
6059
|
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
6060
|
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
|
-
|
|
6061
|
+
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
6062
|
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
6063
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
6063
6064
|
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 +6641,9 @@ var Diagnostics = {
|
|
|
6640
6641
|
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
6642
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
6642
6643
|
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
|
-
|
|
6644
|
+
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
6645
|
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
|
-
|
|
6646
|
+
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
6647
|
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
6648
|
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
6649
|
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 +6663,7 @@ var Diagnostics = {
|
|
|
6662
6663
|
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
6664
|
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
6665
|
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
|
-
|
|
6666
|
+
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
6667
|
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
6668
|
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
6669
|
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 +6819,7 @@ var Diagnostics = {
|
|
|
6818
6819
|
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
6820
|
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
6821
|
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
|
-
|
|
6822
|
+
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
6823
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
6823
6824
|
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
6825
|
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 +6842,7 @@ var Diagnostics = {
|
|
|
6841
6842
|
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
6843
|
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
6844
|
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
|
-
|
|
6845
|
+
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
6846
|
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
6847
|
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
6848
|
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 +7762,12 @@ var Diagnostics = {
|
|
|
7761
7762
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
7762
7763
|
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
7764
|
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}'."),
|
|
7765
|
+
Add_missing_parameter_to_0: diag(95188, 3 /* Message */, "Add_missing_parameter_to_0_95188", "Add missing parameter to '{0}'"),
|
|
7766
|
+
Add_missing_parameters_to_0: diag(95189, 3 /* Message */, "Add_missing_parameters_to_0_95189", "Add missing parameters to '{0}'"),
|
|
7767
|
+
Add_all_missing_parameters: diag(95190, 3 /* Message */, "Add_all_missing_parameters_95190", "Add all missing parameters"),
|
|
7768
|
+
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
7769
|
+
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
7770
|
+
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
7764
7771
|
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
7772
|
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
7773
|
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 +11590,12 @@ function packageIdToString(packageId) {
|
|
|
11583
11590
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
11584
11591
|
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
11592
|
}
|
|
11586
|
-
function hasChangesInResolutions(names,
|
|
11593
|
+
function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
|
|
11587
11594
|
Debug.assert(names.length === newResolutions.length);
|
|
11588
11595
|
for (let i = 0; i < names.length; i++) {
|
|
11589
11596
|
const newResolution = newResolutions[i];
|
|
11590
11597
|
const entry = names[i];
|
|
11591
|
-
const
|
|
11592
|
-
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
11593
|
-
const oldResolution = getOldResolution(name, mode);
|
|
11598
|
+
const oldResolution = getOldResolution(entry);
|
|
11594
11599
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
11595
11600
|
if (changed) {
|
|
11596
11601
|
return true;
|
|
@@ -16443,6 +16448,9 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
16443
16448
|
case 199 /* NodeNext */:
|
|
16444
16449
|
moduleResolution = 99 /* NodeNext */;
|
|
16445
16450
|
break;
|
|
16451
|
+
case 200 /* Preserve */:
|
|
16452
|
+
moduleResolution = 100 /* Bundler */;
|
|
16453
|
+
break;
|
|
16446
16454
|
default:
|
|
16447
16455
|
moduleResolution = 1 /* Classic */;
|
|
16448
16456
|
break;
|
|
@@ -16472,6 +16480,7 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
16472
16480
|
switch (computedOptions.module.computeValue(compilerOptions)) {
|
|
16473
16481
|
case 100 /* Node16 */:
|
|
16474
16482
|
case 199 /* NodeNext */:
|
|
16483
|
+
case 200 /* Preserve */:
|
|
16475
16484
|
return true;
|
|
16476
16485
|
}
|
|
16477
16486
|
return false;
|
|
@@ -16639,18 +16648,12 @@ function emitModuleKindIsNonNodeESM(moduleKind) {
|
|
|
16639
16648
|
}
|
|
16640
16649
|
function hasJsonModuleEmitEnabled(options) {
|
|
16641
16650
|
switch (getEmitModuleKind(options)) {
|
|
16642
|
-
case
|
|
16643
|
-
case
|
|
16644
|
-
case
|
|
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:
|
|
16651
|
+
case 0 /* None */:
|
|
16652
|
+
case 4 /* System */:
|
|
16653
|
+
case 3 /* UMD */:
|
|
16652
16654
|
return false;
|
|
16653
16655
|
}
|
|
16656
|
+
return true;
|
|
16654
16657
|
}
|
|
16655
16658
|
function unreachableCodeIsError(options) {
|
|
16656
16659
|
return options.allowUnreachableCode === false;
|
|
@@ -16661,9 +16664,6 @@ function unusedLabelIsError(options) {
|
|
|
16661
16664
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
16662
16665
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
16663
16666
|
}
|
|
16664
|
-
function shouldResolveJsRequire(compilerOptions) {
|
|
16665
|
-
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
16666
|
-
}
|
|
16667
16667
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
16668
16668
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
16669
16669
|
}
|
|
@@ -16827,7 +16827,7 @@ function getPatternFromSpec(spec, basePath, usage) {
|
|
|
16827
16827
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
|
16828
16828
|
return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`;
|
|
16829
16829
|
}
|
|
16830
|
-
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 }) {
|
|
16830
|
+
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
|
16831
16831
|
let subpattern = "";
|
|
16832
16832
|
let hasWrittenComponent = false;
|
|
16833
16833
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
@@ -17040,7 +17040,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
17040
17040
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
17041
17041
|
}
|
|
17042
17042
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
17043
|
-
|
|
17043
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
17044
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
17044
17045
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
17045
17046
|
return 2 /* JsExtension */;
|
|
17046
17047
|
}
|
|
@@ -24624,6 +24625,9 @@ function isOmittedExpression(node) {
|
|
|
24624
24625
|
function isExpressionWithTypeArguments(node) {
|
|
24625
24626
|
return node.kind === 233 /* ExpressionWithTypeArguments */;
|
|
24626
24627
|
}
|
|
24628
|
+
function isSatisfiesExpression(node) {
|
|
24629
|
+
return node.kind === 238 /* SatisfiesExpression */;
|
|
24630
|
+
}
|
|
24627
24631
|
function isNonNullExpression(node) {
|
|
24628
24632
|
return node.kind === 235 /* NonNullExpression */;
|
|
24629
24633
|
}
|
|
@@ -34429,7 +34433,8 @@ var moduleOptionDeclaration = {
|
|
|
34429
34433
|
es2022: 7 /* ES2022 */,
|
|
34430
34434
|
esnext: 99 /* ESNext */,
|
|
34431
34435
|
node16: 100 /* Node16 */,
|
|
34432
|
-
nodenext: 199 /* NodeNext
|
|
34436
|
+
nodenext: 199 /* NodeNext */,
|
|
34437
|
+
preserve: 200 /* Preserve */
|
|
34433
34438
|
})),
|
|
34434
34439
|
affectsSourceFile: true,
|
|
34435
34440
|
affectsModuleResolution: true,
|
|
@@ -38027,20 +38032,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
38027
38032
|
} else {
|
|
38028
38033
|
let moduleResolution = compilerOptions.moduleResolution;
|
|
38029
38034
|
if (moduleResolution === void 0) {
|
|
38030
|
-
|
|
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
|
-
}
|
|
38035
|
+
moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
38044
38036
|
if (traceEnabled) {
|
|
38045
38037
|
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
|
38046
38038
|
}
|
|
@@ -41772,7 +41764,7 @@ function createBinder() {
|
|
|
41772
41764
|
} else if (isJsonSourceFile(file)) {
|
|
41773
41765
|
bindSourceFileAsExternalModule();
|
|
41774
41766
|
const originalSymbol = file.symbol;
|
|
41775
|
-
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */,
|
|
41767
|
+
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, -1 /* All */);
|
|
41776
41768
|
file.symbol = originalSymbol;
|
|
41777
41769
|
}
|
|
41778
41770
|
}
|
|
@@ -41784,7 +41776,7 @@ function createBinder() {
|
|
|
41784
41776
|
bindAnonymousDeclaration(node, 111551 /* Value */, getDeclarationName(node));
|
|
41785
41777
|
} else {
|
|
41786
41778
|
const flags = exportAssignmentIsAlias(node) ? 2097152 /* Alias */ : 4 /* Property */;
|
|
41787
|
-
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags,
|
|
41779
|
+
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, -1 /* All */);
|
|
41788
41780
|
if (node.isExportEquals) {
|
|
41789
41781
|
setValueDeclaration(symbol, node);
|
|
41790
41782
|
}
|
|
@@ -42237,7 +42229,7 @@ function createBinder() {
|
|
|
42237
42229
|
}
|
|
42238
42230
|
if (!isBindingPattern(node.name)) {
|
|
42239
42231
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
42240
|
-
if (isInJSFile(node) &&
|
|
42232
|
+
if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
42241
42233
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
42242
42234
|
} else if (isBlockOrCatchScoped(node)) {
|
|
42243
42235
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -42766,7 +42758,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
42766
42758
|
(reason) => {
|
|
42767
42759
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
42768
42760
|
return void 0;
|
|
42769
|
-
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
|
|
42761
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
|
|
42770
42762
|
return void 0;
|
|
42771
42763
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
42772
42764
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
@@ -44359,14 +44351,6 @@ function createTypeChecker(host) {
|
|
|
44359
44351
|
emptyArray,
|
|
44360
44352
|
emptyArray
|
|
44361
44353
|
);
|
|
44362
|
-
var resolvingApparentMappedType = createAnonymousType(
|
|
44363
|
-
/*symbol*/
|
|
44364
|
-
void 0,
|
|
44365
|
-
emptySymbols,
|
|
44366
|
-
emptyArray,
|
|
44367
|
-
emptyArray,
|
|
44368
|
-
emptyArray
|
|
44369
|
-
);
|
|
44370
44354
|
var markerSuperType = createTypeParameter();
|
|
44371
44355
|
var markerSubType = createTypeParameter();
|
|
44372
44356
|
markerSubType.constraint = markerSuperType;
|
|
@@ -46022,7 +46006,7 @@ function createTypeChecker(host) {
|
|
|
46022
46006
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
46023
46007
|
}
|
|
46024
46008
|
function getUsageModeForExpression(usage) {
|
|
46025
|
-
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
46009
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
46026
46010
|
}
|
|
46027
46011
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
46028
46012
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
@@ -46033,7 +46017,7 @@ function createTypeChecker(host) {
|
|
|
46033
46017
|
}
|
|
46034
46018
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
46035
46019
|
const usageMode = file && getUsageModeForExpression(usage);
|
|
46036
|
-
if (file && usageMode !== void 0) {
|
|
46020
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
46037
46021
|
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
46038
46022
|
if (usageMode === 99 /* ESNext */ || result) {
|
|
46039
46023
|
return result;
|
|
@@ -46566,7 +46550,7 @@ function createTypeChecker(host) {
|
|
|
46566
46550
|
break;
|
|
46567
46551
|
}
|
|
46568
46552
|
if (target === unknownSymbol) {
|
|
46569
|
-
return
|
|
46553
|
+
return -1 /* All */;
|
|
46570
46554
|
}
|
|
46571
46555
|
if (target === symbol || (seenSymbols == null ? void 0 : seenSymbols.has(target))) {
|
|
46572
46556
|
break;
|
|
@@ -46927,8 +46911,12 @@ function createTypeChecker(host) {
|
|
|
46927
46911
|
return ambientModule;
|
|
46928
46912
|
}
|
|
46929
46913
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
46930
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a =
|
|
46931
|
-
|
|
46914
|
+
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(
|
|
46915
|
+
location.initializer,
|
|
46916
|
+
/*requireStringLiteralLikeArgument*/
|
|
46917
|
+
true
|
|
46918
|
+
) ? 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);
|
|
46919
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
46932
46920
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
46933
46921
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
46934
46922
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -50082,7 +50070,7 @@ function createTypeChecker(host) {
|
|
|
50082
50070
|
}
|
|
50083
50071
|
const sym = resolveEntityName(
|
|
50084
50072
|
leftmost,
|
|
50085
|
-
|
|
50073
|
+
-1 /* All */,
|
|
50086
50074
|
/*ignoreErrors*/
|
|
50087
50075
|
true,
|
|
50088
50076
|
/*dontResolveAlias*/
|
|
@@ -50092,13 +50080,13 @@ function createTypeChecker(host) {
|
|
|
50092
50080
|
if (isSymbolAccessible(
|
|
50093
50081
|
sym,
|
|
50094
50082
|
context.enclosingDeclaration,
|
|
50095
|
-
|
|
50083
|
+
-1 /* All */,
|
|
50096
50084
|
/*shouldComputeAliasesToMakeVisible*/
|
|
50097
50085
|
false
|
|
50098
50086
|
).accessibility !== 0 /* Accessible */) {
|
|
50099
50087
|
introducesError = true;
|
|
50100
50088
|
} else {
|
|
50101
|
-
context.tracker.trackSymbol(sym, context.enclosingDeclaration,
|
|
50089
|
+
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
50102
50090
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
50103
50091
|
}
|
|
50104
50092
|
if (isIdentifier(node)) {
|
|
@@ -51210,7 +51198,7 @@ function createTypeChecker(host) {
|
|
|
51210
51198
|
isLocalImport ? symbolToName(
|
|
51211
51199
|
target,
|
|
51212
51200
|
context,
|
|
51213
|
-
|
|
51201
|
+
-1 /* All */,
|
|
51214
51202
|
/*expectsIdentifier*/
|
|
51215
51203
|
false
|
|
51216
51204
|
) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
|
|
@@ -51369,7 +51357,7 @@ function createTypeChecker(host) {
|
|
|
51369
51357
|
const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0;
|
|
51370
51358
|
const referenced = first2 && resolveEntityName(
|
|
51371
51359
|
first2,
|
|
51372
|
-
|
|
51360
|
+
-1 /* All */,
|
|
51373
51361
|
/*ignoreErrors*/
|
|
51374
51362
|
true,
|
|
51375
51363
|
/*dontResolveAlias*/
|
|
@@ -51386,7 +51374,7 @@ function createTypeChecker(host) {
|
|
|
51386
51374
|
/*modifiers*/
|
|
51387
51375
|
void 0,
|
|
51388
51376
|
isExportEquals,
|
|
51389
|
-
symbolToExpression(target, context,
|
|
51377
|
+
symbolToExpression(target, context, -1 /* All */)
|
|
51390
51378
|
));
|
|
51391
51379
|
} else {
|
|
51392
51380
|
if (first2 === expr && first2) {
|
|
@@ -51405,7 +51393,7 @@ function createTypeChecker(host) {
|
|
|
51405
51393
|
symbolToName(
|
|
51406
51394
|
target,
|
|
51407
51395
|
context,
|
|
51408
|
-
|
|
51396
|
+
-1 /* All */,
|
|
51409
51397
|
/*expectsIdentifier*/
|
|
51410
51398
|
false
|
|
51411
51399
|
)
|
|
@@ -55318,30 +55306,14 @@ function createTypeChecker(host) {
|
|
|
55318
55306
|
return !!(typeParameter.symbol && forEach(typeParameter.symbol.declarations, (decl) => isTypeParameterDeclaration(decl) && decl.default));
|
|
55319
55307
|
}
|
|
55320
55308
|
function getApparentTypeOfMappedType(type) {
|
|
55321
|
-
|
|
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);
|
|
55309
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
55329
55310
|
}
|
|
55330
55311
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
55331
|
-
const
|
|
55332
|
-
|
|
55333
|
-
|
|
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
|
-
}
|
|
55312
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
55313
|
+
if (typeVariable && !type.declaration.nameType) {
|
|
55314
|
+
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
55343
55315
|
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
55344
|
-
return instantiateType(
|
|
55316
|
+
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
55345
55317
|
}
|
|
55346
55318
|
}
|
|
55347
55319
|
return type;
|
|
@@ -56665,7 +56637,7 @@ function createTypeChecker(host) {
|
|
|
56665
56637
|
if (constraint) {
|
|
56666
56638
|
constraints = append(constraints, constraint);
|
|
56667
56639
|
}
|
|
56668
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && node === parent.type) {
|
|
56640
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent.kind === 200 /* MappedType */ && !parent.nameType && node === parent.type) {
|
|
56669
56641
|
const mappedType = getTypeFromTypeNode(parent);
|
|
56670
56642
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
56671
56643
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -59725,11 +59697,8 @@ function createTypeChecker(host) {
|
|
|
59725
59697
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
59726
59698
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
59727
59699
|
}
|
|
59728
|
-
if (isGenericTupleType(t)) {
|
|
59729
|
-
return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
|
|
59730
|
-
}
|
|
59731
59700
|
if (isTupleType(t)) {
|
|
59732
|
-
return instantiateMappedTupleType(t, type,
|
|
59701
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
59733
59702
|
}
|
|
59734
59703
|
}
|
|
59735
59704
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
@@ -59746,17 +59715,18 @@ function createTypeChecker(host) {
|
|
|
59746
59715
|
function getModifiedReadonlyState(state, modifiers) {
|
|
59747
59716
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
59748
59717
|
}
|
|
59749
|
-
function
|
|
59718
|
+
function instantiateMappedTupleType(tupleType, mappedType, typeVariable, mapper) {
|
|
59750
59719
|
const elementFlags = tupleType.target.elementFlags;
|
|
59751
|
-
const
|
|
59752
|
-
|
|
59753
|
-
|
|
59754
|
-
|
|
59755
|
-
|
|
59756
|
-
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
59720
|
+
const fixedLength = tupleType.target.fixedLength;
|
|
59721
|
+
const fixedMapper = fixedLength ? prependTypeMapping(typeVariable, tupleType, mapper) : mapper;
|
|
59722
|
+
const newElementTypes = map(getElementTypes(tupleType), (type, i) => {
|
|
59723
|
+
const flags = elementFlags[i];
|
|
59724
|
+
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
59725
|
});
|
|
59726
|
+
const modifiers = getMappedTypeModifiers(mappedType);
|
|
59727
|
+
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
59728
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
59759
|
-
return
|
|
59729
|
+
return contains(newElementTypes, errorType) ? errorType : createTupleType(newElementTypes, newElementFlags, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
59760
59730
|
}
|
|
59761
59731
|
function instantiateMappedArrayType(arrayType, mappedType, mapper) {
|
|
59762
59732
|
const elementType = instantiateMappedTypeTemplate(
|
|
@@ -59768,14 +59738,6 @@ function createTypeChecker(host) {
|
|
|
59768
59738
|
);
|
|
59769
59739
|
return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
|
|
59770
59740
|
}
|
|
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
59741
|
function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
|
|
59780
59742
|
const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
|
|
59781
59743
|
const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
|
|
@@ -60547,7 +60509,8 @@ function createTypeChecker(host) {
|
|
|
60547
60509
|
if (isOmittedExpression(elem))
|
|
60548
60510
|
continue;
|
|
60549
60511
|
const nameType = getNumberLiteralType(i);
|
|
60550
|
-
|
|
60512
|
+
const checkNode = getEffectiveCheckNode(elem);
|
|
60513
|
+
yield { errorNode: checkNode, innerExpression: checkNode, nameType };
|
|
60551
60514
|
}
|
|
60552
60515
|
}
|
|
60553
60516
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
@@ -70053,7 +70016,12 @@ function createTypeChecker(host) {
|
|
|
70053
70016
|
}
|
|
70054
70017
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
70055
70018
|
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
|
|
70019
|
+
const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
|
|
70020
|
+
const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
|
|
70021
|
+
if (specifier) {
|
|
70022
|
+
Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
|
|
70023
|
+
}
|
|
70024
|
+
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
70057
70025
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
70058
70026
|
if (links) {
|
|
70059
70027
|
links.jsxImplicitImportContainer = result || false;
|
|
@@ -70296,7 +70264,7 @@ function createTypeChecker(host) {
|
|
|
70296
70264
|
);
|
|
70297
70265
|
}
|
|
70298
70266
|
if (jsxFactorySym) {
|
|
70299
|
-
jsxFactorySym.isReferenced =
|
|
70267
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
70300
70268
|
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
70301
70269
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
70302
70270
|
}
|
|
@@ -71136,7 +71104,7 @@ function createTypeChecker(host) {
|
|
|
71136
71104
|
return;
|
|
71137
71105
|
}
|
|
71138
71106
|
}
|
|
71139
|
-
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced =
|
|
71107
|
+
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = -1 /* All */;
|
|
71140
71108
|
}
|
|
71141
71109
|
function isSelfTypeAccess(name, parent) {
|
|
71142
71110
|
return name.kind === 110 /* ThisKeyword */ || !!parent && isEntityNameExpression(name) && parent === getResolvedSymbol(getFirstIdentifier(name));
|
|
@@ -71699,6 +71667,10 @@ function createTypeChecker(host) {
|
|
|
71699
71667
|
return false;
|
|
71700
71668
|
}
|
|
71701
71669
|
}
|
|
71670
|
+
function getEffectiveCheckNode(argument) {
|
|
71671
|
+
argument = skipParentheses(argument);
|
|
71672
|
+
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
71673
|
+
}
|
|
71702
71674
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
71703
71675
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
71704
71676
|
if (isJsxOpeningLikeElement(node)) {
|
|
@@ -71734,7 +71706,8 @@ function createTypeChecker(host) {
|
|
|
71734
71706
|
checkMode
|
|
71735
71707
|
);
|
|
71736
71708
|
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
71737
|
-
|
|
71709
|
+
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
71710
|
+
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
71738
71711
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
71739
71712
|
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
|
71740
71713
|
return errorOutputContainer.errors || emptyArray;
|
|
@@ -71752,7 +71725,7 @@ function createTypeChecker(host) {
|
|
|
71752
71725
|
checkMode
|
|
71753
71726
|
);
|
|
71754
71727
|
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);
|
|
71728
|
+
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
71729
|
if (!checkTypeRelatedTo(
|
|
71757
71730
|
spreadType,
|
|
71758
71731
|
restType,
|
|
@@ -73094,7 +73067,7 @@ function createTypeChecker(host) {
|
|
|
73094
73067
|
return anyType;
|
|
73095
73068
|
}
|
|
73096
73069
|
}
|
|
73097
|
-
if (isInJSFile(node) &&
|
|
73070
|
+
if (isInJSFile(node) && isCommonJsRequire(node)) {
|
|
73098
73071
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
73099
73072
|
}
|
|
73100
73073
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -74574,17 +74547,18 @@ function createTypeChecker(host) {
|
|
|
74574
74547
|
const exprType = checkExpression(node.body);
|
|
74575
74548
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
|
74576
74549
|
if (returnOrPromisedType) {
|
|
74550
|
+
const effectiveCheckNode = getEffectiveCheckNode(node.body);
|
|
74577
74551
|
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
74578
74552
|
const awaitedType = checkAwaitedType(
|
|
74579
74553
|
exprType,
|
|
74580
74554
|
/*withAlias*/
|
|
74581
74555
|
false,
|
|
74582
|
-
|
|
74556
|
+
effectiveCheckNode,
|
|
74583
74557
|
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
74584
74558
|
);
|
|
74585
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType,
|
|
74559
|
+
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
74586
74560
|
} else {
|
|
74587
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType,
|
|
74561
|
+
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
74588
74562
|
}
|
|
74589
74563
|
}
|
|
74590
74564
|
}
|
|
@@ -74746,13 +74720,14 @@ function createTypeChecker(host) {
|
|
|
74746
74720
|
}
|
|
74747
74721
|
case 7 /* ES2022 */:
|
|
74748
74722
|
case 99 /* ESNext */:
|
|
74723
|
+
case 200 /* Preserve */:
|
|
74749
74724
|
case 4 /* System */:
|
|
74750
74725
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
74751
74726
|
break;
|
|
74752
74727
|
}
|
|
74753
74728
|
default:
|
|
74754
74729
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
74755
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
|
74730
|
+
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
74731
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
|
74757
74732
|
hasError = true;
|
|
74758
74733
|
break;
|
|
@@ -77000,11 +76975,10 @@ function createTypeChecker(host) {
|
|
|
77000
76975
|
checkSourceElement(node.elementType);
|
|
77001
76976
|
}
|
|
77002
76977
|
function checkTupleType(node) {
|
|
77003
|
-
const elementTypes = node.elements;
|
|
77004
76978
|
let seenOptionalElement = false;
|
|
77005
76979
|
let seenRestElement = false;
|
|
77006
|
-
for (const e of
|
|
77007
|
-
|
|
76980
|
+
for (const e of node.elements) {
|
|
76981
|
+
let flags = getTupleElementFlags(e);
|
|
77008
76982
|
if (flags & 8 /* Variadic */) {
|
|
77009
76983
|
const type = getTypeFromTypeNode(e.type);
|
|
77010
76984
|
if (!isArrayLikeType(type)) {
|
|
@@ -77012,9 +76986,10 @@ function createTypeChecker(host) {
|
|
|
77012
76986
|
break;
|
|
77013
76987
|
}
|
|
77014
76988
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
77015
|
-
|
|
76989
|
+
flags |= 4 /* Rest */;
|
|
77016
76990
|
}
|
|
77017
|
-
}
|
|
76991
|
+
}
|
|
76992
|
+
if (flags & 4 /* Rest */) {
|
|
77018
76993
|
if (seenRestElement) {
|
|
77019
76994
|
grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
|
|
77020
76995
|
break;
|
|
@@ -77026,7 +77001,7 @@ function createTypeChecker(host) {
|
|
|
77026
77001
|
break;
|
|
77027
77002
|
}
|
|
77028
77003
|
seenOptionalElement = true;
|
|
77029
|
-
} else if (seenOptionalElement) {
|
|
77004
|
+
} else if (flags & 1 /* Required */ && seenOptionalElement) {
|
|
77030
77005
|
grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
|
|
77031
77006
|
break;
|
|
77032
77007
|
}
|
|
@@ -81267,8 +81242,8 @@ function createTypeChecker(host) {
|
|
|
81267
81242
|
return;
|
|
81268
81243
|
}
|
|
81269
81244
|
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.
|
|
81245
|
+
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
81246
|
+
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
81247
|
return grammarErrorOnNode(node, message);
|
|
81273
81248
|
}
|
|
81274
81249
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
@@ -81340,7 +81315,7 @@ function createTypeChecker(host) {
|
|
|
81340
81315
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
81341
81316
|
}
|
|
81342
81317
|
} else {
|
|
81343
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
81318
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
81344
81319
|
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
81320
|
}
|
|
81346
81321
|
}
|
|
@@ -81501,7 +81476,7 @@ function createTypeChecker(host) {
|
|
|
81501
81476
|
const id = node.expression;
|
|
81502
81477
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
81503
81478
|
id,
|
|
81504
|
-
|
|
81479
|
+
-1 /* All */,
|
|
81505
81480
|
/*ignoreErrors*/
|
|
81506
81481
|
true,
|
|
81507
81482
|
/*dontResolveAlias*/
|
|
@@ -81575,7 +81550,7 @@ function createTypeChecker(host) {
|
|
|
81575
81550
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
81576
81551
|
}
|
|
81577
81552
|
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 */)) {
|
|
81553
|
+
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
81554
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
81580
81555
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
81581
81556
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -82567,7 +82542,7 @@ function createTypeChecker(host) {
|
|
|
82567
82542
|
return void 0;
|
|
82568
82543
|
case 11 /* StringLiteral */:
|
|
82569
82544
|
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) &&
|
|
82545
|
+
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
82546
|
node.parent,
|
|
82572
82547
|
/*requireStringLiteralLikeArgument*/
|
|
82573
82548
|
false
|
|
@@ -84629,7 +84604,7 @@ function createTypeChecker(host) {
|
|
|
84629
84604
|
}
|
|
84630
84605
|
default:
|
|
84631
84606
|
diagnostics.add(
|
|
84632
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
|
84607
|
+
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
84608
|
);
|
|
84634
84609
|
break;
|
|
84635
84610
|
}
|
|
@@ -107974,7 +107949,7 @@ function transformECMAScriptModule(context) {
|
|
|
107974
107949
|
setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
|
|
107975
107950
|
);
|
|
107976
107951
|
}
|
|
107977
|
-
if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
|
|
107952
|
+
if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
|
|
107978
107953
|
return result;
|
|
107979
107954
|
}
|
|
107980
107955
|
return factory2.updateSourceFile(
|
|
@@ -108017,6 +107992,14 @@ function transformECMAScriptModule(context) {
|
|
|
108017
107992
|
if (moduleName) {
|
|
108018
107993
|
args.push(moduleName);
|
|
108019
107994
|
}
|
|
107995
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
107996
|
+
return factory2.createCallExpression(
|
|
107997
|
+
factory2.createIdentifier("require"),
|
|
107998
|
+
/*typeArguments*/
|
|
107999
|
+
void 0,
|
|
108000
|
+
args
|
|
108001
|
+
);
|
|
108002
|
+
}
|
|
108020
108003
|
if (!importRequireStatements) {
|
|
108021
108004
|
const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
108022
108005
|
const importStatement = factory2.createImportDeclaration(
|
|
@@ -108131,7 +108114,25 @@ function transformECMAScriptModule(context) {
|
|
|
108131
108114
|
return statements;
|
|
108132
108115
|
}
|
|
108133
108116
|
function visitExportAssignment(node) {
|
|
108134
|
-
|
|
108117
|
+
if (node.isExportEquals) {
|
|
108118
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
108119
|
+
const statement = setOriginalNode(
|
|
108120
|
+
factory2.createExpressionStatement(
|
|
108121
|
+
factory2.createAssignment(
|
|
108122
|
+
factory2.createPropertyAccessExpression(
|
|
108123
|
+
factory2.createIdentifier("module"),
|
|
108124
|
+
"exports"
|
|
108125
|
+
),
|
|
108126
|
+
node.expression
|
|
108127
|
+
)
|
|
108128
|
+
),
|
|
108129
|
+
node
|
|
108130
|
+
);
|
|
108131
|
+
return statement;
|
|
108132
|
+
}
|
|
108133
|
+
return void 0;
|
|
108134
|
+
}
|
|
108135
|
+
return node;
|
|
108135
108136
|
}
|
|
108136
108137
|
function visitExportDeclaration(node) {
|
|
108137
108138
|
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
|
|
@@ -108592,7 +108593,7 @@ function transformDeclarations(context) {
|
|
|
108592
108593
|
}
|
|
108593
108594
|
}
|
|
108594
108595
|
function trackReferencedAmbientModule(node, symbol) {
|
|
108595
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol,
|
|
108596
|
+
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
108596
108597
|
if (length(directives)) {
|
|
108597
108598
|
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
108598
108599
|
}
|
|
@@ -110258,6 +110259,7 @@ function getModuleTransformer(moduleKind) {
|
|
|
110258
110259
|
case 7 /* ES2022 */:
|
|
110259
110260
|
case 6 /* ES2020 */:
|
|
110260
110261
|
case 5 /* ES2015 */:
|
|
110262
|
+
case 200 /* Preserve */:
|
|
110261
110263
|
return transformECMAScriptModule;
|
|
110262
110264
|
case 4 /* System */:
|
|
110263
110265
|
return transformSystemModule;
|
|
@@ -117031,8 +117033,8 @@ function flattenDiagnosticMessageText(diag2, newLine, indent2 = 0) {
|
|
|
117031
117033
|
function getModeForFileReference(ref, containingFileMode) {
|
|
117032
117034
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
117033
117035
|
}
|
|
117034
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
117035
|
-
return
|
|
117036
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
117037
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
117036
117038
|
}
|
|
117037
117039
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
117038
117040
|
var _a;
|
|
@@ -117044,7 +117046,10 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
117044
117046
|
}
|
|
117045
117047
|
return false;
|
|
117046
117048
|
}
|
|
117047
|
-
function getModeForUsageLocation(file, usage) {
|
|
117049
|
+
function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
117050
|
+
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
117051
|
+
}
|
|
117052
|
+
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
117048
117053
|
var _a;
|
|
117049
117054
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
117050
117055
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
@@ -117061,6 +117066,13 @@ function getModeForUsageLocation(file, usage) {
|
|
|
117061
117066
|
return override;
|
|
117062
117067
|
}
|
|
117063
117068
|
}
|
|
117069
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
117070
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
117071
|
+
usage.parent,
|
|
117072
|
+
/*requireStringLiteralLikeArgument*/
|
|
117073
|
+
false
|
|
117074
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
117075
|
+
}
|
|
117064
117076
|
if (file.impliedNodeFormat === void 0)
|
|
117065
117077
|
return void 0;
|
|
117066
117078
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
@@ -117106,7 +117118,7 @@ function getModuleResolutionName(literal) {
|
|
|
117106
117118
|
}
|
|
117107
117119
|
var moduleResolutionNameAndModeGetter = {
|
|
117108
117120
|
getName: getModuleResolutionName,
|
|
117109
|
-
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
117121
|
+
getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
|
|
117110
117122
|
};
|
|
117111
117123
|
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
117112
117124
|
return {
|
|
@@ -117151,7 +117163,7 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
|
117151
117163
|
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
117152
117164
|
for (const entry of entries) {
|
|
117153
117165
|
const name = loader.nameAndMode.getName(entry);
|
|
117154
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
117166
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
117155
117167
|
const key = createModeAwareCacheKey(name, mode);
|
|
117156
117168
|
let result = cache.get(key);
|
|
117157
117169
|
if (!result) {
|
|
@@ -117237,7 +117249,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
117237
117249
|
switch (kind) {
|
|
117238
117250
|
case 3 /* Import */:
|
|
117239
117251
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
117240
|
-
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text,
|
|
117252
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, program.getModeForUsageLocation(file, importLiteral))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
117241
117253
|
if (importLiteral.pos === -1)
|
|
117242
117254
|
return { file, packageId, text: importLiteral.text };
|
|
117243
117255
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -117766,6 +117778,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117766
117778
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
117767
117779
|
isSourceFileFromExternalLibrary,
|
|
117768
117780
|
isSourceFileDefaultLibrary,
|
|
117781
|
+
getModeForUsageLocation: getModeForUsageLocation2,
|
|
117782
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
117769
117783
|
getSourceFileFromReference,
|
|
117770
117784
|
getLibFileFromReference,
|
|
117771
117785
|
sourceFileToPackageName,
|
|
@@ -117775,6 +117789,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117775
117789
|
resolvedTypeReferenceDirectiveNames,
|
|
117776
117790
|
resolvedLibReferences,
|
|
117777
117791
|
getResolvedModule,
|
|
117792
|
+
getResolvedModuleFromModuleSpecifier,
|
|
117778
117793
|
getResolvedTypeReferenceDirective,
|
|
117779
117794
|
forEachResolvedModule,
|
|
117780
117795
|
forEachResolvedTypeReferenceDirective,
|
|
@@ -117825,6 +117840,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117825
117840
|
var _a2;
|
|
117826
117841
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
117827
117842
|
}
|
|
117843
|
+
function getResolvedModuleFromModuleSpecifier(moduleSpecifier) {
|
|
117844
|
+
const sourceFile = getSourceFileOfNode(moduleSpecifier);
|
|
117845
|
+
Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode.");
|
|
117846
|
+
return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation2(sourceFile, moduleSpecifier));
|
|
117847
|
+
}
|
|
117828
117848
|
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
117829
117849
|
var _a2;
|
|
117830
117850
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
@@ -117997,8 +118017,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117997
118017
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
117998
118018
|
const moduleName = moduleNames[i];
|
|
117999
118019
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
118000
|
-
const
|
|
118001
|
-
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
118020
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
|
|
118002
118021
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
118003
118022
|
if (isTraceEnabled(options, host)) {
|
|
118004
118023
|
trace(
|
|
@@ -118046,7 +118065,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118046
118065
|
return result;
|
|
118047
118066
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
118048
118067
|
var _a2;
|
|
118049
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text,
|
|
118068
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
118050
118069
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
118051
118070
|
if (resolutionToFile && resolvedFile) {
|
|
118052
118071
|
return false;
|
|
@@ -118264,11 +118283,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118264
118283
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
118265
118284
|
const resolutionsChanged = hasChangesInResolutions(
|
|
118266
118285
|
moduleNames,
|
|
118267
|
-
newSourceFile,
|
|
118268
118286
|
resolutions,
|
|
118269
|
-
(name
|
|
118270
|
-
moduleResolutionIsEqualTo
|
|
118271
|
-
moduleResolutionNameAndModeGetter
|
|
118287
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation2(newSourceFile, name)),
|
|
118288
|
+
moduleResolutionIsEqualTo
|
|
118272
118289
|
);
|
|
118273
118290
|
if (resolutionsChanged)
|
|
118274
118291
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -118277,11 +118294,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118277
118294
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
118278
118295
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
118279
118296
|
typesReferenceDirectives,
|
|
118280
|
-
newSourceFile,
|
|
118281
118297
|
typeReferenceResolutions,
|
|
118282
|
-
(name
|
|
118283
|
-
typeDirectiveIsEqualTo
|
|
118284
|
-
typeReferenceResolutionNameAndModeGetter
|
|
118298
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)),
|
|
118299
|
+
typeDirectiveIsEqualTo
|
|
118285
118300
|
);
|
|
118286
118301
|
if (typeReferenceResolutionsChanged)
|
|
118287
118302
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -118948,8 +118963,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118948
118963
|
false
|
|
118949
118964
|
);
|
|
118950
118965
|
}
|
|
118951
|
-
|
|
118952
|
-
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
118966
|
+
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
118953
118967
|
collectDynamicImportOrRequireCalls(file);
|
|
118954
118968
|
}
|
|
118955
118969
|
file.imports = imports || emptyArray;
|
|
@@ -118998,7 +119012,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
118998
119012
|
const r = /import|require/g;
|
|
118999
119013
|
while (r.exec(file2.text) !== null) {
|
|
119000
119014
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
119001
|
-
if (
|
|
119015
|
+
if (isJavaScriptFile && isRequireCall(
|
|
119002
119016
|
node,
|
|
119003
119017
|
/*requireStringLiteralLikeArgument*/
|
|
119004
119018
|
true
|
|
@@ -119553,13 +119567,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119553
119567
|
const moduleNames = getModuleNames(file);
|
|
119554
119568
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
119555
119569
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
119556
|
-
const optionsForFile = (
|
|
119570
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
119557
119571
|
const resolutionsInFile = createModeAwareCache();
|
|
119558
119572
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
119559
119573
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
119560
119574
|
const resolution = resolutions[index].resolvedModule;
|
|
119561
119575
|
const moduleName = moduleNames[index].text;
|
|
119562
|
-
const mode =
|
|
119576
|
+
const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile);
|
|
119563
119577
|
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
119564
119578
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
119565
119579
|
if (!resolution) {
|
|
@@ -119839,7 +119853,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119839
119853
|
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
119840
119854
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
119841
119855
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
119842
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
119856
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
|
|
119843
119857
|
}
|
|
119844
119858
|
}
|
|
119845
119859
|
if (options.outDir || // there is --outDir specified
|
|
@@ -119903,7 +119917,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119903
119917
|
}
|
|
119904
119918
|
}
|
|
119905
119919
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
119906
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
119920
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
|
|
119907
119921
|
}
|
|
119908
119922
|
const moduleKind = getEmitModuleKind(options);
|
|
119909
119923
|
if (options.verbatimModuleSyntax) {
|
|
@@ -119930,8 +119944,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
119930
119944
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
119931
119945
|
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
119932
119946
|
}
|
|
119933
|
-
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
119934
|
-
createOptionValueDiagnostic("moduleResolution", Diagnostics.
|
|
119947
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
|
|
119948
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
|
|
119935
119949
|
}
|
|
119936
119950
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
119937
119951
|
const moduleKindName = ModuleKind[moduleKind];
|
|
@@ -120438,6 +120452,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120438
120452
|
}
|
|
120439
120453
|
return symlinks;
|
|
120440
120454
|
}
|
|
120455
|
+
function getModeForUsageLocation2(file, usage) {
|
|
120456
|
+
var _a2;
|
|
120457
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
120458
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
120459
|
+
}
|
|
120460
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
120461
|
+
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
120462
|
+
}
|
|
120441
120463
|
}
|
|
120442
120464
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
120443
120465
|
let setOfDeclarationDirectories;
|
|
@@ -122868,7 +122890,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122868
122890
|
const seenNamesInFile = createModeAwareCache();
|
|
122869
122891
|
for (const entry of entries) {
|
|
122870
122892
|
const name = loader.nameAndMode.getName(entry);
|
|
122871
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
122893
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
122872
122894
|
let resolution = resolutionsInFile.get(name, mode);
|
|
122873
122895
|
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
122874
122896
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
@@ -122909,7 +122931,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
122909
122931
|
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
122910
122932
|
(entry) => seenNamesInFile.set(
|
|
122911
122933
|
loader.nameAndMode.getName(entry),
|
|
122912
|
-
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
122934
|
+
loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
|
|
122913
122935
|
true
|
|
122914
122936
|
)
|
|
122915
122937
|
);
|