typescript 5.4.0-dev.20240118 → 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 +687 -435
- package/lib/typescript.d.ts +51 -11
- package/lib/typescript.js +730 -468
- package/lib/typingsInstaller.js +23 -25
- package/package.json +28 -28
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20240120`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4262,7 +4262,7 @@ ${lanes.join("\n")}
|
|
|
4262
4262
|
SymbolFlags3[SymbolFlags3["Transient"] = 33554432] = "Transient";
|
|
4263
4263
|
SymbolFlags3[SymbolFlags3["Assignment"] = 67108864] = "Assignment";
|
|
4264
4264
|
SymbolFlags3[SymbolFlags3["ModuleExports"] = 134217728] = "ModuleExports";
|
|
4265
|
-
SymbolFlags3[SymbolFlags3["All"] =
|
|
4265
|
+
SymbolFlags3[SymbolFlags3["All"] = -1] = "All";
|
|
4266
4266
|
SymbolFlags3[SymbolFlags3["Enum"] = 384] = "Enum";
|
|
4267
4267
|
SymbolFlags3[SymbolFlags3["Variable"] = 3] = "Variable";
|
|
4268
4268
|
SymbolFlags3[SymbolFlags3["Value"] = 111551] = "Value";
|
|
@@ -4684,6 +4684,7 @@ ${lanes.join("\n")}
|
|
|
4684
4684
|
ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
|
|
4685
4685
|
ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
|
|
4686
4686
|
ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
|
|
4687
|
+
ModuleKind3[ModuleKind3["Preserve"] = 200] = "Preserve";
|
|
4687
4688
|
return ModuleKind3;
|
|
4688
4689
|
})(ModuleKind || {});
|
|
4689
4690
|
JsxEmit = /* @__PURE__ */ ((JsxEmit3) => {
|
|
@@ -7343,7 +7344,7 @@ ${lanes.join("\n")}
|
|
|
7343
7344
|
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."),
|
|
7344
7345
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
7345
7346
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
7346
|
-
|
|
7347
|
+
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."),
|
|
7347
7348
|
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'."),
|
|
7348
7349
|
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'."),
|
|
7349
7350
|
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 `}`?"),
|
|
@@ -7394,7 +7395,7 @@ ${lanes.join("\n")}
|
|
|
7394
7395
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
7395
7396
|
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:"),
|
|
7396
7397
|
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."),
|
|
7397
|
-
|
|
7398
|
+
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."),
|
|
7398
7399
|
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."),
|
|
7399
7400
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
7400
7401
|
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}'?"),
|
|
@@ -7977,9 +7978,9 @@ ${lanes.join("\n")}
|
|
|
7977
7978
|
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."),
|
|
7978
7979
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
7979
7980
|
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}'?"),
|
|
7980
|
-
|
|
7981
|
+
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'."),
|
|
7981
7982
|
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."),
|
|
7982
|
-
|
|
7983
|
+
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'."),
|
|
7983
7984
|
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}'?"),
|
|
7984
7985
|
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."),
|
|
7985
7986
|
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}'?"),
|
|
@@ -7999,7 +8000,7 @@ ${lanes.join("\n")}
|
|
|
7999
8000
|
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'."),
|
|
8000
8001
|
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."),
|
|
8001
8002
|
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."),
|
|
8002
|
-
|
|
8003
|
+
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."),
|
|
8003
8004
|
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."),
|
|
8004
8005
|
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."),
|
|
8005
8006
|
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."),
|
|
@@ -8155,7 +8156,7 @@ ${lanes.join("\n")}
|
|
|
8155
8156
|
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."),
|
|
8156
8157
|
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}'."),
|
|
8157
8158
|
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'."),
|
|
8158
|
-
|
|
8159
|
+
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'."),
|
|
8159
8160
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
8160
8161
|
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}."),
|
|
8161
8162
|
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."),
|
|
@@ -8178,7 +8179,7 @@ ${lanes.join("\n")}
|
|
|
8178
8179
|
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."),
|
|
8179
8180
|
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'."),
|
|
8180
8181
|
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'."),
|
|
8181
|
-
|
|
8182
|
+
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."),
|
|
8182
8183
|
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."),
|
|
8183
8184
|
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."),
|
|
8184
8185
|
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'."),
|
|
@@ -9098,6 +9099,12 @@ ${lanes.join("\n")}
|
|
|
9098
9099
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
9099
9100
|
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."),
|
|
9100
9101
|
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}'."),
|
|
9102
|
+
Add_missing_parameter_to_0: diag(95188, 3 /* Message */, "Add_missing_parameter_to_0_95188", "Add missing parameter to '{0}'"),
|
|
9103
|
+
Add_missing_parameters_to_0: diag(95189, 3 /* Message */, "Add_missing_parameters_to_0_95189", "Add missing parameters to '{0}'"),
|
|
9104
|
+
Add_all_missing_parameters: diag(95190, 3 /* Message */, "Add_all_missing_parameters_95190", "Add all missing parameters"),
|
|
9105
|
+
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
9106
|
+
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
9107
|
+
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
9101
9108
|
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."),
|
|
9102
9109
|
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'."),
|
|
9103
9110
|
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?"),
|
|
@@ -13134,14 +13141,12 @@ ${lanes.join("\n")}
|
|
|
13134
13141
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
13135
13142
|
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;
|
|
13136
13143
|
}
|
|
13137
|
-
function hasChangesInResolutions(names,
|
|
13144
|
+
function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
|
|
13138
13145
|
Debug.assert(names.length === newResolutions.length);
|
|
13139
13146
|
for (let i = 0; i < names.length; i++) {
|
|
13140
13147
|
const newResolution = newResolutions[i];
|
|
13141
13148
|
const entry = names[i];
|
|
13142
|
-
const
|
|
13143
|
-
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
13144
|
-
const oldResolution = getOldResolution(name, mode);
|
|
13149
|
+
const oldResolution = getOldResolution(entry);
|
|
13145
13150
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
13146
13151
|
if (changed) {
|
|
13147
13152
|
return true;
|
|
@@ -17880,18 +17885,12 @@ ${lanes.join("\n")}
|
|
|
17880
17885
|
}
|
|
17881
17886
|
function hasJsonModuleEmitEnabled(options) {
|
|
17882
17887
|
switch (getEmitModuleKind(options)) {
|
|
17883
|
-
case
|
|
17884
|
-
case
|
|
17885
|
-
case
|
|
17886
|
-
case 6 /* ES2020 */:
|
|
17887
|
-
case 7 /* ES2022 */:
|
|
17888
|
-
case 99 /* ESNext */:
|
|
17889
|
-
case 100 /* Node16 */:
|
|
17890
|
-
case 199 /* NodeNext */:
|
|
17891
|
-
return true;
|
|
17892
|
-
default:
|
|
17888
|
+
case 0 /* None */:
|
|
17889
|
+
case 4 /* System */:
|
|
17890
|
+
case 3 /* UMD */:
|
|
17893
17891
|
return false;
|
|
17894
17892
|
}
|
|
17893
|
+
return true;
|
|
17895
17894
|
}
|
|
17896
17895
|
function importNameElisionDisabled(options) {
|
|
17897
17896
|
return options.verbatimModuleSyntax || options.isolatedModules && options.preserveValueImports;
|
|
@@ -17905,9 +17904,6 @@ ${lanes.join("\n")}
|
|
|
17905
17904
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
17906
17905
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
17907
17906
|
}
|
|
17908
|
-
function shouldResolveJsRequire(compilerOptions) {
|
|
17909
|
-
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
17910
|
-
}
|
|
17911
17907
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
17912
17908
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
17913
17909
|
}
|
|
@@ -18046,7 +18042,7 @@ ${lanes.join("\n")}
|
|
|
18046
18042
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
|
18047
18043
|
return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`;
|
|
18048
18044
|
}
|
|
18049
|
-
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 }) {
|
|
18045
|
+
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
|
18050
18046
|
let subpattern = "";
|
|
18051
18047
|
let hasWrittenComponent = false;
|
|
18052
18048
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
@@ -18248,7 +18244,8 @@ ${lanes.join("\n")}
|
|
|
18248
18244
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
18249
18245
|
}
|
|
18250
18246
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
18251
|
-
|
|
18247
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
18248
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
18252
18249
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
18253
18250
|
return 2 /* JsExtension */;
|
|
18254
18251
|
}
|
|
@@ -19487,6 +19484,9 @@ ${lanes.join("\n")}
|
|
|
19487
19484
|
case 199 /* NodeNext */:
|
|
19488
19485
|
moduleResolution = 99 /* NodeNext */;
|
|
19489
19486
|
break;
|
|
19487
|
+
case 200 /* Preserve */:
|
|
19488
|
+
moduleResolution = 100 /* Bundler */;
|
|
19489
|
+
break;
|
|
19490
19490
|
default:
|
|
19491
19491
|
moduleResolution = 1 /* Classic */;
|
|
19492
19492
|
break;
|
|
@@ -19516,6 +19516,7 @@ ${lanes.join("\n")}
|
|
|
19516
19516
|
switch (computedOptions.module.computeValue(compilerOptions)) {
|
|
19517
19517
|
case 100 /* Node16 */:
|
|
19518
19518
|
case 199 /* NodeNext */:
|
|
19519
|
+
case 200 /* Preserve */:
|
|
19519
19520
|
return true;
|
|
19520
19521
|
}
|
|
19521
19522
|
return false;
|
|
@@ -38362,7 +38363,8 @@ ${lanes.join("\n")}
|
|
|
38362
38363
|
es2022: 7 /* ES2022 */,
|
|
38363
38364
|
esnext: 99 /* ESNext */,
|
|
38364
38365
|
node16: 100 /* Node16 */,
|
|
38365
|
-
nodenext: 199 /* NodeNext
|
|
38366
|
+
nodenext: 199 /* NodeNext */,
|
|
38367
|
+
preserve: 200 /* Preserve */
|
|
38366
38368
|
})),
|
|
38367
38369
|
affectsSourceFile: true,
|
|
38368
38370
|
affectsModuleResolution: true,
|
|
@@ -40421,20 +40423,7 @@ ${lanes.join("\n")}
|
|
|
40421
40423
|
} else {
|
|
40422
40424
|
let moduleResolution = compilerOptions.moduleResolution;
|
|
40423
40425
|
if (moduleResolution === void 0) {
|
|
40424
|
-
|
|
40425
|
-
case 1 /* CommonJS */:
|
|
40426
|
-
moduleResolution = 2 /* Node10 */;
|
|
40427
|
-
break;
|
|
40428
|
-
case 100 /* Node16 */:
|
|
40429
|
-
moduleResolution = 3 /* Node16 */;
|
|
40430
|
-
break;
|
|
40431
|
-
case 199 /* NodeNext */:
|
|
40432
|
-
moduleResolution = 99 /* NodeNext */;
|
|
40433
|
-
break;
|
|
40434
|
-
default:
|
|
40435
|
-
moduleResolution = 1 /* Classic */;
|
|
40436
|
-
break;
|
|
40437
|
-
}
|
|
40426
|
+
moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
40438
40427
|
if (traceEnabled) {
|
|
40439
40428
|
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
|
40440
40429
|
}
|
|
@@ -44300,7 +44289,7 @@ ${lanes.join("\n")}
|
|
|
44300
44289
|
} else if (isJsonSourceFile(file)) {
|
|
44301
44290
|
bindSourceFileAsExternalModule();
|
|
44302
44291
|
const originalSymbol = file.symbol;
|
|
44303
|
-
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */,
|
|
44292
|
+
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, -1 /* All */);
|
|
44304
44293
|
file.symbol = originalSymbol;
|
|
44305
44294
|
}
|
|
44306
44295
|
}
|
|
@@ -44312,7 +44301,7 @@ ${lanes.join("\n")}
|
|
|
44312
44301
|
bindAnonymousDeclaration(node, 111551 /* Value */, getDeclarationName(node));
|
|
44313
44302
|
} else {
|
|
44314
44303
|
const flags = exportAssignmentIsAlias(node) ? 2097152 /* Alias */ : 4 /* Property */;
|
|
44315
|
-
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags,
|
|
44304
|
+
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, -1 /* All */);
|
|
44316
44305
|
if (node.isExportEquals) {
|
|
44317
44306
|
setValueDeclaration(symbol, node);
|
|
44318
44307
|
}
|
|
@@ -44765,7 +44754,7 @@ ${lanes.join("\n")}
|
|
|
44765
44754
|
}
|
|
44766
44755
|
if (!isBindingPattern(node.name)) {
|
|
44767
44756
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
44768
|
-
if (isInJSFile(node) &&
|
|
44757
|
+
if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
44769
44758
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
44770
44759
|
} else if (isBlockOrCatchScoped(node)) {
|
|
44771
44760
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -45357,7 +45346,7 @@ ${lanes.join("\n")}
|
|
|
45357
45346
|
(reason) => {
|
|
45358
45347
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
45359
45348
|
return void 0;
|
|
45360
|
-
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
|
|
45349
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
|
|
45361
45350
|
return void 0;
|
|
45362
45351
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
45363
45352
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
@@ -46120,7 +46109,7 @@ ${lanes.join("\n")}
|
|
|
46120
46109
|
var requestedExternalEmitHelpers;
|
|
46121
46110
|
var externalHelpersModule;
|
|
46122
46111
|
var Symbol47 = objectAllocator.getSymbolConstructor();
|
|
46123
|
-
var
|
|
46112
|
+
var Type28 = objectAllocator.getTypeConstructor();
|
|
46124
46113
|
var Signature14 = objectAllocator.getSignatureConstructor();
|
|
46125
46114
|
var typeCount = 0;
|
|
46126
46115
|
var symbolCount = 0;
|
|
@@ -46851,14 +46840,6 @@ ${lanes.join("\n")}
|
|
|
46851
46840
|
emptyArray,
|
|
46852
46841
|
emptyArray
|
|
46853
46842
|
);
|
|
46854
|
-
var resolvingApparentMappedType = createAnonymousType(
|
|
46855
|
-
/*symbol*/
|
|
46856
|
-
void 0,
|
|
46857
|
-
emptySymbols,
|
|
46858
|
-
emptyArray,
|
|
46859
|
-
emptyArray,
|
|
46860
|
-
emptyArray
|
|
46861
|
-
);
|
|
46862
46843
|
var markerSuperType = createTypeParameter();
|
|
46863
46844
|
var markerSubType = createTypeParameter();
|
|
46864
46845
|
markerSubType.constraint = markerSuperType;
|
|
@@ -47266,7 +47247,7 @@ ${lanes.join("\n")}
|
|
|
47266
47247
|
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
47267
47248
|
return symbol;
|
|
47268
47249
|
}
|
|
47269
|
-
function
|
|
47250
|
+
function createParameter2(name, type) {
|
|
47270
47251
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name);
|
|
47271
47252
|
symbol.links.type = type;
|
|
47272
47253
|
return symbol;
|
|
@@ -48514,7 +48495,7 @@ ${lanes.join("\n")}
|
|
|
48514
48495
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
48515
48496
|
}
|
|
48516
48497
|
function getUsageModeForExpression(usage) {
|
|
48517
|
-
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
48498
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
48518
48499
|
}
|
|
48519
48500
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
48520
48501
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
@@ -48525,7 +48506,7 @@ ${lanes.join("\n")}
|
|
|
48525
48506
|
}
|
|
48526
48507
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
48527
48508
|
const usageMode = file && getUsageModeForExpression(usage);
|
|
48528
|
-
if (file && usageMode !== void 0) {
|
|
48509
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
48529
48510
|
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
48530
48511
|
if (usageMode === 99 /* ESNext */ || result) {
|
|
48531
48512
|
return result;
|
|
@@ -49058,7 +49039,7 @@ ${lanes.join("\n")}
|
|
|
49058
49039
|
break;
|
|
49059
49040
|
}
|
|
49060
49041
|
if (target === unknownSymbol) {
|
|
49061
|
-
return
|
|
49042
|
+
return -1 /* All */;
|
|
49062
49043
|
}
|
|
49063
49044
|
if (target === symbol || (seenSymbols == null ? void 0 : seenSymbols.has(target))) {
|
|
49064
49045
|
break;
|
|
@@ -49419,8 +49400,12 @@ ${lanes.join("\n")}
|
|
|
49419
49400
|
return ambientModule;
|
|
49420
49401
|
}
|
|
49421
49402
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
49422
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a =
|
|
49423
|
-
|
|
49403
|
+
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(
|
|
49404
|
+
location.initializer,
|
|
49405
|
+
/*requireStringLiteralLikeArgument*/
|
|
49406
|
+
true
|
|
49407
|
+
) ? 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);
|
|
49408
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49424
49409
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
49425
49410
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
49426
49411
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -50044,7 +50029,7 @@ ${lanes.join("\n")}
|
|
|
50044
50029
|
}
|
|
50045
50030
|
function createType(flags) {
|
|
50046
50031
|
var _a;
|
|
50047
|
-
const result = new
|
|
50032
|
+
const result = new Type28(checker, flags);
|
|
50048
50033
|
typeCount++;
|
|
50049
50034
|
result.id = typeCount;
|
|
50050
50035
|
(_a = tracing) == null ? void 0 : _a.recordType(result);
|
|
@@ -50056,7 +50041,7 @@ ${lanes.join("\n")}
|
|
|
50056
50041
|
return result;
|
|
50057
50042
|
}
|
|
50058
50043
|
function createOriginType(flags) {
|
|
50059
|
-
return new
|
|
50044
|
+
return new Type28(checker, flags);
|
|
50060
50045
|
}
|
|
50061
50046
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */, debugIntrinsicName) {
|
|
50062
50047
|
checkIntrinsicName(intrinsicName, debugIntrinsicName);
|
|
@@ -52574,7 +52559,7 @@ ${lanes.join("\n")}
|
|
|
52574
52559
|
}
|
|
52575
52560
|
const sym = resolveEntityName(
|
|
52576
52561
|
leftmost,
|
|
52577
|
-
|
|
52562
|
+
-1 /* All */,
|
|
52578
52563
|
/*ignoreErrors*/
|
|
52579
52564
|
true,
|
|
52580
52565
|
/*dontResolveAlias*/
|
|
@@ -52584,13 +52569,13 @@ ${lanes.join("\n")}
|
|
|
52584
52569
|
if (isSymbolAccessible(
|
|
52585
52570
|
sym,
|
|
52586
52571
|
context.enclosingDeclaration,
|
|
52587
|
-
|
|
52572
|
+
-1 /* All */,
|
|
52588
52573
|
/*shouldComputeAliasesToMakeVisible*/
|
|
52589
52574
|
false
|
|
52590
52575
|
).accessibility !== 0 /* Accessible */) {
|
|
52591
52576
|
introducesError = true;
|
|
52592
52577
|
} else {
|
|
52593
|
-
context.tracker.trackSymbol(sym, context.enclosingDeclaration,
|
|
52578
|
+
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
52594
52579
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
52595
52580
|
}
|
|
52596
52581
|
if (isIdentifier(node)) {
|
|
@@ -53702,7 +53687,7 @@ ${lanes.join("\n")}
|
|
|
53702
53687
|
isLocalImport ? symbolToName(
|
|
53703
53688
|
target,
|
|
53704
53689
|
context,
|
|
53705
|
-
|
|
53690
|
+
-1 /* All */,
|
|
53706
53691
|
/*expectsIdentifier*/
|
|
53707
53692
|
false
|
|
53708
53693
|
) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
|
|
@@ -53861,7 +53846,7 @@ ${lanes.join("\n")}
|
|
|
53861
53846
|
const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0;
|
|
53862
53847
|
const referenced = first2 && resolveEntityName(
|
|
53863
53848
|
first2,
|
|
53864
|
-
|
|
53849
|
+
-1 /* All */,
|
|
53865
53850
|
/*ignoreErrors*/
|
|
53866
53851
|
true,
|
|
53867
53852
|
/*dontResolveAlias*/
|
|
@@ -53878,7 +53863,7 @@ ${lanes.join("\n")}
|
|
|
53878
53863
|
/*modifiers*/
|
|
53879
53864
|
void 0,
|
|
53880
53865
|
isExportEquals,
|
|
53881
|
-
symbolToExpression(target, context,
|
|
53866
|
+
symbolToExpression(target, context, -1 /* All */)
|
|
53882
53867
|
));
|
|
53883
53868
|
} else {
|
|
53884
53869
|
if (first2 === expr && first2) {
|
|
@@ -53897,7 +53882,7 @@ ${lanes.join("\n")}
|
|
|
53897
53882
|
symbolToName(
|
|
53898
53883
|
target,
|
|
53899
53884
|
context,
|
|
53900
|
-
|
|
53885
|
+
-1 /* All */,
|
|
53901
53886
|
/*expectsIdentifier*/
|
|
53902
53887
|
false
|
|
53903
53888
|
)
|
|
@@ -57810,30 +57795,14 @@ ${lanes.join("\n")}
|
|
|
57810
57795
|
return !!(typeParameter.symbol && forEach(typeParameter.symbol.declarations, (decl) => isTypeParameterDeclaration(decl) && decl.default));
|
|
57811
57796
|
}
|
|
57812
57797
|
function getApparentTypeOfMappedType(type) {
|
|
57813
|
-
|
|
57814
|
-
if (type.resolvedApparentType === resolvingApparentMappedType) {
|
|
57815
|
-
return type.resolvedApparentType = type;
|
|
57816
|
-
}
|
|
57817
|
-
return type.resolvedApparentType;
|
|
57818
|
-
}
|
|
57819
|
-
type.resolvedApparentType = resolvingApparentMappedType;
|
|
57820
|
-
return type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type);
|
|
57798
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
57821
57799
|
}
|
|
57822
57800
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
57823
|
-
const
|
|
57824
|
-
|
|
57825
|
-
|
|
57826
|
-
let constraint;
|
|
57827
|
-
if (!type.target) {
|
|
57828
|
-
constraint = getConstraintOfTypeParameter(typeVariable);
|
|
57829
|
-
} else {
|
|
57830
|
-
const modifiersConstraint = getConstraintOfType(getModifiersTypeFromMappedType(type));
|
|
57831
|
-
if (modifiersConstraint) {
|
|
57832
|
-
constraint = getApparentType(modifiersConstraint);
|
|
57833
|
-
}
|
|
57834
|
-
}
|
|
57801
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
57802
|
+
if (typeVariable && !type.declaration.nameType) {
|
|
57803
|
+
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
57835
57804
|
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
57836
|
-
return instantiateType(
|
|
57805
|
+
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
57837
57806
|
}
|
|
57838
57807
|
}
|
|
57839
57808
|
return type;
|
|
@@ -59157,7 +59126,7 @@ ${lanes.join("\n")}
|
|
|
59157
59126
|
if (constraint) {
|
|
59158
59127
|
constraints = append(constraints, constraint);
|
|
59159
59128
|
}
|
|
59160
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
|
|
59129
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && !parent2.nameType && node === parent2.type) {
|
|
59161
59130
|
const mappedType = getTypeFromTypeNode(parent2);
|
|
59162
59131
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
59163
59132
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -62217,11 +62186,8 @@ ${lanes.join("\n")}
|
|
|
62217
62186
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
62218
62187
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
62219
62188
|
}
|
|
62220
|
-
if (isGenericTupleType(t)) {
|
|
62221
|
-
return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
|
|
62222
|
-
}
|
|
62223
62189
|
if (isTupleType(t)) {
|
|
62224
|
-
return instantiateMappedTupleType(t, type,
|
|
62190
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
62225
62191
|
}
|
|
62226
62192
|
}
|
|
62227
62193
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
@@ -62238,17 +62204,18 @@ ${lanes.join("\n")}
|
|
|
62238
62204
|
function getModifiedReadonlyState(state, modifiers) {
|
|
62239
62205
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
62240
62206
|
}
|
|
62241
|
-
function
|
|
62207
|
+
function instantiateMappedTupleType(tupleType, mappedType, typeVariable, mapper) {
|
|
62242
62208
|
const elementFlags = tupleType.target.elementFlags;
|
|
62243
|
-
const
|
|
62244
|
-
|
|
62245
|
-
|
|
62246
|
-
|
|
62247
|
-
|
|
62248
|
-
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
62209
|
+
const fixedLength = tupleType.target.fixedLength;
|
|
62210
|
+
const fixedMapper = fixedLength ? prependTypeMapping(typeVariable, tupleType, mapper) : mapper;
|
|
62211
|
+
const newElementTypes = map(getElementTypes(tupleType), (type, i) => {
|
|
62212
|
+
const flags = elementFlags[i];
|
|
62213
|
+
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;
|
|
62249
62214
|
});
|
|
62215
|
+
const modifiers = getMappedTypeModifiers(mappedType);
|
|
62216
|
+
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;
|
|
62250
62217
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
62251
|
-
return
|
|
62218
|
+
return contains(newElementTypes, errorType) ? errorType : createTupleType(newElementTypes, newElementFlags, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
62252
62219
|
}
|
|
62253
62220
|
function instantiateMappedArrayType(arrayType, mappedType, mapper) {
|
|
62254
62221
|
const elementType = instantiateMappedTypeTemplate(
|
|
@@ -62260,14 +62227,6 @@ ${lanes.join("\n")}
|
|
|
62260
62227
|
);
|
|
62261
62228
|
return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
|
|
62262
62229
|
}
|
|
62263
|
-
function instantiateMappedTupleType(tupleType, mappedType, mapper) {
|
|
62264
|
-
const elementFlags = tupleType.target.elementFlags;
|
|
62265
|
-
const elementTypes = map(getElementTypes(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper));
|
|
62266
|
-
const modifiers = getMappedTypeModifiers(mappedType);
|
|
62267
|
-
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;
|
|
62268
|
-
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers);
|
|
62269
|
-
return contains(elementTypes, errorType) ? errorType : createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
62270
|
-
}
|
|
62271
62230
|
function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
|
|
62272
62231
|
const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
|
|
62273
62232
|
const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
|
|
@@ -63039,7 +62998,8 @@ ${lanes.join("\n")}
|
|
|
63039
62998
|
if (isOmittedExpression(elem))
|
|
63040
62999
|
continue;
|
|
63041
63000
|
const nameType = getNumberLiteralType(i);
|
|
63042
|
-
|
|
63001
|
+
const checkNode = getEffectiveCheckNode(elem);
|
|
63002
|
+
yield { errorNode: checkNode, innerExpression: checkNode, nameType };
|
|
63043
63003
|
}
|
|
63044
63004
|
}
|
|
63045
63005
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
@@ -72545,7 +72505,12 @@ ${lanes.join("\n")}
|
|
|
72545
72505
|
}
|
|
72546
72506
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
72547
72507
|
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;
|
|
72548
|
-
const
|
|
72508
|
+
const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
|
|
72509
|
+
const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
|
|
72510
|
+
if (specifier) {
|
|
72511
|
+
Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
|
|
72512
|
+
}
|
|
72513
|
+
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
72549
72514
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
72550
72515
|
if (links) {
|
|
72551
72516
|
links.jsxImplicitImportContainer = result || false;
|
|
@@ -72788,7 +72753,7 @@ ${lanes.join("\n")}
|
|
|
72788
72753
|
);
|
|
72789
72754
|
}
|
|
72790
72755
|
if (jsxFactorySym) {
|
|
72791
|
-
jsxFactorySym.isReferenced =
|
|
72756
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
72792
72757
|
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
72793
72758
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
72794
72759
|
}
|
|
@@ -73628,7 +73593,7 @@ ${lanes.join("\n")}
|
|
|
73628
73593
|
return;
|
|
73629
73594
|
}
|
|
73630
73595
|
}
|
|
73631
|
-
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced =
|
|
73596
|
+
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = -1 /* All */;
|
|
73632
73597
|
}
|
|
73633
73598
|
function isSelfTypeAccess(name, parent2) {
|
|
73634
73599
|
return name.kind === 110 /* ThisKeyword */ || !!parent2 && isEntityNameExpression(name) && parent2 === getResolvedSymbol(getFirstIdentifier(name));
|
|
@@ -74191,6 +74156,10 @@ ${lanes.join("\n")}
|
|
|
74191
74156
|
return false;
|
|
74192
74157
|
}
|
|
74193
74158
|
}
|
|
74159
|
+
function getEffectiveCheckNode(argument) {
|
|
74160
|
+
argument = skipParentheses(argument);
|
|
74161
|
+
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
74162
|
+
}
|
|
74194
74163
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
74195
74164
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
74196
74165
|
if (isJsxOpeningLikeElement(node)) {
|
|
@@ -74226,7 +74195,8 @@ ${lanes.join("\n")}
|
|
|
74226
74195
|
checkMode
|
|
74227
74196
|
);
|
|
74228
74197
|
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
74229
|
-
|
|
74198
|
+
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
74199
|
+
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
74230
74200
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
74231
74201
|
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
|
74232
74202
|
return errorOutputContainer.errors || emptyArray;
|
|
@@ -74244,7 +74214,7 @@ ${lanes.join("\n")}
|
|
|
74244
74214
|
checkMode
|
|
74245
74215
|
);
|
|
74246
74216
|
const restArgCount = args.length - argCount;
|
|
74247
|
-
const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? args[argCount] : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
|
|
74217
|
+
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);
|
|
74248
74218
|
if (!checkTypeRelatedTo(
|
|
74249
74219
|
spreadType,
|
|
74250
74220
|
restType,
|
|
@@ -74729,8 +74699,8 @@ ${lanes.join("\n")}
|
|
|
74729
74699
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
74730
74700
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
74731
74701
|
const failedSignatureDeclarations = ((_b = (_a = failed.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
74732
|
-
const
|
|
74733
|
-
const implDecl =
|
|
74702
|
+
const isOverload2 = failedSignatureDeclarations.length > 1;
|
|
74703
|
+
const implDecl = isOverload2 ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0;
|
|
74734
74704
|
if (implDecl) {
|
|
74735
74705
|
const candidate = getSignatureFromDeclaration(implDecl);
|
|
74736
74706
|
const isSingleNonGenericCandidate2 = !candidate.typeParameters;
|
|
@@ -75586,7 +75556,7 @@ ${lanes.join("\n")}
|
|
|
75586
75556
|
return anyType;
|
|
75587
75557
|
}
|
|
75588
75558
|
}
|
|
75589
|
-
if (isInJSFile(node) &&
|
|
75559
|
+
if (isInJSFile(node) && isCommonJsRequire(node)) {
|
|
75590
75560
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
75591
75561
|
}
|
|
75592
75562
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -76438,8 +76408,8 @@ ${lanes.join("\n")}
|
|
|
76438
76408
|
), [thisType, valueType]);
|
|
76439
76409
|
}
|
|
76440
76410
|
function createClassFieldDecoratorInitializerMutatorType(thisType, valueType) {
|
|
76441
|
-
const thisParam =
|
|
76442
|
-
const valueParam =
|
|
76411
|
+
const thisParam = createParameter2("this", thisType);
|
|
76412
|
+
const valueParam = createParameter2("value", valueType);
|
|
76443
76413
|
return createFunctionType(
|
|
76444
76414
|
/*typeParameters*/
|
|
76445
76415
|
void 0,
|
|
@@ -76452,8 +76422,8 @@ ${lanes.join("\n")}
|
|
|
76452
76422
|
);
|
|
76453
76423
|
}
|
|
76454
76424
|
function createESDecoratorCallSignature(targetType, contextType, nonOptionalReturnType) {
|
|
76455
|
-
const targetParam =
|
|
76456
|
-
const contextParam =
|
|
76425
|
+
const targetParam = createParameter2("target", targetType);
|
|
76426
|
+
const contextParam = createParameter2("context", contextType);
|
|
76457
76427
|
const returnType = getUnionType([nonOptionalReturnType, voidType]);
|
|
76458
76428
|
return createCallSignature(
|
|
76459
76429
|
/*typeParameters*/
|
|
@@ -76518,7 +76488,7 @@ ${lanes.join("\n")}
|
|
|
76518
76488
|
case 231 /* ClassExpression */: {
|
|
76519
76489
|
const node = parent2;
|
|
76520
76490
|
const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node));
|
|
76521
|
-
const targetParam =
|
|
76491
|
+
const targetParam = createParameter2("target", targetType);
|
|
76522
76492
|
links.decoratorSignature = createCallSignature(
|
|
76523
76493
|
/*typeParameters*/
|
|
76524
76494
|
void 0,
|
|
@@ -76542,9 +76512,9 @@ ${lanes.join("\n")}
|
|
|
76542
76512
|
const targetType = isConstructorDeclaration(node.parent) ? getTypeOfSymbol(getSymbolOfDeclaration(node.parent.parent)) : getParentTypeOfClassElement(node.parent);
|
|
76543
76513
|
const keyType = isConstructorDeclaration(node.parent) ? undefinedType : getClassElementPropertyKeyType(node.parent);
|
|
76544
76514
|
const indexType = getNumberLiteralType(index);
|
|
76545
|
-
const targetParam =
|
|
76546
|
-
const keyParam =
|
|
76547
|
-
const indexParam =
|
|
76515
|
+
const targetParam = createParameter2("target", targetType);
|
|
76516
|
+
const keyParam = createParameter2("propertyKey", keyType);
|
|
76517
|
+
const indexParam = createParameter2("parameterIndex", indexType);
|
|
76548
76518
|
links.decoratorSignature = createCallSignature(
|
|
76549
76519
|
/*typeParameters*/
|
|
76550
76520
|
void 0,
|
|
@@ -76563,14 +76533,14 @@ ${lanes.join("\n")}
|
|
|
76563
76533
|
if (!isClassLike(node.parent))
|
|
76564
76534
|
break;
|
|
76565
76535
|
const targetType = getParentTypeOfClassElement(node);
|
|
76566
|
-
const targetParam =
|
|
76536
|
+
const targetParam = createParameter2("target", targetType);
|
|
76567
76537
|
const keyType = getClassElementPropertyKeyType(node);
|
|
76568
|
-
const keyParam =
|
|
76538
|
+
const keyParam = createParameter2("propertyKey", keyType);
|
|
76569
76539
|
const returnType = isPropertyDeclaration(node) ? voidType : createTypedPropertyDescriptorType(getTypeOfNode(node));
|
|
76570
76540
|
const hasPropDesc = languageVersion !== 0 /* ES3 */ && (!isPropertyDeclaration(parent2) || hasAccessorModifier(parent2));
|
|
76571
76541
|
if (hasPropDesc) {
|
|
76572
76542
|
const descriptorType = createTypedPropertyDescriptorType(getTypeOfNode(node));
|
|
76573
|
-
const descriptorParam =
|
|
76543
|
+
const descriptorParam = createParameter2("descriptor", descriptorType);
|
|
76574
76544
|
links.decoratorSignature = createCallSignature(
|
|
76575
76545
|
/*typeParameters*/
|
|
76576
76546
|
void 0,
|
|
@@ -77066,17 +77036,18 @@ ${lanes.join("\n")}
|
|
|
77066
77036
|
const exprType = checkExpression(node.body);
|
|
77067
77037
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
|
77068
77038
|
if (returnOrPromisedType) {
|
|
77039
|
+
const effectiveCheckNode = getEffectiveCheckNode(node.body);
|
|
77069
77040
|
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
77070
77041
|
const awaitedType = checkAwaitedType(
|
|
77071
77042
|
exprType,
|
|
77072
77043
|
/*withAlias*/
|
|
77073
77044
|
false,
|
|
77074
|
-
|
|
77045
|
+
effectiveCheckNode,
|
|
77075
77046
|
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
77076
77047
|
);
|
|
77077
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType,
|
|
77048
|
+
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
77078
77049
|
} else {
|
|
77079
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType,
|
|
77050
|
+
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
77080
77051
|
}
|
|
77081
77052
|
}
|
|
77082
77053
|
}
|
|
@@ -77238,13 +77209,14 @@ ${lanes.join("\n")}
|
|
|
77238
77209
|
}
|
|
77239
77210
|
case 7 /* ES2022 */:
|
|
77240
77211
|
case 99 /* ESNext */:
|
|
77212
|
+
case 200 /* Preserve */:
|
|
77241
77213
|
case 4 /* System */:
|
|
77242
77214
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
77243
77215
|
break;
|
|
77244
77216
|
}
|
|
77245
77217
|
default:
|
|
77246
77218
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
77247
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
|
77219
|
+
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;
|
|
77248
77220
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
|
77249
77221
|
hasError = true;
|
|
77250
77222
|
break;
|
|
@@ -79492,11 +79464,10 @@ ${lanes.join("\n")}
|
|
|
79492
79464
|
checkSourceElement(node.elementType);
|
|
79493
79465
|
}
|
|
79494
79466
|
function checkTupleType(node) {
|
|
79495
|
-
const elementTypes = node.elements;
|
|
79496
79467
|
let seenOptionalElement = false;
|
|
79497
79468
|
let seenRestElement = false;
|
|
79498
|
-
for (const e of
|
|
79499
|
-
|
|
79469
|
+
for (const e of node.elements) {
|
|
79470
|
+
let flags = getTupleElementFlags(e);
|
|
79500
79471
|
if (flags & 8 /* Variadic */) {
|
|
79501
79472
|
const type = getTypeFromTypeNode(e.type);
|
|
79502
79473
|
if (!isArrayLikeType(type)) {
|
|
@@ -79504,9 +79475,10 @@ ${lanes.join("\n")}
|
|
|
79504
79475
|
break;
|
|
79505
79476
|
}
|
|
79506
79477
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
79507
|
-
|
|
79478
|
+
flags |= 4 /* Rest */;
|
|
79508
79479
|
}
|
|
79509
|
-
}
|
|
79480
|
+
}
|
|
79481
|
+
if (flags & 4 /* Rest */) {
|
|
79510
79482
|
if (seenRestElement) {
|
|
79511
79483
|
grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
|
|
79512
79484
|
break;
|
|
@@ -79518,7 +79490,7 @@ ${lanes.join("\n")}
|
|
|
79518
79490
|
break;
|
|
79519
79491
|
}
|
|
79520
79492
|
seenOptionalElement = true;
|
|
79521
|
-
} else if (seenOptionalElement) {
|
|
79493
|
+
} else if (flags & 1 /* Required */ && seenOptionalElement) {
|
|
79522
79494
|
grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
|
|
79523
79495
|
break;
|
|
79524
79496
|
}
|
|
@@ -80271,7 +80243,7 @@ ${lanes.join("\n")}
|
|
|
80271
80243
|
);
|
|
80272
80244
|
}
|
|
80273
80245
|
function createSetterFunctionType(type) {
|
|
80274
|
-
const valueParam =
|
|
80246
|
+
const valueParam = createParameter2("value", type);
|
|
80275
80247
|
return createFunctionType(
|
|
80276
80248
|
/*typeParameters*/
|
|
80277
80249
|
void 0,
|
|
@@ -83759,8 +83731,8 @@ ${lanes.join("\n")}
|
|
|
83759
83731
|
return;
|
|
83760
83732
|
}
|
|
83761
83733
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
83762
|
-
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
83763
|
-
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.
|
|
83734
|
+
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
83735
|
+
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;
|
|
83764
83736
|
return grammarErrorOnNode(node, message);
|
|
83765
83737
|
}
|
|
83766
83738
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
@@ -83832,7 +83804,7 @@ ${lanes.join("\n")}
|
|
|
83832
83804
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
83833
83805
|
}
|
|
83834
83806
|
} else {
|
|
83835
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83807
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
83836
83808
|
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);
|
|
83837
83809
|
}
|
|
83838
83810
|
}
|
|
@@ -83993,7 +83965,7 @@ ${lanes.join("\n")}
|
|
|
83993
83965
|
const id = node.expression;
|
|
83994
83966
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
83995
83967
|
id,
|
|
83996
|
-
|
|
83968
|
+
-1 /* All */,
|
|
83997
83969
|
/*ignoreErrors*/
|
|
83998
83970
|
true,
|
|
83999
83971
|
/*dontResolveAlias*/
|
|
@@ -84067,7 +84039,7 @@ ${lanes.join("\n")}
|
|
|
84067
84039
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
84068
84040
|
}
|
|
84069
84041
|
if (node.isExportEquals) {
|
|
84070
|
-
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
84042
|
+
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 */)) {
|
|
84071
84043
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
84072
84044
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
84073
84045
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -85059,7 +85031,7 @@ ${lanes.join("\n")}
|
|
|
85059
85031
|
return void 0;
|
|
85060
85032
|
case 11 /* StringLiteral */:
|
|
85061
85033
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
85062
|
-
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) &&
|
|
85034
|
+
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(
|
|
85063
85035
|
node.parent,
|
|
85064
85036
|
/*requireStringLiteralLikeArgument*/
|
|
85065
85037
|
false
|
|
@@ -87121,7 +87093,7 @@ ${lanes.join("\n")}
|
|
|
87121
87093
|
}
|
|
87122
87094
|
default:
|
|
87123
87095
|
diagnostics.add(
|
|
87124
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
|
87096
|
+
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)
|
|
87125
87097
|
);
|
|
87126
87098
|
break;
|
|
87127
87099
|
}
|
|
@@ -110930,7 +110902,7 @@ ${lanes.join("\n")}
|
|
|
110930
110902
|
setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
|
|
110931
110903
|
);
|
|
110932
110904
|
}
|
|
110933
|
-
if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
|
|
110905
|
+
if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
|
|
110934
110906
|
return result;
|
|
110935
110907
|
}
|
|
110936
110908
|
return factory2.updateSourceFile(
|
|
@@ -110973,6 +110945,14 @@ ${lanes.join("\n")}
|
|
|
110973
110945
|
if (moduleName) {
|
|
110974
110946
|
args.push(moduleName);
|
|
110975
110947
|
}
|
|
110948
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
110949
|
+
return factory2.createCallExpression(
|
|
110950
|
+
factory2.createIdentifier("require"),
|
|
110951
|
+
/*typeArguments*/
|
|
110952
|
+
void 0,
|
|
110953
|
+
args
|
|
110954
|
+
);
|
|
110955
|
+
}
|
|
110976
110956
|
if (!importRequireStatements) {
|
|
110977
110957
|
const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
110978
110958
|
const importStatement = factory2.createImportDeclaration(
|
|
@@ -111087,7 +111067,25 @@ ${lanes.join("\n")}
|
|
|
111087
111067
|
return statements;
|
|
111088
111068
|
}
|
|
111089
111069
|
function visitExportAssignment(node) {
|
|
111090
|
-
|
|
111070
|
+
if (node.isExportEquals) {
|
|
111071
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
111072
|
+
const statement = setOriginalNode(
|
|
111073
|
+
factory2.createExpressionStatement(
|
|
111074
|
+
factory2.createAssignment(
|
|
111075
|
+
factory2.createPropertyAccessExpression(
|
|
111076
|
+
factory2.createIdentifier("module"),
|
|
111077
|
+
"exports"
|
|
111078
|
+
),
|
|
111079
|
+
node.expression
|
|
111080
|
+
)
|
|
111081
|
+
),
|
|
111082
|
+
node
|
|
111083
|
+
);
|
|
111084
|
+
return statement;
|
|
111085
|
+
}
|
|
111086
|
+
return void 0;
|
|
111087
|
+
}
|
|
111088
|
+
return node;
|
|
111091
111089
|
}
|
|
111092
111090
|
function visitExportDeclaration(node) {
|
|
111093
111091
|
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
|
|
@@ -111565,7 +111563,7 @@ ${lanes.join("\n")}
|
|
|
111565
111563
|
}
|
|
111566
111564
|
}
|
|
111567
111565
|
function trackReferencedAmbientModule(node, symbol) {
|
|
111568
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol,
|
|
111566
|
+
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
111569
111567
|
if (length(directives)) {
|
|
111570
111568
|
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
111571
111569
|
}
|
|
@@ -113240,6 +113238,7 @@ ${lanes.join("\n")}
|
|
|
113240
113238
|
case 7 /* ES2022 */:
|
|
113241
113239
|
case 6 /* ES2020 */:
|
|
113242
113240
|
case 5 /* ES2015 */:
|
|
113241
|
+
case 200 /* Preserve */:
|
|
113243
113242
|
return transformECMAScriptModule;
|
|
113244
113243
|
case 4 /* System */:
|
|
113245
113244
|
return transformSystemModule;
|
|
@@ -120073,8 +120072,8 @@ ${lanes.join("\n")}
|
|
|
120073
120072
|
function getModeForFileReference(ref, containingFileMode) {
|
|
120074
120073
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
120075
120074
|
}
|
|
120076
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
120077
|
-
return
|
|
120075
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
120076
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
120078
120077
|
}
|
|
120079
120078
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
120080
120079
|
var _a;
|
|
@@ -120086,7 +120085,10 @@ ${lanes.join("\n")}
|
|
|
120086
120085
|
}
|
|
120087
120086
|
return false;
|
|
120088
120087
|
}
|
|
120089
|
-
function getModeForUsageLocation(file, usage) {
|
|
120088
|
+
function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
120089
|
+
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
120090
|
+
}
|
|
120091
|
+
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
120090
120092
|
var _a;
|
|
120091
120093
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
120092
120094
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
@@ -120103,6 +120105,13 @@ ${lanes.join("\n")}
|
|
|
120103
120105
|
return override;
|
|
120104
120106
|
}
|
|
120105
120107
|
}
|
|
120108
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
120109
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
120110
|
+
usage.parent,
|
|
120111
|
+
/*requireStringLiteralLikeArgument*/
|
|
120112
|
+
false
|
|
120113
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
120114
|
+
}
|
|
120106
120115
|
if (file.impliedNodeFormat === void 0)
|
|
120107
120116
|
return void 0;
|
|
120108
120117
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
@@ -120181,7 +120190,7 @@ ${lanes.join("\n")}
|
|
|
120181
120190
|
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
120182
120191
|
for (const entry of entries) {
|
|
120183
120192
|
const name = loader.nameAndMode.getName(entry);
|
|
120184
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
120193
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
120185
120194
|
const key = createModeAwareCacheKey(name, mode);
|
|
120186
120195
|
let result = cache.get(key);
|
|
120187
120196
|
if (!result) {
|
|
@@ -120266,7 +120275,7 @@ ${lanes.join("\n")}
|
|
|
120266
120275
|
switch (kind) {
|
|
120267
120276
|
case 3 /* Import */:
|
|
120268
120277
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
120269
|
-
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text,
|
|
120278
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, program.getModeForUsageLocation(file, importLiteral))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
120270
120279
|
if (importLiteral.pos === -1)
|
|
120271
120280
|
return { file, packageId, text: importLiteral.text };
|
|
120272
120281
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -120702,6 +120711,8 @@ ${lanes.join("\n")}
|
|
|
120702
120711
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
120703
120712
|
isSourceFileFromExternalLibrary,
|
|
120704
120713
|
isSourceFileDefaultLibrary,
|
|
120714
|
+
getModeForUsageLocation: getModeForUsageLocation2,
|
|
120715
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
120705
120716
|
getSourceFileFromReference,
|
|
120706
120717
|
getLibFileFromReference,
|
|
120707
120718
|
sourceFileToPackageName,
|
|
@@ -120711,6 +120722,7 @@ ${lanes.join("\n")}
|
|
|
120711
120722
|
resolvedTypeReferenceDirectiveNames,
|
|
120712
120723
|
resolvedLibReferences,
|
|
120713
120724
|
getResolvedModule,
|
|
120725
|
+
getResolvedModuleFromModuleSpecifier,
|
|
120714
120726
|
getResolvedTypeReferenceDirective,
|
|
120715
120727
|
forEachResolvedModule,
|
|
120716
120728
|
forEachResolvedTypeReferenceDirective,
|
|
@@ -120761,6 +120773,11 @@ ${lanes.join("\n")}
|
|
|
120761
120773
|
var _a2;
|
|
120762
120774
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
120763
120775
|
}
|
|
120776
|
+
function getResolvedModuleFromModuleSpecifier(moduleSpecifier) {
|
|
120777
|
+
const sourceFile = getSourceFileOfNode(moduleSpecifier);
|
|
120778
|
+
Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode.");
|
|
120779
|
+
return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation2(sourceFile, moduleSpecifier));
|
|
120780
|
+
}
|
|
120764
120781
|
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
120765
120782
|
var _a2;
|
|
120766
120783
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
@@ -120933,8 +120950,7 @@ ${lanes.join("\n")}
|
|
|
120933
120950
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
120934
120951
|
const moduleName = moduleNames[i];
|
|
120935
120952
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
120936
|
-
const
|
|
120937
|
-
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
120953
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
|
|
120938
120954
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
120939
120955
|
if (isTraceEnabled(options, host)) {
|
|
120940
120956
|
trace(
|
|
@@ -120982,7 +120998,7 @@ ${lanes.join("\n")}
|
|
|
120982
120998
|
return result;
|
|
120983
120999
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
120984
121000
|
var _a2;
|
|
120985
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text,
|
|
121001
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
120986
121002
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
120987
121003
|
if (resolutionToFile && resolvedFile) {
|
|
120988
121004
|
return false;
|
|
@@ -121200,11 +121216,9 @@ ${lanes.join("\n")}
|
|
|
121200
121216
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
121201
121217
|
const resolutionsChanged = hasChangesInResolutions(
|
|
121202
121218
|
moduleNames,
|
|
121203
|
-
newSourceFile,
|
|
121204
121219
|
resolutions,
|
|
121205
|
-
(name
|
|
121206
|
-
moduleResolutionIsEqualTo
|
|
121207
|
-
moduleResolutionNameAndModeGetter
|
|
121220
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation2(newSourceFile, name)),
|
|
121221
|
+
moduleResolutionIsEqualTo
|
|
121208
121222
|
);
|
|
121209
121223
|
if (resolutionsChanged)
|
|
121210
121224
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -121213,11 +121227,9 @@ ${lanes.join("\n")}
|
|
|
121213
121227
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
121214
121228
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
121215
121229
|
typesReferenceDirectives,
|
|
121216
|
-
newSourceFile,
|
|
121217
121230
|
typeReferenceResolutions,
|
|
121218
|
-
(name
|
|
121219
|
-
typeDirectiveIsEqualTo
|
|
121220
|
-
typeReferenceResolutionNameAndModeGetter
|
|
121231
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)),
|
|
121232
|
+
typeDirectiveIsEqualTo
|
|
121221
121233
|
);
|
|
121222
121234
|
if (typeReferenceResolutionsChanged)
|
|
121223
121235
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -121884,8 +121896,7 @@ ${lanes.join("\n")}
|
|
|
121884
121896
|
false
|
|
121885
121897
|
);
|
|
121886
121898
|
}
|
|
121887
|
-
|
|
121888
|
-
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
121899
|
+
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
121889
121900
|
collectDynamicImportOrRequireCalls(file);
|
|
121890
121901
|
}
|
|
121891
121902
|
file.imports = imports || emptyArray;
|
|
@@ -121934,7 +121945,7 @@ ${lanes.join("\n")}
|
|
|
121934
121945
|
const r = /import|require/g;
|
|
121935
121946
|
while (r.exec(file2.text) !== null) {
|
|
121936
121947
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
121937
|
-
if (
|
|
121948
|
+
if (isJavaScriptFile && isRequireCall(
|
|
121938
121949
|
node,
|
|
121939
121950
|
/*requireStringLiteralLikeArgument*/
|
|
121940
121951
|
true
|
|
@@ -122489,13 +122500,13 @@ ${lanes.join("\n")}
|
|
|
122489
122500
|
const moduleNames = getModuleNames(file);
|
|
122490
122501
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
122491
122502
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
122492
|
-
const optionsForFile = (
|
|
122503
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
122493
122504
|
const resolutionsInFile = createModeAwareCache();
|
|
122494
122505
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
122495
122506
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
122496
122507
|
const resolution = resolutions[index].resolvedModule;
|
|
122497
122508
|
const moduleName = moduleNames[index].text;
|
|
122498
|
-
const mode =
|
|
122509
|
+
const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile);
|
|
122499
122510
|
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
122500
122511
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
122501
122512
|
if (!resolution) {
|
|
@@ -122775,7 +122786,7 @@ ${lanes.join("\n")}
|
|
|
122775
122786
|
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
122776
122787
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
122777
122788
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
122778
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
122789
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
|
|
122779
122790
|
}
|
|
122780
122791
|
}
|
|
122781
122792
|
if (options.outDir || // there is --outDir specified
|
|
@@ -122839,7 +122850,7 @@ ${lanes.join("\n")}
|
|
|
122839
122850
|
}
|
|
122840
122851
|
}
|
|
122841
122852
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
122842
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
122853
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
|
|
122843
122854
|
}
|
|
122844
122855
|
const moduleKind = getEmitModuleKind(options);
|
|
122845
122856
|
if (options.verbatimModuleSyntax) {
|
|
@@ -122866,8 +122877,8 @@ ${lanes.join("\n")}
|
|
|
122866
122877
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
122867
122878
|
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
122868
122879
|
}
|
|
122869
|
-
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
122870
|
-
createOptionValueDiagnostic("moduleResolution", Diagnostics.
|
|
122880
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
|
|
122881
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
|
|
122871
122882
|
}
|
|
122872
122883
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
122873
122884
|
const moduleKindName = ModuleKind[moduleKind];
|
|
@@ -123374,6 +123385,14 @@ ${lanes.join("\n")}
|
|
|
123374
123385
|
}
|
|
123375
123386
|
return symlinks;
|
|
123376
123387
|
}
|
|
123388
|
+
function getModeForUsageLocation2(file, usage) {
|
|
123389
|
+
var _a2;
|
|
123390
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
123391
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
123392
|
+
}
|
|
123393
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
123394
|
+
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
123395
|
+
}
|
|
123377
123396
|
}
|
|
123378
123397
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
123379
123398
|
let setOfDeclarationDirectories;
|
|
@@ -123670,7 +123689,7 @@ ${lanes.join("\n")}
|
|
|
123670
123689
|
};
|
|
123671
123690
|
moduleResolutionNameAndModeGetter = {
|
|
123672
123691
|
getName: getModuleResolutionName,
|
|
123673
|
-
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
123692
|
+
getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
|
|
123674
123693
|
};
|
|
123675
123694
|
typeReferenceResolutionNameAndModeGetter = {
|
|
123676
123695
|
getName: getTypeReferenceResolutionName,
|
|
@@ -125997,7 +126016,7 @@ ${lanes.join("\n")}
|
|
|
125997
126016
|
const seenNamesInFile = createModeAwareCache();
|
|
125998
126017
|
for (const entry of entries) {
|
|
125999
126018
|
const name = loader.nameAndMode.getName(entry);
|
|
126000
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
126019
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
126001
126020
|
let resolution = resolutionsInFile.get(name, mode);
|
|
126002
126021
|
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
126003
126022
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
@@ -126038,7 +126057,7 @@ ${lanes.join("\n")}
|
|
|
126038
126057
|
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
126039
126058
|
(entry) => seenNamesInFile.set(
|
|
126040
126059
|
loader.nameAndMode.getName(entry),
|
|
126041
|
-
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
126060
|
+
loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
|
|
126042
126061
|
true
|
|
126043
126062
|
)
|
|
126044
126063
|
);
|
|
@@ -133926,7 +133945,7 @@ ${lanes.join("\n")}
|
|
|
133926
133945
|
var _a, _b;
|
|
133927
133946
|
const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
|
|
133928
133947
|
const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
|
|
133929
|
-
const pattern =
|
|
133948
|
+
const pattern = getSubPatternFromSpec(spec, "", "exclude");
|
|
133930
133949
|
return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
|
|
133931
133950
|
});
|
|
133932
133951
|
forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, host, (module2, file) => cb(
|
|
@@ -135797,8 +135816,8 @@ ${lanes.join("\n")}
|
|
|
135797
135816
|
const newFileName = oldToNew(oldFileName);
|
|
135798
135817
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
135799
135818
|
} else {
|
|
135800
|
-
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135801
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.
|
|
135819
|
+
const mode = program.getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
135820
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.getResolvedModuleFromModuleSpecifier(importLiteral) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
135802
135821
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
135803
135822
|
}
|
|
135804
135823
|
}
|
|
@@ -136735,7 +136754,7 @@ ${lanes.join("\n")}
|
|
|
136735
136754
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
136736
136755
|
if (!name)
|
|
136737
136756
|
continue;
|
|
136738
|
-
const module2 = (_a = program.
|
|
136757
|
+
const module2 = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
136739
136758
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
136740
136759
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
136741
136760
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -138289,7 +138308,7 @@ ${lanes.join("\n")}
|
|
|
138289
138308
|
if (checker.resolveName(
|
|
138290
138309
|
exportName,
|
|
138291
138310
|
id,
|
|
138292
|
-
|
|
138311
|
+
-1 /* All */,
|
|
138293
138312
|
/*excludeGlobals*/
|
|
138294
138313
|
true
|
|
138295
138314
|
)) {
|
|
@@ -138352,7 +138371,7 @@ ${lanes.join("\n")}
|
|
|
138352
138371
|
const symbol = checker.resolveName(
|
|
138353
138372
|
preferredName,
|
|
138354
138373
|
id,
|
|
138355
|
-
|
|
138374
|
+
-1 /* All */,
|
|
138356
138375
|
/*excludeGlobals*/
|
|
138357
138376
|
true
|
|
138358
138377
|
);
|
|
@@ -138907,7 +138926,7 @@ ${lanes.join("\n")}
|
|
|
138907
138926
|
function getReferenceNodes(declaration, checker, file) {
|
|
138908
138927
|
const references = [];
|
|
138909
138928
|
const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
|
|
138910
|
-
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
|
|
138929
|
+
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref) && !isShorthandPropertyAssignment(ref.parent)) {
|
|
138911
138930
|
return true;
|
|
138912
138931
|
}
|
|
138913
138932
|
if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
|
|
@@ -138935,6 +138954,9 @@ ${lanes.join("\n")}
|
|
|
138935
138954
|
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
138936
138955
|
return factory.createParenthesizedExpression(replacement);
|
|
138937
138956
|
}
|
|
138957
|
+
if (isIdentifier(reference) && isShorthandPropertyAssignment(parent2)) {
|
|
138958
|
+
return factory.createPropertyAssignment(reference, replacement);
|
|
138959
|
+
}
|
|
138938
138960
|
return replacement;
|
|
138939
138961
|
}
|
|
138940
138962
|
var refactorName4, refactorDescription, inlineVariableAction;
|
|
@@ -139225,10 +139247,11 @@ ${lanes.join("\n")}
|
|
|
139225
139247
|
forEachImportInStatement(oldStatement, (i) => {
|
|
139226
139248
|
var _a;
|
|
139227
139249
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
139228
|
-
const
|
|
139250
|
+
const compilerOptions = program.getCompilerOptions();
|
|
139251
|
+
const resolved = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier);
|
|
139229
139252
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
139230
139253
|
if (fileName && targetSourceFile) {
|
|
139231
|
-
const newModuleSpecifier = getModuleSpecifier(
|
|
139254
|
+
const newModuleSpecifier = getModuleSpecifier(compilerOptions, targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
139232
139255
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
139233
139256
|
} else {
|
|
139234
139257
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139339,7 +139362,7 @@ ${lanes.join("\n")}
|
|
|
139339
139362
|
needUniqueName = needUniqueName || !!checker.resolveName(
|
|
139340
139363
|
preferredNewNamespaceName,
|
|
139341
139364
|
ref,
|
|
139342
|
-
|
|
139365
|
+
-1 /* All */,
|
|
139343
139366
|
/*excludeGlobals*/
|
|
139344
139367
|
true
|
|
139345
139368
|
);
|
|
@@ -144667,12 +144690,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144667
144690
|
}
|
|
144668
144691
|
return [];
|
|
144669
144692
|
}
|
|
144670
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
144693
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes65, formatOptions, preferences = emptyOptions) {
|
|
144671
144694
|
synchronizeHostData();
|
|
144672
144695
|
const sourceFile = getValidSourceFile(fileName);
|
|
144673
144696
|
const span = createTextSpanFromBounds(start, end);
|
|
144674
144697
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
144675
|
-
return flatMap(deduplicate(
|
|
144698
|
+
return flatMap(deduplicate(errorCodes65, equateValues, compareValues), (errorCode) => {
|
|
144676
144699
|
cancellationToken.throwIfCancellationRequested();
|
|
144677
144700
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
144678
144701
|
});
|
|
@@ -147054,10 +147077,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
147054
147077
|
return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
|
|
147055
147078
|
}
|
|
147056
147079
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
147057
|
-
const { errorCodes:
|
|
147080
|
+
const { errorCodes: errorCodes65 } = registration;
|
|
147058
147081
|
let maybeFixableDiagnostics = 0;
|
|
147059
147082
|
for (const diag2 of diagnostics) {
|
|
147060
|
-
if (contains(
|
|
147083
|
+
if (contains(errorCodes65, diag2.code))
|
|
147061
147084
|
maybeFixableDiagnostics++;
|
|
147062
147085
|
if (maybeFixableDiagnostics > 1)
|
|
147063
147086
|
break;
|
|
@@ -147081,14 +147104,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
147081
147104
|
function createFileTextChanges(fileName, textChanges2) {
|
|
147082
147105
|
return { fileName, textChanges: textChanges2 };
|
|
147083
147106
|
}
|
|
147084
|
-
function codeFixAll(context,
|
|
147107
|
+
function codeFixAll(context, errorCodes65, use) {
|
|
147085
147108
|
const commands = [];
|
|
147086
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
147109
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes65, (diag2) => use(t, diag2, commands)));
|
|
147087
147110
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
147088
147111
|
}
|
|
147089
|
-
function eachDiagnostic(context,
|
|
147112
|
+
function eachDiagnostic(context, errorCodes65, cb) {
|
|
147090
147113
|
for (const diag2 of getDiagnostics(context)) {
|
|
147091
|
-
if (contains(
|
|
147114
|
+
if (contains(errorCodes65, diag2.code)) {
|
|
147092
147115
|
cb(diag2);
|
|
147093
147116
|
}
|
|
147094
147117
|
}
|
|
@@ -149001,7 +149024,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149001
149024
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149002
149025
|
var _a;
|
|
149003
149026
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149004
|
-
const imported = (_a = program.
|
|
149027
|
+
const imported = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
149005
149028
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149006
149029
|
continue;
|
|
149007
149030
|
}
|
|
@@ -150923,6 +150946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150923
150946
|
case 7 /* ES2022 */:
|
|
150924
150947
|
case 99 /* ESNext */:
|
|
150925
150948
|
case 0 /* None */:
|
|
150949
|
+
case 200 /* Preserve */:
|
|
150926
150950
|
return 2 /* Namespace */;
|
|
150927
150951
|
case 100 /* Node16 */:
|
|
150928
150952
|
case 199 /* NodeNext */:
|
|
@@ -151154,7 +151178,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151154
151178
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151155
151179
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151156
151180
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151157
|
-
const resolvedModule = moduleSpecifier && ((_a = program.
|
|
151181
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule);
|
|
151158
151182
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151159
151183
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151160
151184
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151880,15 +151904,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151880
151904
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
151881
151905
|
if (importDeclaration === void 0)
|
|
151882
151906
|
return void 0;
|
|
151883
|
-
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier
|
|
151907
|
+
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : void 0;
|
|
151884
151908
|
if (moduleSpecifier === void 0)
|
|
151885
151909
|
return void 0;
|
|
151886
|
-
const resolvedModule = (_a = program.
|
|
151887
|
-
sourceFile,
|
|
151888
|
-
moduleSpecifier,
|
|
151889
|
-
/*mode*/
|
|
151890
|
-
void 0
|
|
151891
|
-
)) == null ? void 0 : _a.resolvedModule;
|
|
151910
|
+
const resolvedModule = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
151892
151911
|
if (resolvedModule === void 0)
|
|
151893
151912
|
return void 0;
|
|
151894
151913
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -151905,7 +151924,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151905
151924
|
if (node === void 0)
|
|
151906
151925
|
return void 0;
|
|
151907
151926
|
const exportName = { node: token, isTypeOnly: isTypeDeclaration(node) };
|
|
151908
|
-
return { exportName, node, moduleSourceFile, moduleSpecifier };
|
|
151927
|
+
return { exportName, node, moduleSourceFile, moduleSpecifier: moduleSpecifier.text };
|
|
151909
151928
|
}
|
|
151910
151929
|
return void 0;
|
|
151911
151930
|
}
|
|
@@ -152134,7 +152153,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152134
152153
|
} else if (isImportSpecifier(parent2) && parent2.name === node) {
|
|
152135
152154
|
Debug.assertNode(node, isIdentifier, "Expected an identifier for spelling (import)");
|
|
152136
152155
|
const importDeclaration = findAncestor(node, isImportDeclaration);
|
|
152137
|
-
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(
|
|
152156
|
+
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration);
|
|
152138
152157
|
if (resolvedSourceFile && resolvedSourceFile.symbol) {
|
|
152139
152158
|
suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol);
|
|
152140
152159
|
}
|
|
@@ -152184,11 +152203,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152184
152203
|
}
|
|
152185
152204
|
return flags;
|
|
152186
152205
|
}
|
|
152187
|
-
function getResolvedSourceFileFromImportDeclaration(
|
|
152206
|
+
function getResolvedSourceFileFromImportDeclaration(context, importDeclaration) {
|
|
152188
152207
|
var _a;
|
|
152189
152208
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152190
152209
|
return void 0;
|
|
152191
|
-
const resolvedModule = (_a = context.program.
|
|
152210
|
+
const resolvedModule = (_a = context.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
152192
152211
|
if (!resolvedModule)
|
|
152193
152212
|
return void 0;
|
|
152194
152213
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -153177,6 +153196,240 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153177
153196
|
}
|
|
153178
153197
|
});
|
|
153179
153198
|
|
|
153199
|
+
// src/services/codefixes/fixAddMissingParam.ts
|
|
153200
|
+
function getInfo11(sourceFile, program, pos) {
|
|
153201
|
+
const token = getTokenAtPosition(sourceFile, pos);
|
|
153202
|
+
const callExpression = findAncestor(token, isCallExpression);
|
|
153203
|
+
if (callExpression === void 0 || length(callExpression.arguments) === 0) {
|
|
153204
|
+
return void 0;
|
|
153205
|
+
}
|
|
153206
|
+
const checker = program.getTypeChecker();
|
|
153207
|
+
const type = checker.getTypeAtLocation(callExpression.expression);
|
|
153208
|
+
const convertibleSignatureDeclarations = filter(type.symbol.declarations, isConvertibleSignatureDeclaration);
|
|
153209
|
+
if (convertibleSignatureDeclarations === void 0) {
|
|
153210
|
+
return void 0;
|
|
153211
|
+
}
|
|
153212
|
+
const nonOverloadDeclaration = lastOrUndefined(convertibleSignatureDeclarations);
|
|
153213
|
+
if (nonOverloadDeclaration === void 0 || nonOverloadDeclaration.body === void 0 || isSourceFileFromLibrary(program, nonOverloadDeclaration.getSourceFile())) {
|
|
153214
|
+
return void 0;
|
|
153215
|
+
}
|
|
153216
|
+
const name = tryGetName2(nonOverloadDeclaration);
|
|
153217
|
+
if (name === void 0) {
|
|
153218
|
+
return void 0;
|
|
153219
|
+
}
|
|
153220
|
+
const newParameters = [];
|
|
153221
|
+
const newOptionalParameters = [];
|
|
153222
|
+
const parametersLength = length(nonOverloadDeclaration.parameters);
|
|
153223
|
+
const argumentsLength = length(callExpression.arguments);
|
|
153224
|
+
if (parametersLength > argumentsLength) {
|
|
153225
|
+
return void 0;
|
|
153226
|
+
}
|
|
153227
|
+
const declarations = [nonOverloadDeclaration, ...getOverloads(nonOverloadDeclaration, convertibleSignatureDeclarations)];
|
|
153228
|
+
for (let i = 0, pos2 = 0, paramIndex = 0; i < argumentsLength; i++) {
|
|
153229
|
+
const arg = callExpression.arguments[i];
|
|
153230
|
+
const expr = isAccessExpression(arg) ? getNameOfAccessExpression(arg) : arg;
|
|
153231
|
+
const type2 = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(arg)));
|
|
153232
|
+
const parameter = pos2 < parametersLength ? nonOverloadDeclaration.parameters[pos2] : void 0;
|
|
153233
|
+
if (parameter && checker.isTypeAssignableTo(type2, checker.getTypeAtLocation(parameter))) {
|
|
153234
|
+
pos2++;
|
|
153235
|
+
continue;
|
|
153236
|
+
}
|
|
153237
|
+
const name2 = expr && isIdentifier(expr) ? expr.text : `p${paramIndex++}`;
|
|
153238
|
+
const typeNode = typeToTypeNode(checker, type2, nonOverloadDeclaration);
|
|
153239
|
+
append(newParameters, {
|
|
153240
|
+
pos: i,
|
|
153241
|
+
declaration: createParameter(
|
|
153242
|
+
name2,
|
|
153243
|
+
typeNode,
|
|
153244
|
+
/*questionToken*/
|
|
153245
|
+
void 0
|
|
153246
|
+
)
|
|
153247
|
+
});
|
|
153248
|
+
if (isOptionalPos(declarations, pos2)) {
|
|
153249
|
+
continue;
|
|
153250
|
+
}
|
|
153251
|
+
append(newOptionalParameters, {
|
|
153252
|
+
pos: i,
|
|
153253
|
+
declaration: createParameter(name2, typeNode, factory.createToken(58 /* QuestionToken */))
|
|
153254
|
+
});
|
|
153255
|
+
}
|
|
153256
|
+
return {
|
|
153257
|
+
newParameters,
|
|
153258
|
+
newOptionalParameters,
|
|
153259
|
+
name: declarationNameToString(name),
|
|
153260
|
+
declarations
|
|
153261
|
+
};
|
|
153262
|
+
}
|
|
153263
|
+
function tryGetName2(node) {
|
|
153264
|
+
const name = getNameOfDeclaration(node);
|
|
153265
|
+
if (name) {
|
|
153266
|
+
return name;
|
|
153267
|
+
}
|
|
153268
|
+
if (isVariableDeclaration(node.parent) && isIdentifier(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) {
|
|
153269
|
+
return node.parent.name;
|
|
153270
|
+
}
|
|
153271
|
+
}
|
|
153272
|
+
function typeToTypeNode(checker, type, enclosingDeclaration) {
|
|
153273
|
+
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
153274
|
+
}
|
|
153275
|
+
function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
153276
|
+
forEach(declarations, (declaration) => {
|
|
153277
|
+
if (length(declaration.parameters)) {
|
|
153278
|
+
changes.replaceNodeRangeWithNodes(
|
|
153279
|
+
sourceFile,
|
|
153280
|
+
first(declaration.parameters),
|
|
153281
|
+
last(declaration.parameters),
|
|
153282
|
+
updateParameters(declaration, newParameters),
|
|
153283
|
+
{
|
|
153284
|
+
joiner: ", ",
|
|
153285
|
+
indentation: 0,
|
|
153286
|
+
leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll,
|
|
153287
|
+
trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include
|
|
153288
|
+
}
|
|
153289
|
+
);
|
|
153290
|
+
} else {
|
|
153291
|
+
forEach(updateParameters(declaration, newParameters), (parameter, index) => {
|
|
153292
|
+
if (length(declaration.parameters) === 0 && index === 0) {
|
|
153293
|
+
changes.insertNodeAt(sourceFile, declaration.parameters.end, parameter);
|
|
153294
|
+
} else {
|
|
153295
|
+
changes.insertNodeAtEndOfList(sourceFile, declaration.parameters, parameter);
|
|
153296
|
+
}
|
|
153297
|
+
});
|
|
153298
|
+
}
|
|
153299
|
+
});
|
|
153300
|
+
}
|
|
153301
|
+
function isConvertibleSignatureDeclaration(node) {
|
|
153302
|
+
switch (node.kind) {
|
|
153303
|
+
case 262 /* FunctionDeclaration */:
|
|
153304
|
+
case 218 /* FunctionExpression */:
|
|
153305
|
+
case 174 /* MethodDeclaration */:
|
|
153306
|
+
case 219 /* ArrowFunction */:
|
|
153307
|
+
return true;
|
|
153308
|
+
default:
|
|
153309
|
+
return false;
|
|
153310
|
+
}
|
|
153311
|
+
}
|
|
153312
|
+
function updateParameters(node, newParameters) {
|
|
153313
|
+
const parameters = map(node.parameters, (p) => factory.createParameterDeclaration(
|
|
153314
|
+
p.modifiers,
|
|
153315
|
+
p.dotDotDotToken,
|
|
153316
|
+
p.name,
|
|
153317
|
+
p.questionToken,
|
|
153318
|
+
p.type,
|
|
153319
|
+
p.initializer
|
|
153320
|
+
));
|
|
153321
|
+
for (const { pos, declaration } of newParameters) {
|
|
153322
|
+
const prev = pos > 0 ? parameters[pos - 1] : void 0;
|
|
153323
|
+
parameters.splice(
|
|
153324
|
+
pos,
|
|
153325
|
+
0,
|
|
153326
|
+
factory.updateParameterDeclaration(
|
|
153327
|
+
declaration,
|
|
153328
|
+
declaration.modifiers,
|
|
153329
|
+
declaration.dotDotDotToken,
|
|
153330
|
+
declaration.name,
|
|
153331
|
+
prev && prev.questionToken ? factory.createToken(58 /* QuestionToken */) : declaration.questionToken,
|
|
153332
|
+
declaration.type,
|
|
153333
|
+
declaration.initializer
|
|
153334
|
+
)
|
|
153335
|
+
);
|
|
153336
|
+
}
|
|
153337
|
+
return parameters;
|
|
153338
|
+
}
|
|
153339
|
+
function getOverloads(implementation, declarations) {
|
|
153340
|
+
const overloads = [];
|
|
153341
|
+
for (const declaration of declarations) {
|
|
153342
|
+
if (isOverload(declaration)) {
|
|
153343
|
+
if (length(declaration.parameters) === length(implementation.parameters)) {
|
|
153344
|
+
overloads.push(declaration);
|
|
153345
|
+
continue;
|
|
153346
|
+
}
|
|
153347
|
+
if (length(declaration.parameters) > length(implementation.parameters)) {
|
|
153348
|
+
return [];
|
|
153349
|
+
}
|
|
153350
|
+
}
|
|
153351
|
+
}
|
|
153352
|
+
return overloads;
|
|
153353
|
+
}
|
|
153354
|
+
function isOverload(declaration) {
|
|
153355
|
+
return isConvertibleSignatureDeclaration(declaration) && declaration.body === void 0;
|
|
153356
|
+
}
|
|
153357
|
+
function createParameter(name, type, questionToken) {
|
|
153358
|
+
return factory.createParameterDeclaration(
|
|
153359
|
+
/*modifiers*/
|
|
153360
|
+
void 0,
|
|
153361
|
+
/*dotDotDotToken*/
|
|
153362
|
+
void 0,
|
|
153363
|
+
name,
|
|
153364
|
+
questionToken,
|
|
153365
|
+
type,
|
|
153366
|
+
/*initializer*/
|
|
153367
|
+
void 0
|
|
153368
|
+
);
|
|
153369
|
+
}
|
|
153370
|
+
function isOptionalPos(declarations, pos) {
|
|
153371
|
+
return length(declarations) && some(declarations, (d) => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === void 0);
|
|
153372
|
+
}
|
|
153373
|
+
var addMissingParamFixId, addOptionalParamFixId, errorCodes29;
|
|
153374
|
+
var init_fixAddMissingParam = __esm({
|
|
153375
|
+
"src/services/codefixes/fixAddMissingParam.ts"() {
|
|
153376
|
+
"use strict";
|
|
153377
|
+
init_ts4();
|
|
153378
|
+
init_ts_codefix();
|
|
153379
|
+
addMissingParamFixId = "addMissingParam";
|
|
153380
|
+
addOptionalParamFixId = "addOptionalParam";
|
|
153381
|
+
errorCodes29 = [Diagnostics.Expected_0_arguments_but_got_1.code];
|
|
153382
|
+
registerCodeFix({
|
|
153383
|
+
errorCodes: errorCodes29,
|
|
153384
|
+
fixIds: [addMissingParamFixId, addOptionalParamFixId],
|
|
153385
|
+
getCodeActions(context) {
|
|
153386
|
+
const info = getInfo11(context.sourceFile, context.program, context.span.start);
|
|
153387
|
+
if (info === void 0)
|
|
153388
|
+
return void 0;
|
|
153389
|
+
const { name, declarations, newParameters, newOptionalParameters } = info;
|
|
153390
|
+
const actions2 = [];
|
|
153391
|
+
if (length(newParameters)) {
|
|
153392
|
+
append(
|
|
153393
|
+
actions2,
|
|
153394
|
+
createCodeFixAction(
|
|
153395
|
+
addMissingParamFixId,
|
|
153396
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newParameters)),
|
|
153397
|
+
[length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name],
|
|
153398
|
+
addMissingParamFixId,
|
|
153399
|
+
Diagnostics.Add_all_missing_parameters
|
|
153400
|
+
)
|
|
153401
|
+
);
|
|
153402
|
+
}
|
|
153403
|
+
if (length(newOptionalParameters)) {
|
|
153404
|
+
append(
|
|
153405
|
+
actions2,
|
|
153406
|
+
createCodeFixAction(
|
|
153407
|
+
addOptionalParamFixId,
|
|
153408
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newOptionalParameters)),
|
|
153409
|
+
[length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name],
|
|
153410
|
+
addOptionalParamFixId,
|
|
153411
|
+
Diagnostics.Add_all_optional_parameters
|
|
153412
|
+
)
|
|
153413
|
+
);
|
|
153414
|
+
}
|
|
153415
|
+
return actions2;
|
|
153416
|
+
},
|
|
153417
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes29, (changes, diag2) => {
|
|
153418
|
+
const info = getInfo11(context.sourceFile, context.program, diag2.start);
|
|
153419
|
+
if (info) {
|
|
153420
|
+
const { declarations, newParameters, newOptionalParameters } = info;
|
|
153421
|
+
if (context.fixId === addMissingParamFixId) {
|
|
153422
|
+
doChange19(changes, context.sourceFile, declarations, newParameters);
|
|
153423
|
+
}
|
|
153424
|
+
if (context.fixId === addOptionalParamFixId) {
|
|
153425
|
+
doChange19(changes, context.sourceFile, declarations, newOptionalParameters);
|
|
153426
|
+
}
|
|
153427
|
+
}
|
|
153428
|
+
})
|
|
153429
|
+
});
|
|
153430
|
+
}
|
|
153431
|
+
});
|
|
153432
|
+
|
|
153180
153433
|
// src/services/codefixes/fixCannotFindModule.ts
|
|
153181
153434
|
function getInstallCommand(fileName, packageName) {
|
|
153182
153435
|
return { type: "install package", file: fileName, packageName };
|
|
@@ -153193,7 +153446,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153193
153446
|
var _a;
|
|
153194
153447
|
return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a = host.isKnownTypesPackageName) == null ? void 0 : _a.call(host, packageName)) ? getTypesPackageName(packageName) : void 0;
|
|
153195
153448
|
}
|
|
153196
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
153449
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes30;
|
|
153197
153450
|
var init_fixCannotFindModule = __esm({
|
|
153198
153451
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
153199
153452
|
"use strict";
|
|
@@ -153202,12 +153455,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153202
153455
|
fixName2 = "fixCannotFindModule";
|
|
153203
153456
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
153204
153457
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
153205
|
-
|
|
153458
|
+
errorCodes30 = [
|
|
153206
153459
|
errorCodeCannotFindModule,
|
|
153207
153460
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
153208
153461
|
];
|
|
153209
153462
|
registerCodeFix({
|
|
153210
|
-
errorCodes:
|
|
153463
|
+
errorCodes: errorCodes30,
|
|
153211
153464
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
153212
153465
|
const { host, sourceFile, span: { start } } = context;
|
|
153213
153466
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -153226,7 +153479,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153226
153479
|
},
|
|
153227
153480
|
fixIds: [fixIdInstallTypesPackage],
|
|
153228
153481
|
getAllCodeActions: (context) => {
|
|
153229
|
-
return codeFixAll(context,
|
|
153482
|
+
return codeFixAll(context, errorCodes30, (_changes, diag2, commands) => {
|
|
153230
153483
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
153231
153484
|
if (packageName === void 0)
|
|
153232
153485
|
return void 0;
|
|
@@ -153265,18 +153518,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153265
153518
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
153266
153519
|
return !(flags & 2 /* Private */) && !!(flags & 64 /* Abstract */);
|
|
153267
153520
|
}
|
|
153268
|
-
var
|
|
153521
|
+
var errorCodes31, fixId25;
|
|
153269
153522
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
153270
153523
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
153271
153524
|
"use strict";
|
|
153272
153525
|
init_ts4();
|
|
153273
153526
|
init_ts_codefix();
|
|
153274
|
-
|
|
153527
|
+
errorCodes31 = [
|
|
153275
153528
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1.code
|
|
153276
153529
|
];
|
|
153277
153530
|
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
153278
153531
|
registerCodeFix({
|
|
153279
|
-
errorCodes:
|
|
153532
|
+
errorCodes: errorCodes31,
|
|
153280
153533
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
153281
153534
|
const { sourceFile, span } = context;
|
|
153282
153535
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
@@ -153285,7 +153538,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153285
153538
|
fixIds: [fixId25],
|
|
153286
153539
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
153287
153540
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
153288
|
-
return codeFixAll(context,
|
|
153541
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
153289
153542
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
153290
153543
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
153291
153544
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -153297,7 +153550,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153297
153550
|
});
|
|
153298
153551
|
|
|
153299
153552
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
153300
|
-
function
|
|
153553
|
+
function doChange20(changes, sourceFile, constructor, superCall) {
|
|
153301
153554
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
153302
153555
|
changes.delete(sourceFile, superCall);
|
|
153303
153556
|
}
|
|
@@ -153312,36 +153565,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153312
153565
|
function findSuperCall(n) {
|
|
153313
153566
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
153314
153567
|
}
|
|
153315
|
-
var fixId26,
|
|
153568
|
+
var fixId26, errorCodes32;
|
|
153316
153569
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
153317
153570
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
153318
153571
|
"use strict";
|
|
153319
153572
|
init_ts4();
|
|
153320
153573
|
init_ts_codefix();
|
|
153321
153574
|
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
153322
|
-
|
|
153575
|
+
errorCodes32 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
153323
153576
|
registerCodeFix({
|
|
153324
|
-
errorCodes:
|
|
153577
|
+
errorCodes: errorCodes32,
|
|
153325
153578
|
getCodeActions(context) {
|
|
153326
153579
|
const { sourceFile, span } = context;
|
|
153327
153580
|
const nodes = getNodes(sourceFile, span.start);
|
|
153328
153581
|
if (!nodes)
|
|
153329
153582
|
return void 0;
|
|
153330
153583
|
const { constructor, superCall } = nodes;
|
|
153331
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153584
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, constructor, superCall));
|
|
153332
153585
|
return [createCodeFixAction(fixId26, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId26, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
|
|
153333
153586
|
},
|
|
153334
153587
|
fixIds: [fixId26],
|
|
153335
153588
|
getAllCodeActions(context) {
|
|
153336
153589
|
const { sourceFile } = context;
|
|
153337
153590
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
153338
|
-
return codeFixAll(context,
|
|
153591
|
+
return codeFixAll(context, errorCodes32, (changes, diag2) => {
|
|
153339
153592
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
153340
153593
|
if (!nodes)
|
|
153341
153594
|
return;
|
|
153342
153595
|
const { constructor, superCall } = nodes;
|
|
153343
153596
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
153344
|
-
|
|
153597
|
+
doChange20(changes, sourceFile, constructor, superCall);
|
|
153345
153598
|
}
|
|
153346
153599
|
});
|
|
153347
153600
|
}
|
|
@@ -153355,7 +153608,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153355
153608
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
153356
153609
|
return token.parent;
|
|
153357
153610
|
}
|
|
153358
|
-
function
|
|
153611
|
+
function doChange21(changes, sourceFile, ctr) {
|
|
153359
153612
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
153360
153613
|
factory.createSuper(),
|
|
153361
153614
|
/*typeArguments*/
|
|
@@ -153365,66 +153618,66 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153365
153618
|
));
|
|
153366
153619
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
153367
153620
|
}
|
|
153368
|
-
var fixId27,
|
|
153621
|
+
var fixId27, errorCodes33;
|
|
153369
153622
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
153370
153623
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
153371
153624
|
"use strict";
|
|
153372
153625
|
init_ts4();
|
|
153373
153626
|
init_ts_codefix();
|
|
153374
153627
|
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
153375
|
-
|
|
153628
|
+
errorCodes33 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
153376
153629
|
registerCodeFix({
|
|
153377
|
-
errorCodes:
|
|
153630
|
+
errorCodes: errorCodes33,
|
|
153378
153631
|
getCodeActions(context) {
|
|
153379
153632
|
const { sourceFile, span } = context;
|
|
153380
153633
|
const ctr = getNode(sourceFile, span.start);
|
|
153381
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153634
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, ctr));
|
|
153382
153635
|
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
153383
153636
|
},
|
|
153384
153637
|
fixIds: [fixId27],
|
|
153385
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153638
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes, diag2) => doChange21(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
153386
153639
|
});
|
|
153387
153640
|
}
|
|
153388
153641
|
});
|
|
153389
153642
|
|
|
153390
153643
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
153391
|
-
function
|
|
153644
|
+
function doChange22(changeTracker, configFile) {
|
|
153392
153645
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
153393
153646
|
}
|
|
153394
|
-
var fixID,
|
|
153647
|
+
var fixID, errorCodes34;
|
|
153395
153648
|
var init_fixEnableJsxFlag = __esm({
|
|
153396
153649
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
153397
153650
|
"use strict";
|
|
153398
153651
|
init_ts4();
|
|
153399
153652
|
init_ts_codefix();
|
|
153400
153653
|
fixID = "fixEnableJsxFlag";
|
|
153401
|
-
|
|
153654
|
+
errorCodes34 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
153402
153655
|
registerCodeFix({
|
|
153403
|
-
errorCodes:
|
|
153656
|
+
errorCodes: errorCodes34,
|
|
153404
153657
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
153405
153658
|
const { configFile } = context.program.getCompilerOptions();
|
|
153406
153659
|
if (configFile === void 0) {
|
|
153407
153660
|
return void 0;
|
|
153408
153661
|
}
|
|
153409
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) =>
|
|
153662
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => doChange22(changeTracker, configFile));
|
|
153410
153663
|
return [
|
|
153411
153664
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
153412
153665
|
];
|
|
153413
153666
|
},
|
|
153414
153667
|
fixIds: [fixID],
|
|
153415
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153668
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes) => {
|
|
153416
153669
|
const { configFile } = context.program.getCompilerOptions();
|
|
153417
153670
|
if (configFile === void 0) {
|
|
153418
153671
|
return void 0;
|
|
153419
153672
|
}
|
|
153420
|
-
|
|
153673
|
+
doChange22(changes, configFile);
|
|
153421
153674
|
})
|
|
153422
153675
|
});
|
|
153423
153676
|
}
|
|
153424
153677
|
});
|
|
153425
153678
|
|
|
153426
153679
|
// src/services/codefixes/fixNaNEquality.ts
|
|
153427
|
-
function
|
|
153680
|
+
function getInfo12(program, sourceFile, span) {
|
|
153428
153681
|
const diag2 = find(program.getSemanticDiagnostics(sourceFile), (diag3) => diag3.start === span.start && diag3.length === span.length);
|
|
153429
153682
|
if (diag2 === void 0 || diag2.relatedInformation === void 0)
|
|
153430
153683
|
return;
|
|
@@ -153439,7 +153692,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153439
153692
|
}
|
|
153440
153693
|
return void 0;
|
|
153441
153694
|
}
|
|
153442
|
-
function
|
|
153695
|
+
function doChange23(changes, sourceFile, arg, expression) {
|
|
153443
153696
|
const callExpression = factory.createCallExpression(
|
|
153444
153697
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
153445
153698
|
/*typeArguments*/
|
|
@@ -153457,33 +153710,33 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153457
153710
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/'(.*)'/) || [];
|
|
153458
153711
|
return suggestion;
|
|
153459
153712
|
}
|
|
153460
|
-
var fixId28,
|
|
153713
|
+
var fixId28, errorCodes35;
|
|
153461
153714
|
var init_fixNaNEquality = __esm({
|
|
153462
153715
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
153463
153716
|
"use strict";
|
|
153464
153717
|
init_ts4();
|
|
153465
153718
|
init_ts_codefix();
|
|
153466
153719
|
fixId28 = "fixNaNEquality";
|
|
153467
|
-
|
|
153720
|
+
errorCodes35 = [
|
|
153468
153721
|
Diagnostics.This_condition_will_always_return_0.code
|
|
153469
153722
|
];
|
|
153470
153723
|
registerCodeFix({
|
|
153471
|
-
errorCodes:
|
|
153724
|
+
errorCodes: errorCodes35,
|
|
153472
153725
|
getCodeActions(context) {
|
|
153473
153726
|
const { sourceFile, span, program } = context;
|
|
153474
|
-
const info =
|
|
153727
|
+
const info = getInfo12(program, sourceFile, span);
|
|
153475
153728
|
if (info === void 0)
|
|
153476
153729
|
return;
|
|
153477
153730
|
const { suggestion, expression, arg } = info;
|
|
153478
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153731
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, arg, expression));
|
|
153479
153732
|
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
153480
153733
|
},
|
|
153481
153734
|
fixIds: [fixId28],
|
|
153482
153735
|
getAllCodeActions: (context) => {
|
|
153483
|
-
return codeFixAll(context,
|
|
153484
|
-
const info =
|
|
153736
|
+
return codeFixAll(context, errorCodes35, (changes, diag2) => {
|
|
153737
|
+
const info = getInfo12(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
153485
153738
|
if (info) {
|
|
153486
|
-
|
|
153739
|
+
doChange23(changes, diag2.file, info.arg, info.expression);
|
|
153487
153740
|
}
|
|
153488
153741
|
});
|
|
153489
153742
|
}
|
|
@@ -153499,9 +153752,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153499
153752
|
init_ts_codefix();
|
|
153500
153753
|
registerCodeFix({
|
|
153501
153754
|
errorCodes: [
|
|
153502
|
-
Diagnostics.
|
|
153503
|
-
Diagnostics.
|
|
153504
|
-
Diagnostics.
|
|
153755
|
+
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.code,
|
|
153756
|
+
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.code,
|
|
153757
|
+
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.code
|
|
153505
153758
|
],
|
|
153506
153759
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
153507
153760
|
const compilerOptions = context.program.getCompilerOptions();
|
|
@@ -153540,32 +153793,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153540
153793
|
});
|
|
153541
153794
|
|
|
153542
153795
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
153543
|
-
function
|
|
153796
|
+
function doChange24(changes, sourceFile, node) {
|
|
153544
153797
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
153545
153798
|
}
|
|
153546
153799
|
function getProperty2(sourceFile, pos) {
|
|
153547
153800
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
153548
153801
|
}
|
|
153549
|
-
var fixId29,
|
|
153802
|
+
var fixId29, errorCodes36;
|
|
153550
153803
|
var init_fixPropertyAssignment = __esm({
|
|
153551
153804
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
153552
153805
|
"use strict";
|
|
153553
153806
|
init_ts4();
|
|
153554
153807
|
init_ts_codefix();
|
|
153555
153808
|
fixId29 = "fixPropertyAssignment";
|
|
153556
|
-
|
|
153809
|
+
errorCodes36 = [
|
|
153557
153810
|
Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern.code
|
|
153558
153811
|
];
|
|
153559
153812
|
registerCodeFix({
|
|
153560
|
-
errorCodes:
|
|
153813
|
+
errorCodes: errorCodes36,
|
|
153561
153814
|
fixIds: [fixId29],
|
|
153562
153815
|
getCodeActions(context) {
|
|
153563
153816
|
const { sourceFile, span } = context;
|
|
153564
153817
|
const property = getProperty2(sourceFile, span.start);
|
|
153565
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153818
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, context.sourceFile, property));
|
|
153566
153819
|
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
153567
153820
|
},
|
|
153568
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153821
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
153569
153822
|
});
|
|
153570
153823
|
}
|
|
153571
153824
|
});
|
|
@@ -153591,16 +153844,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153591
153844
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
153592
153845
|
}
|
|
153593
153846
|
}
|
|
153594
|
-
var fixId30,
|
|
153847
|
+
var fixId30, errorCodes37;
|
|
153595
153848
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
153596
153849
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
153597
153850
|
"use strict";
|
|
153598
153851
|
init_ts4();
|
|
153599
153852
|
init_ts_codefix();
|
|
153600
153853
|
fixId30 = "extendsInterfaceBecomesImplements";
|
|
153601
|
-
|
|
153854
|
+
errorCodes37 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
153602
153855
|
registerCodeFix({
|
|
153603
|
-
errorCodes:
|
|
153856
|
+
errorCodes: errorCodes37,
|
|
153604
153857
|
getCodeActions(context) {
|
|
153605
153858
|
const { sourceFile } = context;
|
|
153606
153859
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -153611,7 +153864,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153611
153864
|
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
153612
153865
|
},
|
|
153613
153866
|
fixIds: [fixId30],
|
|
153614
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153867
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
153615
153868
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
153616
153869
|
if (nodes)
|
|
153617
153870
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -153621,17 +153874,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153621
153874
|
});
|
|
153622
153875
|
|
|
153623
153876
|
// src/services/codefixes/fixForgottenThisPropertyAccess.ts
|
|
153624
|
-
function
|
|
153877
|
+
function getInfo13(sourceFile, pos, diagCode) {
|
|
153625
153878
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
153626
153879
|
if (isIdentifier(node) || isPrivateIdentifier(node)) {
|
|
153627
153880
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
153628
153881
|
}
|
|
153629
153882
|
}
|
|
153630
|
-
function
|
|
153883
|
+
function doChange25(changes, sourceFile, { node, className }) {
|
|
153631
153884
|
suppressLeadingAndTrailingTrivia(node);
|
|
153632
153885
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
153633
153886
|
}
|
|
153634
|
-
var fixId31, didYouMeanStaticMemberCode,
|
|
153887
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes38;
|
|
153635
153888
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
153636
153889
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
153637
153890
|
"use strict";
|
|
@@ -153639,27 +153892,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153639
153892
|
init_ts_codefix();
|
|
153640
153893
|
fixId31 = "forgottenThisPropertyAccess";
|
|
153641
153894
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
153642
|
-
|
|
153895
|
+
errorCodes38 = [
|
|
153643
153896
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
153644
153897
|
Diagnostics.Private_identifiers_are_only_allowed_in_class_bodies_and_may_only_be_used_as_part_of_a_class_member_declaration_property_access_or_on_the_left_hand_side_of_an_in_expression.code,
|
|
153645
153898
|
didYouMeanStaticMemberCode
|
|
153646
153899
|
];
|
|
153647
153900
|
registerCodeFix({
|
|
153648
|
-
errorCodes:
|
|
153901
|
+
errorCodes: errorCodes38,
|
|
153649
153902
|
getCodeActions(context) {
|
|
153650
153903
|
const { sourceFile } = context;
|
|
153651
|
-
const info =
|
|
153904
|
+
const info = getInfo13(sourceFile, context.span.start, context.errorCode);
|
|
153652
153905
|
if (!info) {
|
|
153653
153906
|
return void 0;
|
|
153654
153907
|
}
|
|
153655
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153908
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, info));
|
|
153656
153909
|
return [createCodeFixAction(fixId31, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId31, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)];
|
|
153657
153910
|
},
|
|
153658
153911
|
fixIds: [fixId31],
|
|
153659
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153660
|
-
const info =
|
|
153912
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes38, (changes, diag2) => {
|
|
153913
|
+
const info = getInfo13(diag2.file, diag2.start, diag2.code);
|
|
153661
153914
|
if (info)
|
|
153662
|
-
|
|
153915
|
+
doChange25(changes, context.sourceFile, info);
|
|
153663
153916
|
})
|
|
153664
153917
|
});
|
|
153665
153918
|
}
|
|
@@ -153669,7 +153922,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153669
153922
|
function isValidCharacter(character) {
|
|
153670
153923
|
return hasProperty(htmlEntity, character);
|
|
153671
153924
|
}
|
|
153672
|
-
function
|
|
153925
|
+
function doChange26(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
153673
153926
|
const character = sourceFile.getText()[start];
|
|
153674
153927
|
if (!isValidCharacter(character)) {
|
|
153675
153928
|
return;
|
|
@@ -153677,7 +153930,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153677
153930
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
153678
153931
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
153679
153932
|
}
|
|
153680
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
153933
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes39, htmlEntity;
|
|
153681
153934
|
var init_fixInvalidJsxCharacters = __esm({
|
|
153682
153935
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
153683
153936
|
"use strict";
|
|
@@ -153685,16 +153938,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153685
153938
|
init_ts_codefix();
|
|
153686
153939
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
153687
153940
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
153688
|
-
|
|
153941
|
+
errorCodes39 = [
|
|
153689
153942
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
153690
153943
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
153691
153944
|
];
|
|
153692
153945
|
registerCodeFix({
|
|
153693
|
-
errorCodes:
|
|
153946
|
+
errorCodes: errorCodes39,
|
|
153694
153947
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
153695
153948
|
getCodeActions(context) {
|
|
153696
153949
|
const { sourceFile, preferences, span } = context;
|
|
153697
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153950
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
153698
153951
|
t,
|
|
153699
153952
|
preferences,
|
|
153700
153953
|
sourceFile,
|
|
@@ -153702,7 +153955,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153702
153955
|
/*useHtmlEntity*/
|
|
153703
153956
|
false
|
|
153704
153957
|
));
|
|
153705
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153958
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
153706
153959
|
t,
|
|
153707
153960
|
preferences,
|
|
153708
153961
|
sourceFile,
|
|
@@ -153716,7 +153969,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153716
153969
|
];
|
|
153717
153970
|
},
|
|
153718
153971
|
getAllCodeActions(context) {
|
|
153719
|
-
return codeFixAll(context,
|
|
153972
|
+
return codeFixAll(context, errorCodes39, (changes, diagnostic) => doChange26(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
153720
153973
|
}
|
|
153721
153974
|
});
|
|
153722
153975
|
htmlEntity = {
|
|
@@ -153763,7 +154016,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153763
154016
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
|
|
153764
154017
|
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
|
|
153765
154018
|
}
|
|
153766
|
-
function
|
|
154019
|
+
function getInfo14(sourceFile, pos) {
|
|
153767
154020
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
153768
154021
|
if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier(token.parent.name)) {
|
|
153769
154022
|
const jsDocParameterTag = token.parent;
|
|
@@ -153775,7 +154028,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153775
154028
|
}
|
|
153776
154029
|
return void 0;
|
|
153777
154030
|
}
|
|
153778
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
154031
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes40;
|
|
153779
154032
|
var init_fixUnmatchedParameter = __esm({
|
|
153780
154033
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
153781
154034
|
"use strict";
|
|
@@ -153783,16 +154036,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153783
154036
|
init_ts_codefix();
|
|
153784
154037
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
153785
154038
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
153786
|
-
|
|
154039
|
+
errorCodes40 = [
|
|
153787
154040
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
153788
154041
|
];
|
|
153789
154042
|
registerCodeFix({
|
|
153790
154043
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
153791
|
-
errorCodes:
|
|
154044
|
+
errorCodes: errorCodes40,
|
|
153792
154045
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
153793
154046
|
const { sourceFile, span } = context;
|
|
153794
154047
|
const actions2 = [];
|
|
153795
|
-
const info =
|
|
154048
|
+
const info = getInfo14(sourceFile, span.start);
|
|
153796
154049
|
if (info) {
|
|
153797
154050
|
append(actions2, getDeleteAction(context, info));
|
|
153798
154051
|
append(actions2, getRenameAction(context, info));
|
|
@@ -153803,8 +154056,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153803
154056
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
153804
154057
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
153805
154058
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
153806
|
-
eachDiagnostic(context,
|
|
153807
|
-
const info =
|
|
154059
|
+
eachDiagnostic(context, errorCodes40, ({ file, start }) => {
|
|
154060
|
+
const info = getInfo14(file, start);
|
|
153808
154061
|
if (info) {
|
|
153809
154062
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
153810
154063
|
}
|
|
@@ -153852,16 +154105,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153852
154105
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
153853
154106
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
153854
154107
|
}
|
|
153855
|
-
var fixId32,
|
|
154108
|
+
var fixId32, errorCodes41;
|
|
153856
154109
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
153857
154110
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
153858
154111
|
"use strict";
|
|
153859
154112
|
init_ts4();
|
|
153860
154113
|
init_ts_codefix();
|
|
153861
154114
|
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
153862
|
-
|
|
154115
|
+
errorCodes41 = [Diagnostics.A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled.code];
|
|
153863
154116
|
registerCodeFix({
|
|
153864
|
-
errorCodes:
|
|
154117
|
+
errorCodes: errorCodes41,
|
|
153865
154118
|
getCodeActions: (context) => {
|
|
153866
154119
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
153867
154120
|
if (!importDeclaration)
|
|
@@ -154048,7 +154301,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154048
154301
|
function mayDeleteExpression(node) {
|
|
154049
154302
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
154050
154303
|
}
|
|
154051
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
154304
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes42;
|
|
154052
154305
|
var init_fixUnusedIdentifier = __esm({
|
|
154053
154306
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
154054
154307
|
"use strict";
|
|
@@ -154059,7 +154312,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154059
154312
|
fixIdDelete = "unusedIdentifier_delete";
|
|
154060
154313
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
154061
154314
|
fixIdInfer = "unusedIdentifier_infer";
|
|
154062
|
-
|
|
154315
|
+
errorCodes42 = [
|
|
154063
154316
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
154064
154317
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
154065
154318
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -154069,7 +154322,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154069
154322
|
Diagnostics.All_type_parameters_are_unused.code
|
|
154070
154323
|
];
|
|
154071
154324
|
registerCodeFix({
|
|
154072
|
-
errorCodes:
|
|
154325
|
+
errorCodes: errorCodes42,
|
|
154073
154326
|
getCodeActions(context) {
|
|
154074
154327
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
154075
154328
|
const checker = program.getTypeChecker();
|
|
@@ -154155,7 +154408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154155
154408
|
const { sourceFile, program, cancellationToken } = context;
|
|
154156
154409
|
const checker = program.getTypeChecker();
|
|
154157
154410
|
const sourceFiles = program.getSourceFiles();
|
|
154158
|
-
return codeFixAll(context,
|
|
154411
|
+
return codeFixAll(context, errorCodes42, (changes, diag2) => {
|
|
154159
154412
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
154160
154413
|
switch (context.fixId) {
|
|
154161
154414
|
case fixIdPrefix:
|
|
@@ -154227,7 +154480,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154227
154480
|
});
|
|
154228
154481
|
|
|
154229
154482
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
154230
|
-
function
|
|
154483
|
+
function doChange27(changes, sourceFile, start, length2, errorCode) {
|
|
154231
154484
|
const token = getTokenAtPosition(sourceFile, start);
|
|
154232
154485
|
const statement = findAncestor(token, isStatement);
|
|
154233
154486
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -154275,31 +154528,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154275
154528
|
}
|
|
154276
154529
|
return last2;
|
|
154277
154530
|
}
|
|
154278
|
-
var fixId33,
|
|
154531
|
+
var fixId33, errorCodes43;
|
|
154279
154532
|
var init_fixUnreachableCode = __esm({
|
|
154280
154533
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
154281
154534
|
"use strict";
|
|
154282
154535
|
init_ts4();
|
|
154283
154536
|
init_ts_codefix();
|
|
154284
154537
|
fixId33 = "fixUnreachableCode";
|
|
154285
|
-
|
|
154538
|
+
errorCodes43 = [Diagnostics.Unreachable_code_detected.code];
|
|
154286
154539
|
registerCodeFix({
|
|
154287
|
-
errorCodes:
|
|
154540
|
+
errorCodes: errorCodes43,
|
|
154288
154541
|
getCodeActions(context) {
|
|
154289
154542
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
154290
154543
|
if (syntacticDiagnostics.length)
|
|
154291
154544
|
return;
|
|
154292
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154545
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
154293
154546
|
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
154294
154547
|
},
|
|
154295
154548
|
fixIds: [fixId33],
|
|
154296
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154549
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
154297
154550
|
});
|
|
154298
154551
|
}
|
|
154299
154552
|
});
|
|
154300
154553
|
|
|
154301
154554
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
154302
|
-
function
|
|
154555
|
+
function doChange28(changes, sourceFile, start) {
|
|
154303
154556
|
const token = getTokenAtPosition(sourceFile, start);
|
|
154304
154557
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
154305
154558
|
const pos = token.getStart(sourceFile);
|
|
@@ -154312,28 +154565,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154312
154565
|
);
|
|
154313
154566
|
changes.deleteRange(sourceFile, { pos, end });
|
|
154314
154567
|
}
|
|
154315
|
-
var fixId34,
|
|
154568
|
+
var fixId34, errorCodes44;
|
|
154316
154569
|
var init_fixUnusedLabel = __esm({
|
|
154317
154570
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
154318
154571
|
"use strict";
|
|
154319
154572
|
init_ts4();
|
|
154320
154573
|
init_ts_codefix();
|
|
154321
154574
|
fixId34 = "fixUnusedLabel";
|
|
154322
|
-
|
|
154575
|
+
errorCodes44 = [Diagnostics.Unused_label.code];
|
|
154323
154576
|
registerCodeFix({
|
|
154324
|
-
errorCodes:
|
|
154577
|
+
errorCodes: errorCodes44,
|
|
154325
154578
|
getCodeActions(context) {
|
|
154326
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154579
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, context.sourceFile, context.span.start));
|
|
154327
154580
|
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
154328
154581
|
},
|
|
154329
154582
|
fixIds: [fixId34],
|
|
154330
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154583
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => doChange28(changes, diag2.file, diag2.start))
|
|
154331
154584
|
});
|
|
154332
154585
|
}
|
|
154333
154586
|
});
|
|
154334
154587
|
|
|
154335
154588
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
154336
|
-
function
|
|
154589
|
+
function doChange29(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
154337
154590
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
154338
154591
|
newType,
|
|
154339
154592
|
/*enclosingDeclaration*/
|
|
@@ -154342,7 +154595,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154342
154595
|
void 0
|
|
154343
154596
|
));
|
|
154344
154597
|
}
|
|
154345
|
-
function
|
|
154598
|
+
function getInfo15(sourceFile, pos, checker) {
|
|
154346
154599
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
154347
154600
|
const typeNode = decl && decl.type;
|
|
154348
154601
|
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
@@ -154382,7 +154635,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154382
154635
|
}
|
|
154383
154636
|
return checker.getTypeFromTypeNode(node);
|
|
154384
154637
|
}
|
|
154385
|
-
var fixIdPlain, fixIdNullable,
|
|
154638
|
+
var fixIdPlain, fixIdNullable, errorCodes45;
|
|
154386
154639
|
var init_fixJSDocTypes = __esm({
|
|
154387
154640
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
154388
154641
|
"use strict";
|
|
@@ -154390,17 +154643,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154390
154643
|
init_ts_codefix();
|
|
154391
154644
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
154392
154645
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
154393
|
-
|
|
154646
|
+
errorCodes45 = [
|
|
154394
154647
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
154395
154648
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
154396
154649
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
154397
154650
|
];
|
|
154398
154651
|
registerCodeFix({
|
|
154399
|
-
errorCodes:
|
|
154652
|
+
errorCodes: errorCodes45,
|
|
154400
154653
|
getCodeActions(context) {
|
|
154401
154654
|
const { sourceFile } = context;
|
|
154402
154655
|
const checker = context.program.getTypeChecker();
|
|
154403
|
-
const info =
|
|
154656
|
+
const info = getInfo15(sourceFile, context.span.start, checker);
|
|
154404
154657
|
if (!info)
|
|
154405
154658
|
return void 0;
|
|
154406
154659
|
const { typeNode, type } = info;
|
|
@@ -154411,7 +154664,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154411
154664
|
}
|
|
154412
154665
|
return actions2;
|
|
154413
154666
|
function fix(type2, fixId52, fixAllDescription) {
|
|
154414
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154667
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
|
|
154415
154668
|
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
154416
154669
|
}
|
|
154417
154670
|
},
|
|
@@ -154419,13 +154672,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154419
154672
|
getAllCodeActions(context) {
|
|
154420
154673
|
const { fixId: fixId52, program, sourceFile } = context;
|
|
154421
154674
|
const checker = program.getTypeChecker();
|
|
154422
|
-
return codeFixAll(context,
|
|
154423
|
-
const info =
|
|
154675
|
+
return codeFixAll(context, errorCodes45, (changes, err) => {
|
|
154676
|
+
const info = getInfo15(err.file, err.start, checker);
|
|
154424
154677
|
if (!info)
|
|
154425
154678
|
return;
|
|
154426
154679
|
const { typeNode, type } = info;
|
|
154427
154680
|
const fixedType = typeNode.kind === 321 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
154428
|
-
|
|
154681
|
+
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
154429
154682
|
});
|
|
154430
154683
|
}
|
|
154431
154684
|
});
|
|
@@ -154433,7 +154686,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154433
154686
|
});
|
|
154434
154687
|
|
|
154435
154688
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
154436
|
-
function
|
|
154689
|
+
function doChange30(changes, sourceFile, name) {
|
|
154437
154690
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
154438
154691
|
}
|
|
154439
154692
|
function getCallName(sourceFile, start) {
|
|
@@ -154450,31 +154703,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154450
154703
|
}
|
|
154451
154704
|
return void 0;
|
|
154452
154705
|
}
|
|
154453
|
-
var fixId35,
|
|
154706
|
+
var fixId35, errorCodes46;
|
|
154454
154707
|
var init_fixMissingCallParentheses = __esm({
|
|
154455
154708
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
154456
154709
|
"use strict";
|
|
154457
154710
|
init_ts4();
|
|
154458
154711
|
init_ts_codefix();
|
|
154459
154712
|
fixId35 = "fixMissingCallParentheses";
|
|
154460
|
-
|
|
154713
|
+
errorCodes46 = [
|
|
154461
154714
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
154462
154715
|
];
|
|
154463
154716
|
registerCodeFix({
|
|
154464
|
-
errorCodes:
|
|
154717
|
+
errorCodes: errorCodes46,
|
|
154465
154718
|
fixIds: [fixId35],
|
|
154466
154719
|
getCodeActions(context) {
|
|
154467
154720
|
const { sourceFile, span } = context;
|
|
154468
154721
|
const callName = getCallName(sourceFile, span.start);
|
|
154469
154722
|
if (!callName)
|
|
154470
154723
|
return;
|
|
154471
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154724
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, context.sourceFile, callName));
|
|
154472
154725
|
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
154473
154726
|
},
|
|
154474
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154727
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
154475
154728
|
const callName = getCallName(diag2.file, diag2.start);
|
|
154476
154729
|
if (callName)
|
|
154477
|
-
|
|
154730
|
+
doChange30(changes, diag2.file, callName);
|
|
154478
154731
|
})
|
|
154479
154732
|
});
|
|
154480
154733
|
}
|
|
@@ -154516,7 +154769,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154516
154769
|
returnType: getReturnType(containingFunction)
|
|
154517
154770
|
};
|
|
154518
154771
|
}
|
|
154519
|
-
function
|
|
154772
|
+
function doChange31(changes, sourceFile, { insertBefore, returnType }) {
|
|
154520
154773
|
if (returnType) {
|
|
154521
154774
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
154522
154775
|
if (!entityName || entityName.kind !== 80 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -154525,37 +154778,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154525
154778
|
}
|
|
154526
154779
|
changes.insertModifierBefore(sourceFile, 134 /* AsyncKeyword */, insertBefore);
|
|
154527
154780
|
}
|
|
154528
|
-
var fixId36,
|
|
154781
|
+
var fixId36, errorCodes47;
|
|
154529
154782
|
var init_fixAwaitInSyncFunction = __esm({
|
|
154530
154783
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
154531
154784
|
"use strict";
|
|
154532
154785
|
init_ts4();
|
|
154533
154786
|
init_ts_codefix();
|
|
154534
154787
|
fixId36 = "fixAwaitInSyncFunction";
|
|
154535
|
-
|
|
154788
|
+
errorCodes47 = [
|
|
154536
154789
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154537
154790
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154538
154791
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154539
154792
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
154540
154793
|
];
|
|
154541
154794
|
registerCodeFix({
|
|
154542
|
-
errorCodes:
|
|
154795
|
+
errorCodes: errorCodes47,
|
|
154543
154796
|
getCodeActions(context) {
|
|
154544
154797
|
const { sourceFile, span } = context;
|
|
154545
154798
|
const nodes = getNodes3(sourceFile, span.start);
|
|
154546
154799
|
if (!nodes)
|
|
154547
154800
|
return void 0;
|
|
154548
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154801
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes));
|
|
154549
154802
|
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
154550
154803
|
},
|
|
154551
154804
|
fixIds: [fixId36],
|
|
154552
154805
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
154553
154806
|
const seen = /* @__PURE__ */ new Map();
|
|
154554
|
-
return codeFixAll(context,
|
|
154807
|
+
return codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
154555
154808
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
154556
154809
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
154557
154810
|
return;
|
|
154558
|
-
|
|
154811
|
+
doChange31(changes, context.sourceFile, nodes);
|
|
154559
154812
|
});
|
|
154560
154813
|
}
|
|
154561
154814
|
});
|
|
@@ -154563,7 +154816,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154563
154816
|
});
|
|
154564
154817
|
|
|
154565
154818
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
154566
|
-
function
|
|
154819
|
+
function doChange32(file, start, length2, code, context) {
|
|
154567
154820
|
let startPosition;
|
|
154568
154821
|
let endPosition;
|
|
154569
154822
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -154590,28 +154843,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154590
154843
|
}
|
|
154591
154844
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
154592
154845
|
}
|
|
154593
|
-
var
|
|
154846
|
+
var errorCodes48, fixId37;
|
|
154594
154847
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
154595
154848
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
154596
154849
|
"use strict";
|
|
154597
154850
|
init_ts4();
|
|
154598
154851
|
init_ts_codefix();
|
|
154599
|
-
|
|
154852
|
+
errorCodes48 = [
|
|
154600
154853
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
154601
154854
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
154602
154855
|
];
|
|
154603
154856
|
fixId37 = "fixPropertyOverrideAccessor";
|
|
154604
154857
|
registerCodeFix({
|
|
154605
|
-
errorCodes:
|
|
154858
|
+
errorCodes: errorCodes48,
|
|
154606
154859
|
getCodeActions(context) {
|
|
154607
|
-
const edits =
|
|
154860
|
+
const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
154608
154861
|
if (edits) {
|
|
154609
154862
|
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
154610
154863
|
}
|
|
154611
154864
|
},
|
|
154612
154865
|
fixIds: [fixId37],
|
|
154613
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154614
|
-
const edits =
|
|
154866
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
154867
|
+
const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
154615
154868
|
if (edits) {
|
|
154616
154869
|
for (const edit of edits) {
|
|
154617
154870
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -154658,7 +154911,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154658
154911
|
}
|
|
154659
154912
|
return errorCode;
|
|
154660
154913
|
}
|
|
154661
|
-
function
|
|
154914
|
+
function doChange33(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
154662
154915
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 80 /* Identifier */ && token.kind !== 26 /* DotDotDotToken */ && token.kind !== 110 /* ThisKeyword */) {
|
|
154663
154916
|
return void 0;
|
|
154664
154917
|
}
|
|
@@ -155555,14 +155808,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155555
155808
|
}
|
|
155556
155809
|
}
|
|
155557
155810
|
}
|
|
155558
|
-
var fixId38,
|
|
155811
|
+
var fixId38, errorCodes49;
|
|
155559
155812
|
var init_inferFromUsage = __esm({
|
|
155560
155813
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
155561
155814
|
"use strict";
|
|
155562
155815
|
init_ts4();
|
|
155563
155816
|
init_ts_codefix();
|
|
155564
155817
|
fixId38 = "inferFromUsage";
|
|
155565
|
-
|
|
155818
|
+
errorCodes49 = [
|
|
155566
155819
|
// Variable declarations
|
|
155567
155820
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
155568
155821
|
// Variable uses
|
|
@@ -155596,13 +155849,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155596
155849
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
155597
155850
|
];
|
|
155598
155851
|
registerCodeFix({
|
|
155599
|
-
errorCodes:
|
|
155852
|
+
errorCodes: errorCodes49,
|
|
155600
155853
|
getCodeActions(context) {
|
|
155601
155854
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
155602
155855
|
const token = getTokenAtPosition(sourceFile, start);
|
|
155603
155856
|
let declaration;
|
|
155604
155857
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
155605
|
-
declaration =
|
|
155858
|
+
declaration = doChange33(
|
|
155606
155859
|
changes2,
|
|
155607
155860
|
sourceFile,
|
|
155608
155861
|
token,
|
|
@@ -155622,8 +155875,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155622
155875
|
getAllCodeActions(context) {
|
|
155623
155876
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
155624
155877
|
const markSeen = nodeSeenTracker();
|
|
155625
|
-
return codeFixAll(context,
|
|
155626
|
-
|
|
155878
|
+
return codeFixAll(context, errorCodes49, (changes, err) => {
|
|
155879
|
+
doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
155627
155880
|
});
|
|
155628
155881
|
}
|
|
155629
155882
|
});
|
|
@@ -155631,7 +155884,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155631
155884
|
});
|
|
155632
155885
|
|
|
155633
155886
|
// src/services/codefixes/fixReturnTypeInAsyncFunction.ts
|
|
155634
|
-
function
|
|
155887
|
+
function getInfo16(sourceFile, checker, pos) {
|
|
155635
155888
|
if (isInJSFile(sourceFile)) {
|
|
155636
155889
|
return void 0;
|
|
155637
155890
|
}
|
|
@@ -155654,31 +155907,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155654
155907
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
155655
155908
|
}
|
|
155656
155909
|
}
|
|
155657
|
-
function
|
|
155910
|
+
function doChange34(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
155658
155911
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
155659
155912
|
}
|
|
155660
|
-
var fixId39,
|
|
155913
|
+
var fixId39, errorCodes50;
|
|
155661
155914
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
155662
155915
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
155663
155916
|
"use strict";
|
|
155664
155917
|
init_ts4();
|
|
155665
155918
|
init_ts_codefix();
|
|
155666
155919
|
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
155667
|
-
|
|
155920
|
+
errorCodes50 = [
|
|
155668
155921
|
Diagnostics.The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_write_Promise_0.code
|
|
155669
155922
|
];
|
|
155670
155923
|
registerCodeFix({
|
|
155671
|
-
errorCodes:
|
|
155924
|
+
errorCodes: errorCodes50,
|
|
155672
155925
|
fixIds: [fixId39],
|
|
155673
155926
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
155674
155927
|
const { sourceFile, program, span } = context;
|
|
155675
155928
|
const checker = program.getTypeChecker();
|
|
155676
|
-
const info =
|
|
155929
|
+
const info = getInfo16(sourceFile, program.getTypeChecker(), span.start);
|
|
155677
155930
|
if (!info) {
|
|
155678
155931
|
return void 0;
|
|
155679
155932
|
}
|
|
155680
155933
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
155681
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155934
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
155682
155935
|
return [createCodeFixAction(
|
|
155683
155936
|
fixId39,
|
|
155684
155937
|
changes,
|
|
@@ -155687,10 +155940,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155687
155940
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
155688
155941
|
)];
|
|
155689
155942
|
},
|
|
155690
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155691
|
-
const info =
|
|
155943
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
155944
|
+
const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
155692
155945
|
if (info) {
|
|
155693
|
-
|
|
155946
|
+
doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
155694
155947
|
}
|
|
155695
155948
|
})
|
|
155696
155949
|
});
|
|
@@ -155704,7 +155957,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155704
155957
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
155705
155958
|
}
|
|
155706
155959
|
}
|
|
155707
|
-
var fixName4, fixId40,
|
|
155960
|
+
var fixName4, fixId40, errorCodes51;
|
|
155708
155961
|
var init_disableJsDiagnostics = __esm({
|
|
155709
155962
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
155710
155963
|
"use strict";
|
|
@@ -155712,12 +155965,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155712
155965
|
init_ts_codefix();
|
|
155713
155966
|
fixName4 = "disableJsDiagnostics";
|
|
155714
155967
|
fixId40 = "disableJsDiagnostics";
|
|
155715
|
-
|
|
155968
|
+
errorCodes51 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
155716
155969
|
const diag2 = Diagnostics[key];
|
|
155717
155970
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
155718
155971
|
});
|
|
155719
155972
|
registerCodeFix({
|
|
155720
|
-
errorCodes:
|
|
155973
|
+
errorCodes: errorCodes51,
|
|
155721
155974
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
155722
155975
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
155723
155976
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -155745,7 +155998,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155745
155998
|
fixIds: [fixId40],
|
|
155746
155999
|
getAllCodeActions: (context) => {
|
|
155747
156000
|
const seenLines = /* @__PURE__ */ new Set();
|
|
155748
|
-
return codeFixAll(context,
|
|
156001
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
155749
156002
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
155750
156003
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
155751
156004
|
}
|
|
@@ -156757,7 +157010,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156757
157010
|
});
|
|
156758
157011
|
|
|
156759
157012
|
// src/services/codefixes/fixStrictClassInitialization.ts
|
|
156760
|
-
function
|
|
157013
|
+
function getInfo17(sourceFile, pos) {
|
|
156761
157014
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
156762
157015
|
if (isIdentifier(token) && isPropertyDeclaration(token.parent)) {
|
|
156763
157016
|
const type = getEffectiveTypeAnnotationNode(token.parent);
|
|
@@ -156861,7 +157114,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156861
157114
|
}
|
|
156862
157115
|
return void 0;
|
|
156863
157116
|
}
|
|
156864
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
157117
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes52;
|
|
156865
157118
|
var init_fixStrictClassInitialization = __esm({
|
|
156866
157119
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
156867
157120
|
"use strict";
|
|
@@ -156871,11 +157124,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156871
157124
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
156872
157125
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
156873
157126
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
156874
|
-
|
|
157127
|
+
errorCodes52 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
156875
157128
|
registerCodeFix({
|
|
156876
|
-
errorCodes:
|
|
157129
|
+
errorCodes: errorCodes52,
|
|
156877
157130
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
156878
|
-
const info =
|
|
157131
|
+
const info = getInfo17(context.sourceFile, context.span.start);
|
|
156879
157132
|
if (!info)
|
|
156880
157133
|
return;
|
|
156881
157134
|
const result = [];
|
|
@@ -156886,8 +157139,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156886
157139
|
},
|
|
156887
157140
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
156888
157141
|
getAllCodeActions: (context) => {
|
|
156889
|
-
return codeFixAll(context,
|
|
156890
|
-
const info =
|
|
157142
|
+
return codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
157143
|
+
const info = getInfo17(diag2.file, diag2.start);
|
|
156891
157144
|
if (!info)
|
|
156892
157145
|
return;
|
|
156893
157146
|
switch (context.fixId) {
|
|
@@ -156914,7 +157167,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156914
157167
|
});
|
|
156915
157168
|
|
|
156916
157169
|
// src/services/codefixes/requireInTs.ts
|
|
156917
|
-
function
|
|
157170
|
+
function doChange35(changes, sourceFile, info) {
|
|
156918
157171
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
156919
157172
|
changes.replaceNode(
|
|
156920
157173
|
sourceFile,
|
|
@@ -156941,7 +157194,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156941
157194
|
)
|
|
156942
157195
|
);
|
|
156943
157196
|
}
|
|
156944
|
-
function
|
|
157197
|
+
function getInfo18(sourceFile, program, pos) {
|
|
156945
157198
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
156946
157199
|
if (!isRequireCall(
|
|
156947
157200
|
parent2,
|
|
@@ -156980,29 +157233,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156980
157233
|
return factory.createNamedImports(importSpecifiers);
|
|
156981
157234
|
}
|
|
156982
157235
|
}
|
|
156983
|
-
var fixId41,
|
|
157236
|
+
var fixId41, errorCodes53;
|
|
156984
157237
|
var init_requireInTs = __esm({
|
|
156985
157238
|
"src/services/codefixes/requireInTs.ts"() {
|
|
156986
157239
|
"use strict";
|
|
156987
157240
|
init_ts4();
|
|
156988
157241
|
init_ts_codefix();
|
|
156989
157242
|
fixId41 = "requireInTs";
|
|
156990
|
-
|
|
157243
|
+
errorCodes53 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
156991
157244
|
registerCodeFix({
|
|
156992
|
-
errorCodes:
|
|
157245
|
+
errorCodes: errorCodes53,
|
|
156993
157246
|
getCodeActions(context) {
|
|
156994
|
-
const info =
|
|
157247
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
156995
157248
|
if (!info) {
|
|
156996
157249
|
return void 0;
|
|
156997
157250
|
}
|
|
156998
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157251
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info));
|
|
156999
157252
|
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
157000
157253
|
},
|
|
157001
157254
|
fixIds: [fixId41],
|
|
157002
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157003
|
-
const info =
|
|
157255
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
157256
|
+
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
157004
157257
|
if (info) {
|
|
157005
|
-
|
|
157258
|
+
doChange35(changes, context.sourceFile, info);
|
|
157006
157259
|
}
|
|
157007
157260
|
})
|
|
157008
157261
|
});
|
|
@@ -157010,7 +157263,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157010
157263
|
});
|
|
157011
157264
|
|
|
157012
157265
|
// src/services/codefixes/useDefaultImport.ts
|
|
157013
|
-
function
|
|
157266
|
+
function getInfo19(sourceFile, pos) {
|
|
157014
157267
|
const name = getTokenAtPosition(sourceFile, pos);
|
|
157015
157268
|
if (!isIdentifier(name))
|
|
157016
157269
|
return void 0;
|
|
@@ -157022,7 +157275,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157022
157275
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
157023
157276
|
}
|
|
157024
157277
|
}
|
|
157025
|
-
function
|
|
157278
|
+
function doChange36(changes, sourceFile, info, preferences) {
|
|
157026
157279
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
157027
157280
|
info.name,
|
|
157028
157281
|
/*namedImports*/
|
|
@@ -157031,29 +157284,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157031
157284
|
getQuotePreference(sourceFile, preferences)
|
|
157032
157285
|
));
|
|
157033
157286
|
}
|
|
157034
|
-
var fixId42,
|
|
157287
|
+
var fixId42, errorCodes54;
|
|
157035
157288
|
var init_useDefaultImport = __esm({
|
|
157036
157289
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
157037
157290
|
"use strict";
|
|
157038
157291
|
init_ts4();
|
|
157039
157292
|
init_ts_codefix();
|
|
157040
157293
|
fixId42 = "useDefaultImport";
|
|
157041
|
-
|
|
157294
|
+
errorCodes54 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
157042
157295
|
registerCodeFix({
|
|
157043
|
-
errorCodes:
|
|
157296
|
+
errorCodes: errorCodes54,
|
|
157044
157297
|
getCodeActions(context) {
|
|
157045
157298
|
const { sourceFile, span: { start } } = context;
|
|
157046
|
-
const info =
|
|
157299
|
+
const info = getInfo19(sourceFile, start);
|
|
157047
157300
|
if (!info)
|
|
157048
157301
|
return void 0;
|
|
157049
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157302
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, info, context.preferences));
|
|
157050
157303
|
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
157051
157304
|
},
|
|
157052
157305
|
fixIds: [fixId42],
|
|
157053
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157054
|
-
const info =
|
|
157306
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
157307
|
+
const info = getInfo19(diag2.file, diag2.start);
|
|
157055
157308
|
if (info)
|
|
157056
|
-
|
|
157309
|
+
doChange36(changes, diag2.file, info, context.preferences);
|
|
157057
157310
|
})
|
|
157058
157311
|
});
|
|
157059
157312
|
}
|
|
@@ -157068,18 +157321,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157068
157321
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
157069
157322
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
157070
157323
|
}
|
|
157071
|
-
var fixId43,
|
|
157324
|
+
var fixId43, errorCodes55;
|
|
157072
157325
|
var init_useBigintLiteral = __esm({
|
|
157073
157326
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
157074
157327
|
"use strict";
|
|
157075
157328
|
init_ts4();
|
|
157076
157329
|
init_ts_codefix();
|
|
157077
157330
|
fixId43 = "useBigintLiteral";
|
|
157078
|
-
|
|
157331
|
+
errorCodes55 = [
|
|
157079
157332
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
157080
157333
|
];
|
|
157081
157334
|
registerCodeFix({
|
|
157082
|
-
errorCodes:
|
|
157335
|
+
errorCodes: errorCodes55,
|
|
157083
157336
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
157084
157337
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
157085
157338
|
if (changes.length > 0) {
|
|
@@ -157088,7 +157341,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157088
157341
|
},
|
|
157089
157342
|
fixIds: [fixId43],
|
|
157090
157343
|
getAllCodeActions: (context) => {
|
|
157091
|
-
return codeFixAll(context,
|
|
157344
|
+
return codeFixAll(context, errorCodes55, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
157092
157345
|
}
|
|
157093
157346
|
});
|
|
157094
157347
|
}
|
|
@@ -157101,7 +157354,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157101
157354
|
Debug.assert(token.parent.kind === 205 /* ImportType */, "Token parent should be an ImportType");
|
|
157102
157355
|
return token.parent;
|
|
157103
157356
|
}
|
|
157104
|
-
function
|
|
157357
|
+
function doChange37(changes, sourceFile, importType) {
|
|
157105
157358
|
const newTypeNode = factory.updateImportTypeNode(
|
|
157106
157359
|
importType,
|
|
157107
157360
|
importType.argument,
|
|
@@ -157113,7 +157366,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157113
157366
|
);
|
|
157114
157367
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
157115
157368
|
}
|
|
157116
|
-
var fixIdAddMissingTypeof, fixId44,
|
|
157369
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes56;
|
|
157117
157370
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
157118
157371
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
157119
157372
|
"use strict";
|
|
@@ -157121,17 +157374,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157121
157374
|
init_ts_codefix();
|
|
157122
157375
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
157123
157376
|
fixId44 = fixIdAddMissingTypeof;
|
|
157124
|
-
|
|
157377
|
+
errorCodes56 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
157125
157378
|
registerCodeFix({
|
|
157126
|
-
errorCodes:
|
|
157379
|
+
errorCodes: errorCodes56,
|
|
157127
157380
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
157128
157381
|
const { sourceFile, span } = context;
|
|
157129
157382
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
157130
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157383
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType));
|
|
157131
157384
|
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
157132
157385
|
},
|
|
157133
157386
|
fixIds: [fixId44],
|
|
157134
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157387
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
157135
157388
|
});
|
|
157136
157389
|
}
|
|
157137
157390
|
});
|
|
@@ -157150,7 +157403,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157150
157403
|
return void 0;
|
|
157151
157404
|
return binaryExpr;
|
|
157152
157405
|
}
|
|
157153
|
-
function
|
|
157406
|
+
function doChange38(changeTracker, sf, node) {
|
|
157154
157407
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
157155
157408
|
if (jsx)
|
|
157156
157409
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -157173,37 +157426,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157173
157426
|
return void 0;
|
|
157174
157427
|
}
|
|
157175
157428
|
}
|
|
157176
|
-
var fixID2,
|
|
157429
|
+
var fixID2, errorCodes57;
|
|
157177
157430
|
var init_wrapJsxInFragment = __esm({
|
|
157178
157431
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
157179
157432
|
"use strict";
|
|
157180
157433
|
init_ts4();
|
|
157181
157434
|
init_ts_codefix();
|
|
157182
157435
|
fixID2 = "wrapJsxInFragment";
|
|
157183
|
-
|
|
157436
|
+
errorCodes57 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
157184
157437
|
registerCodeFix({
|
|
157185
|
-
errorCodes:
|
|
157438
|
+
errorCodes: errorCodes57,
|
|
157186
157439
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
157187
157440
|
const { sourceFile, span } = context;
|
|
157188
157441
|
const node = findNodeToFix(sourceFile, span.start);
|
|
157189
157442
|
if (!node)
|
|
157190
157443
|
return void 0;
|
|
157191
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157444
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(t, sourceFile, node));
|
|
157192
157445
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
157193
157446
|
},
|
|
157194
157447
|
fixIds: [fixID2],
|
|
157195
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157448
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
157196
157449
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
157197
157450
|
if (!node)
|
|
157198
157451
|
return void 0;
|
|
157199
|
-
|
|
157452
|
+
doChange38(changes, context.sourceFile, node);
|
|
157200
157453
|
})
|
|
157201
157454
|
});
|
|
157202
157455
|
}
|
|
157203
157456
|
});
|
|
157204
157457
|
|
|
157205
157458
|
// src/services/codefixes/convertToMappedObjectType.ts
|
|
157206
|
-
function
|
|
157459
|
+
function getInfo20(sourceFile, pos) {
|
|
157207
157460
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
157208
157461
|
const indexSignature = tryCast(token.parent.parent, isIndexSignatureDeclaration);
|
|
157209
157462
|
if (!indexSignature)
|
|
@@ -157216,7 +157469,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157216
157469
|
function createTypeAliasFromInterface(declaration, type) {
|
|
157217
157470
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
157218
157471
|
}
|
|
157219
|
-
function
|
|
157472
|
+
function doChange39(changes, sourceFile, { indexSignature, container }) {
|
|
157220
157473
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
157221
157474
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
157222
157475
|
const parameter = first(indexSignature.parameters);
|
|
@@ -157243,48 +157496,48 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157243
157496
|
]);
|
|
157244
157497
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
157245
157498
|
}
|
|
157246
|
-
var fixId45,
|
|
157499
|
+
var fixId45, errorCodes58;
|
|
157247
157500
|
var init_convertToMappedObjectType = __esm({
|
|
157248
157501
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
157249
157502
|
"use strict";
|
|
157250
157503
|
init_ts4();
|
|
157251
157504
|
init_ts_codefix();
|
|
157252
157505
|
fixId45 = "fixConvertToMappedObjectType";
|
|
157253
|
-
|
|
157506
|
+
errorCodes58 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
157254
157507
|
registerCodeFix({
|
|
157255
|
-
errorCodes:
|
|
157508
|
+
errorCodes: errorCodes58,
|
|
157256
157509
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
157257
157510
|
const { sourceFile, span } = context;
|
|
157258
|
-
const info =
|
|
157511
|
+
const info = getInfo20(sourceFile, span.start);
|
|
157259
157512
|
if (!info)
|
|
157260
157513
|
return void 0;
|
|
157261
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157514
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
|
|
157262
157515
|
const name = idText(info.container.name);
|
|
157263
157516
|
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
157264
157517
|
},
|
|
157265
157518
|
fixIds: [fixId45],
|
|
157266
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157267
|
-
const info =
|
|
157519
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => {
|
|
157520
|
+
const info = getInfo20(diag2.file, diag2.start);
|
|
157268
157521
|
if (info)
|
|
157269
|
-
|
|
157522
|
+
doChange39(changes, diag2.file, info);
|
|
157270
157523
|
})
|
|
157271
157524
|
});
|
|
157272
157525
|
}
|
|
157273
157526
|
});
|
|
157274
157527
|
|
|
157275
157528
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
157276
|
-
var fixId46,
|
|
157529
|
+
var fixId46, errorCodes59;
|
|
157277
157530
|
var init_removeAccidentalCallParentheses = __esm({
|
|
157278
157531
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
157279
157532
|
"use strict";
|
|
157280
157533
|
init_ts4();
|
|
157281
157534
|
init_ts_codefix();
|
|
157282
157535
|
fixId46 = "removeAccidentalCallParentheses";
|
|
157283
|
-
|
|
157536
|
+
errorCodes59 = [
|
|
157284
157537
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
157285
157538
|
];
|
|
157286
157539
|
registerCodeFix({
|
|
157287
|
-
errorCodes:
|
|
157540
|
+
errorCodes: errorCodes59,
|
|
157288
157541
|
getCodeActions(context) {
|
|
157289
157542
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
157290
157543
|
if (!callExpression) {
|
|
@@ -157324,18 +157577,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157324
157577
|
}
|
|
157325
157578
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
157326
157579
|
}
|
|
157327
|
-
var fixId47,
|
|
157580
|
+
var fixId47, errorCodes60;
|
|
157328
157581
|
var init_removeUnnecessaryAwait = __esm({
|
|
157329
157582
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
157330
157583
|
"use strict";
|
|
157331
157584
|
init_ts4();
|
|
157332
157585
|
init_ts_codefix();
|
|
157333
157586
|
fixId47 = "removeUnnecessaryAwait";
|
|
157334
|
-
|
|
157587
|
+
errorCodes60 = [
|
|
157335
157588
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
157336
157589
|
];
|
|
157337
157590
|
registerCodeFix({
|
|
157338
|
-
errorCodes:
|
|
157591
|
+
errorCodes: errorCodes60,
|
|
157339
157592
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
157340
157593
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
157341
157594
|
if (changes.length > 0) {
|
|
@@ -157344,7 +157597,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157344
157597
|
},
|
|
157345
157598
|
fixIds: [fixId47],
|
|
157346
157599
|
getAllCodeActions: (context) => {
|
|
157347
|
-
return codeFixAll(context,
|
|
157600
|
+
return codeFixAll(context, errorCodes60, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
157348
157601
|
}
|
|
157349
157602
|
});
|
|
157350
157603
|
}
|
|
@@ -157394,16 +157647,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157394
157647
|
)
|
|
157395
157648
|
);
|
|
157396
157649
|
}
|
|
157397
|
-
var
|
|
157650
|
+
var errorCodes61, fixId48;
|
|
157398
157651
|
var init_splitTypeOnlyImport = __esm({
|
|
157399
157652
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
157400
157653
|
"use strict";
|
|
157401
157654
|
init_ts4();
|
|
157402
157655
|
init_ts_codefix();
|
|
157403
|
-
|
|
157656
|
+
errorCodes61 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
157404
157657
|
fixId48 = "splitTypeOnlyImport";
|
|
157405
157658
|
registerCodeFix({
|
|
157406
|
-
errorCodes:
|
|
157659
|
+
errorCodes: errorCodes61,
|
|
157407
157660
|
fixIds: [fixId48],
|
|
157408
157661
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
157409
157662
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
@@ -157413,7 +157666,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157413
157666
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
157414
157667
|
}
|
|
157415
157668
|
},
|
|
157416
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157669
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, error2) => {
|
|
157417
157670
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
157418
157671
|
})
|
|
157419
157672
|
});
|
|
@@ -157421,7 +157674,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157421
157674
|
});
|
|
157422
157675
|
|
|
157423
157676
|
// src/services/codefixes/convertConstToLet.ts
|
|
157424
|
-
function
|
|
157677
|
+
function getInfo21(sourceFile, pos, program) {
|
|
157425
157678
|
var _a;
|
|
157426
157679
|
const checker = program.getTypeChecker();
|
|
157427
157680
|
const symbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, pos));
|
|
@@ -157435,36 +157688,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157435
157688
|
return;
|
|
157436
157689
|
return { symbol, token: constToken };
|
|
157437
157690
|
}
|
|
157438
|
-
function
|
|
157691
|
+
function doChange40(changes, sourceFile, token) {
|
|
157439
157692
|
changes.replaceNode(sourceFile, token, factory.createToken(121 /* LetKeyword */));
|
|
157440
157693
|
}
|
|
157441
|
-
var fixId49,
|
|
157694
|
+
var fixId49, errorCodes62;
|
|
157442
157695
|
var init_convertConstToLet = __esm({
|
|
157443
157696
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
157444
157697
|
"use strict";
|
|
157445
157698
|
init_ts4();
|
|
157446
157699
|
init_ts_codefix();
|
|
157447
157700
|
fixId49 = "fixConvertConstToLet";
|
|
157448
|
-
|
|
157701
|
+
errorCodes62 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
157449
157702
|
registerCodeFix({
|
|
157450
|
-
errorCodes:
|
|
157703
|
+
errorCodes: errorCodes62,
|
|
157451
157704
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
157452
157705
|
const { sourceFile, span, program } = context;
|
|
157453
|
-
const info =
|
|
157706
|
+
const info = getInfo21(sourceFile, span.start, program);
|
|
157454
157707
|
if (info === void 0)
|
|
157455
157708
|
return;
|
|
157456
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157709
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
|
|
157457
157710
|
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
157458
157711
|
},
|
|
157459
157712
|
getAllCodeActions: (context) => {
|
|
157460
157713
|
const { program } = context;
|
|
157461
157714
|
const seen = /* @__PURE__ */ new Map();
|
|
157462
157715
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
157463
|
-
eachDiagnostic(context,
|
|
157464
|
-
const info =
|
|
157716
|
+
eachDiagnostic(context, errorCodes62, (diag2) => {
|
|
157717
|
+
const info = getInfo21(diag2.file, diag2.start, program);
|
|
157465
157718
|
if (info) {
|
|
157466
157719
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
157467
|
-
return
|
|
157720
|
+
return doChange40(changes, diag2.file, info.token);
|
|
157468
157721
|
}
|
|
157469
157722
|
}
|
|
157470
157723
|
return void 0;
|
|
@@ -157477,15 +157730,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157477
157730
|
});
|
|
157478
157731
|
|
|
157479
157732
|
// src/services/codefixes/fixExpectedComma.ts
|
|
157480
|
-
function
|
|
157733
|
+
function getInfo22(sourceFile, pos, _) {
|
|
157481
157734
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
157482
157735
|
return node.kind === 27 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
157483
157736
|
}
|
|
157484
|
-
function
|
|
157737
|
+
function doChange41(changes, sourceFile, { node }) {
|
|
157485
157738
|
const newNode = factory.createToken(28 /* CommaToken */);
|
|
157486
157739
|
changes.replaceNode(sourceFile, node, newNode);
|
|
157487
157740
|
}
|
|
157488
|
-
var fixId50, expectedErrorCode,
|
|
157741
|
+
var fixId50, expectedErrorCode, errorCodes63;
|
|
157489
157742
|
var init_fixExpectedComma = __esm({
|
|
157490
157743
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
157491
157744
|
"use strict";
|
|
@@ -157493,15 +157746,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157493
157746
|
init_ts_codefix();
|
|
157494
157747
|
fixId50 = "fixExpectedComma";
|
|
157495
157748
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
157496
|
-
|
|
157749
|
+
errorCodes63 = [expectedErrorCode];
|
|
157497
157750
|
registerCodeFix({
|
|
157498
|
-
errorCodes:
|
|
157751
|
+
errorCodes: errorCodes63,
|
|
157499
157752
|
getCodeActions(context) {
|
|
157500
157753
|
const { sourceFile } = context;
|
|
157501
|
-
const info =
|
|
157754
|
+
const info = getInfo22(sourceFile, context.span.start, context.errorCode);
|
|
157502
157755
|
if (!info)
|
|
157503
157756
|
return void 0;
|
|
157504
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157757
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
|
|
157505
157758
|
return [createCodeFixAction(
|
|
157506
157759
|
fixId50,
|
|
157507
157760
|
changes,
|
|
@@ -157511,10 +157764,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157511
157764
|
)];
|
|
157512
157765
|
},
|
|
157513
157766
|
fixIds: [fixId50],
|
|
157514
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157515
|
-
const info =
|
|
157767
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes63, (changes, diag2) => {
|
|
157768
|
+
const info = getInfo22(diag2.file, diag2.start, diag2.code);
|
|
157516
157769
|
if (info)
|
|
157517
|
-
|
|
157770
|
+
doChange41(changes, context.sourceFile, info);
|
|
157518
157771
|
})
|
|
157519
157772
|
});
|
|
157520
157773
|
}
|
|
@@ -157570,7 +157823,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157570
157823
|
return node.typeArguments;
|
|
157571
157824
|
}
|
|
157572
157825
|
}
|
|
157573
|
-
var fixName7, fixId51,
|
|
157826
|
+
var fixName7, fixId51, errorCodes64;
|
|
157574
157827
|
var init_fixAddVoidToPromise = __esm({
|
|
157575
157828
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
157576
157829
|
"use strict";
|
|
@@ -157578,12 +157831,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157578
157831
|
init_ts_codefix();
|
|
157579
157832
|
fixName7 = "addVoidToPromise";
|
|
157580
157833
|
fixId51 = "addVoidToPromise";
|
|
157581
|
-
|
|
157834
|
+
errorCodes64 = [
|
|
157582
157835
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
157583
157836
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
157584
157837
|
];
|
|
157585
157838
|
registerCodeFix({
|
|
157586
|
-
errorCodes:
|
|
157839
|
+
errorCodes: errorCodes64,
|
|
157587
157840
|
fixIds: [fixId51],
|
|
157588
157841
|
getCodeActions(context) {
|
|
157589
157842
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
@@ -157592,7 +157845,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157592
157845
|
}
|
|
157593
157846
|
},
|
|
157594
157847
|
getAllCodeActions(context) {
|
|
157595
|
-
return codeFixAll(context,
|
|
157848
|
+
return codeFixAll(context, errorCodes64, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
157596
157849
|
}
|
|
157597
157850
|
});
|
|
157598
157851
|
}
|
|
@@ -157676,6 +157929,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157676
157929
|
init_returnValueCorrect();
|
|
157677
157930
|
init_fixAddMissingMember();
|
|
157678
157931
|
init_fixAddMissingNewOperator();
|
|
157932
|
+
init_fixAddMissingParam();
|
|
157679
157933
|
init_fixCannotFindModule();
|
|
157680
157934
|
init_fixClassDoesntImplementInheritedAbstractMember();
|
|
157681
157935
|
init_fixClassSuperMustPrecedeThisAccess();
|
|
@@ -159400,7 +159654,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159400
159654
|
const { name, source, data } = entryId;
|
|
159401
159655
|
const { previousToken, contextToken } = getRelevantTokens(position, sourceFile);
|
|
159402
159656
|
if (isInString(sourceFile, position, previousToken)) {
|
|
159403
|
-
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken,
|
|
159657
|
+
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken, program, host, cancellationToken, preferences);
|
|
159404
159658
|
}
|
|
159405
159659
|
const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
|
|
159406
159660
|
switch (symbolCompletion.type) {
|
|
@@ -159622,7 +159876,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159622
159876
|
symbol,
|
|
159623
159877
|
enclosingDeclaration,
|
|
159624
159878
|
/*meaning*/
|
|
159625
|
-
|
|
159879
|
+
-1 /* All */,
|
|
159626
159880
|
/*useOnlyExternalAliasing*/
|
|
159627
159881
|
false
|
|
159628
159882
|
);
|
|
@@ -161634,7 +161888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161634
161888
|
if (isInString(sourceFile, position, contextToken)) {
|
|
161635
161889
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
161636
161890
|
return void 0;
|
|
161637
|
-
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program
|
|
161891
|
+
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences);
|
|
161638
161892
|
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
161639
161893
|
}
|
|
161640
161894
|
}
|
|
@@ -161704,11 +161958,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161704
161958
|
return Debug.assertNever(completion);
|
|
161705
161959
|
}
|
|
161706
161960
|
}
|
|
161707
|
-
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken,
|
|
161961
|
+
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, program, host, cancellationToken, preferences) {
|
|
161708
161962
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
161709
161963
|
return void 0;
|
|
161710
|
-
const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
161711
|
-
return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile,
|
|
161964
|
+
const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences);
|
|
161965
|
+
return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile, program.getTypeChecker(), cancellationToken);
|
|
161712
161966
|
}
|
|
161713
161967
|
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
|
|
161714
161968
|
switch (completion.kind) {
|
|
@@ -161766,13 +162020,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161766
162020
|
return Debug.assertNever(extension);
|
|
161767
162021
|
}
|
|
161768
162022
|
}
|
|
161769
|
-
function getStringLiteralCompletionEntries(sourceFile, node, position,
|
|
162023
|
+
function getStringLiteralCompletionEntries(sourceFile, node, position, program, host, preferences) {
|
|
162024
|
+
const typeChecker = program.getTypeChecker();
|
|
161770
162025
|
const parent2 = walkUpParentheses(node.parent);
|
|
161771
162026
|
switch (parent2.kind) {
|
|
161772
162027
|
case 201 /* LiteralType */: {
|
|
161773
162028
|
const grandParent = walkUpParentheses(parent2.parent);
|
|
161774
162029
|
if (grandParent.kind === 205 /* ImportType */) {
|
|
161775
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162030
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
161776
162031
|
}
|
|
161777
162032
|
return fromUnionableLiteralType(grandParent);
|
|
161778
162033
|
}
|
|
@@ -161798,7 +162053,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161798
162053
|
case 272 /* ImportDeclaration */:
|
|
161799
162054
|
case 278 /* ExportDeclaration */:
|
|
161800
162055
|
case 283 /* ExternalModuleReference */:
|
|
161801
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162056
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
161802
162057
|
case 296 /* CaseClause */:
|
|
161803
162058
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
161804
162059
|
const contextualTypes = fromContextualType();
|
|
@@ -161928,14 +162183,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161928
162183
|
const wholeSpan = text.length === 0 ? void 0 : createTextSpan(textStart, text.length);
|
|
161929
162184
|
return names.map(({ name, kind, extension }) => name.includes(directorySeparator) || name.includes(altDirectorySeparator) ? { name, kind, extension, span: wholeSpan } : { name, kind, extension, span });
|
|
161930
162185
|
}
|
|
161931
|
-
function getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
161932
|
-
return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node,
|
|
162186
|
+
function getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) {
|
|
162187
|
+
return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences));
|
|
161933
162188
|
}
|
|
161934
|
-
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node,
|
|
162189
|
+
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences) {
|
|
161935
162190
|
const literalValue = normalizeSlashes(node.text);
|
|
161936
|
-
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
162191
|
+
const mode = isStringLiteralLike(node) ? program.getModeForUsageLocation(sourceFile, node) : void 0;
|
|
161937
162192
|
const scriptPath = sourceFile.path;
|
|
161938
162193
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
162194
|
+
const compilerOptions = program.getCompilerOptions();
|
|
162195
|
+
const typeChecker = program.getTypeChecker();
|
|
161939
162196
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
161940
162197
|
return isPathRelativeToScript(literalValue) || !compilerOptions.baseUrl && !compilerOptions.paths && (isRootedDiskPath(literalValue) || isUrl(literalValue)) ? getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, extensionOptions) : getCompletionEntriesForNonRelativeModules(literalValue, scriptDirectory, mode, compilerOptions, host, extensionOptions, typeChecker);
|
|
161941
162198
|
}
|
|
@@ -163577,7 +163834,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163577
163834
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
163578
163835
|
if (isModuleSpecifierLike(node)) {
|
|
163579
163836
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
163580
|
-
const referencedFileName = (_b = (_a = program.
|
|
163837
|
+
const referencedFileName = (_b = (_a = program.getResolvedModuleFromModuleSpecifier(node)) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
163581
163838
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
163582
163839
|
if (referencedFile) {
|
|
163583
163840
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -165109,7 +165366,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165109
165366
|
}
|
|
165110
165367
|
}
|
|
165111
165368
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
165112
|
-
const ref = (_a = program.
|
|
165369
|
+
const ref = (_a = program.getResolvedModuleFromModuleSpecifier(fallbackNode)) == null ? void 0 : _a.resolvedModule;
|
|
165113
165370
|
if (ref) {
|
|
165114
165371
|
return [{
|
|
165115
165372
|
name: fallbackNode.text,
|
|
@@ -165224,7 +165481,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165224
165481
|
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
165225
165482
|
const node = getTouchingToken(sourceFile, position);
|
|
165226
165483
|
let resolution;
|
|
165227
|
-
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.
|
|
165484
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModuleFromModuleSpecifier(node))) {
|
|
165228
165485
|
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
165229
165486
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
165230
165487
|
return {
|
|
@@ -174636,11 +174893,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174636
174893
|
ModuleKind3["ES6"] = "ES6";
|
|
174637
174894
|
ModuleKind3["ES2015"] = "ES2015";
|
|
174638
174895
|
ModuleKind3["ESNext"] = "ESNext";
|
|
174896
|
+
ModuleKind3["Node16"] = "Node16";
|
|
174897
|
+
ModuleKind3["NodeNext"] = "NodeNext";
|
|
174898
|
+
ModuleKind3["Preserve"] = "Preserve";
|
|
174639
174899
|
return ModuleKind3;
|
|
174640
174900
|
})(ModuleKind2 || {});
|
|
174641
174901
|
ModuleResolutionKind2 = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
174642
174902
|
ModuleResolutionKind3["Classic"] = "Classic";
|
|
174643
174903
|
ModuleResolutionKind3["Node"] = "Node";
|
|
174904
|
+
ModuleResolutionKind3["Node10"] = "Node10";
|
|
174905
|
+
ModuleResolutionKind3["Node16"] = "Node16";
|
|
174906
|
+
ModuleResolutionKind3["NodeNext"] = "NodeNext";
|
|
174907
|
+
ModuleResolutionKind3["Bundler"] = "Bundler";
|
|
174644
174908
|
return ModuleResolutionKind3;
|
|
174645
174909
|
})(ModuleResolutionKind2 || {});
|
|
174646
174910
|
NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
@@ -186642,6 +186906,7 @@ ${e.message}`;
|
|
|
186642
186906
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
186643
186907
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
186644
186908
|
getStringComparer: () => getStringComparer,
|
|
186909
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
186645
186910
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
186646
186911
|
getSuperContainer: () => getSuperContainer,
|
|
186647
186912
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -187728,7 +187993,6 @@ ${e.message}`;
|
|
|
187728
187993
|
setValueDeclaration: () => setValueDeclaration,
|
|
187729
187994
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
187730
187995
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
187731
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
187732
187996
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
187733
187997
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
187734
187998
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -187891,7 +188155,6 @@ ${e.message}`;
|
|
|
187891
188155
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
187892
188156
|
typeKeywords: () => typeKeywords,
|
|
187893
188157
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
187894
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
187895
188158
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
187896
188159
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
187897
188160
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -189064,6 +189327,7 @@ ${e.message}`;
|
|
|
189064
189327
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
189065
189328
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
189066
189329
|
getStringComparer: () => getStringComparer,
|
|
189330
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
189067
189331
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
189068
189332
|
getSuperContainer: () => getSuperContainer,
|
|
189069
189333
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -190150,7 +190414,6 @@ ${e.message}`;
|
|
|
190150
190414
|
setValueDeclaration: () => setValueDeclaration,
|
|
190151
190415
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
190152
190416
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
190153
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
190154
190417
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
190155
190418
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
190156
190419
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -190313,7 +190576,6 @@ ${e.message}`;
|
|
|
190313
190576
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
190314
190577
|
typeKeywords: () => typeKeywords,
|
|
190315
190578
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
190316
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
190317
190579
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
190318
190580
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
190319
190581
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|