typescript 5.4.0-dev.20240119 → 5.4.0-dev.20240121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cancellationToken.js +0 -1
- package/lib/tsc.js +186 -164
- package/lib/tsserver.js +683 -434
- package/lib/typescript.d.ts +51 -11
- package/lib/typescript.js +726 -467
- package/lib/typingsInstaller.js +23 -25
- package/package.json +28 -28
package/lib/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.20240121`;
|
|
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
|
);
|
|
@@ -139228,10 +139247,11 @@ ${lanes.join("\n")}
|
|
|
139228
139247
|
forEachImportInStatement(oldStatement, (i) => {
|
|
139229
139248
|
var _a;
|
|
139230
139249
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
139231
|
-
const
|
|
139250
|
+
const compilerOptions = program.getCompilerOptions();
|
|
139251
|
+
const resolved = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier);
|
|
139232
139252
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
139233
139253
|
if (fileName && targetSourceFile) {
|
|
139234
|
-
const newModuleSpecifier = getModuleSpecifier(
|
|
139254
|
+
const newModuleSpecifier = getModuleSpecifier(compilerOptions, targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
139235
139255
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
139236
139256
|
} else {
|
|
139237
139257
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -139342,7 +139362,7 @@ ${lanes.join("\n")}
|
|
|
139342
139362
|
needUniqueName = needUniqueName || !!checker.resolveName(
|
|
139343
139363
|
preferredNewNamespaceName,
|
|
139344
139364
|
ref,
|
|
139345
|
-
|
|
139365
|
+
-1 /* All */,
|
|
139346
139366
|
/*excludeGlobals*/
|
|
139347
139367
|
true
|
|
139348
139368
|
);
|
|
@@ -144670,12 +144690,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
144670
144690
|
}
|
|
144671
144691
|
return [];
|
|
144672
144692
|
}
|
|
144673
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
144693
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes65, formatOptions, preferences = emptyOptions) {
|
|
144674
144694
|
synchronizeHostData();
|
|
144675
144695
|
const sourceFile = getValidSourceFile(fileName);
|
|
144676
144696
|
const span = createTextSpanFromBounds(start, end);
|
|
144677
144697
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
144678
|
-
return flatMap(deduplicate(
|
|
144698
|
+
return flatMap(deduplicate(errorCodes65, equateValues, compareValues), (errorCode) => {
|
|
144679
144699
|
cancellationToken.throwIfCancellationRequested();
|
|
144680
144700
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
144681
144701
|
});
|
|
@@ -147057,10 +147077,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
147057
147077
|
return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
|
|
147058
147078
|
}
|
|
147059
147079
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
147060
|
-
const { errorCodes:
|
|
147080
|
+
const { errorCodes: errorCodes65 } = registration;
|
|
147061
147081
|
let maybeFixableDiagnostics = 0;
|
|
147062
147082
|
for (const diag2 of diagnostics) {
|
|
147063
|
-
if (contains(
|
|
147083
|
+
if (contains(errorCodes65, diag2.code))
|
|
147064
147084
|
maybeFixableDiagnostics++;
|
|
147065
147085
|
if (maybeFixableDiagnostics > 1)
|
|
147066
147086
|
break;
|
|
@@ -147084,14 +147104,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
147084
147104
|
function createFileTextChanges(fileName, textChanges2) {
|
|
147085
147105
|
return { fileName, textChanges: textChanges2 };
|
|
147086
147106
|
}
|
|
147087
|
-
function codeFixAll(context,
|
|
147107
|
+
function codeFixAll(context, errorCodes65, use) {
|
|
147088
147108
|
const commands = [];
|
|
147089
|
-
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)));
|
|
147090
147110
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
147091
147111
|
}
|
|
147092
|
-
function eachDiagnostic(context,
|
|
147112
|
+
function eachDiagnostic(context, errorCodes65, cb) {
|
|
147093
147113
|
for (const diag2 of getDiagnostics(context)) {
|
|
147094
|
-
if (contains(
|
|
147114
|
+
if (contains(errorCodes65, diag2.code)) {
|
|
147095
147115
|
cb(diag2);
|
|
147096
147116
|
}
|
|
147097
147117
|
}
|
|
@@ -149004,7 +149024,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
149004
149024
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
149005
149025
|
var _a;
|
|
149006
149026
|
for (const moduleSpecifier of importingFile.imports) {
|
|
149007
|
-
const imported = (_a = program.
|
|
149027
|
+
const imported = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
149008
149028
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
149009
149029
|
continue;
|
|
149010
149030
|
}
|
|
@@ -150926,6 +150946,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
150926
150946
|
case 7 /* ES2022 */:
|
|
150927
150947
|
case 99 /* ESNext */:
|
|
150928
150948
|
case 0 /* None */:
|
|
150949
|
+
case 200 /* Preserve */:
|
|
150929
150950
|
return 2 /* Namespace */;
|
|
150930
150951
|
case 100 /* Node16 */:
|
|
150931
150952
|
case 199 /* NodeNext */:
|
|
@@ -151157,7 +151178,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151157
151178
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
151158
151179
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
151159
151180
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
151160
|
-
const resolvedModule = moduleSpecifier && ((_a = program.
|
|
151181
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule);
|
|
151161
151182
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
151162
151183
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
151163
151184
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -151883,15 +151904,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151883
151904
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
151884
151905
|
if (importDeclaration === void 0)
|
|
151885
151906
|
return void 0;
|
|
151886
|
-
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier
|
|
151907
|
+
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : void 0;
|
|
151887
151908
|
if (moduleSpecifier === void 0)
|
|
151888
151909
|
return void 0;
|
|
151889
|
-
const resolvedModule = (_a = program.
|
|
151890
|
-
sourceFile,
|
|
151891
|
-
moduleSpecifier,
|
|
151892
|
-
/*mode*/
|
|
151893
|
-
void 0
|
|
151894
|
-
)) == null ? void 0 : _a.resolvedModule;
|
|
151910
|
+
const resolvedModule = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
151895
151911
|
if (resolvedModule === void 0)
|
|
151896
151912
|
return void 0;
|
|
151897
151913
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -151908,7 +151924,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
151908
151924
|
if (node === void 0)
|
|
151909
151925
|
return void 0;
|
|
151910
151926
|
const exportName = { node: token, isTypeOnly: isTypeDeclaration(node) };
|
|
151911
|
-
return { exportName, node, moduleSourceFile, moduleSpecifier };
|
|
151927
|
+
return { exportName, node, moduleSourceFile, moduleSpecifier: moduleSpecifier.text };
|
|
151912
151928
|
}
|
|
151913
151929
|
return void 0;
|
|
151914
151930
|
}
|
|
@@ -152137,7 +152153,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152137
152153
|
} else if (isImportSpecifier(parent2) && parent2.name === node) {
|
|
152138
152154
|
Debug.assertNode(node, isIdentifier, "Expected an identifier for spelling (import)");
|
|
152139
152155
|
const importDeclaration = findAncestor(node, isImportDeclaration);
|
|
152140
|
-
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(
|
|
152156
|
+
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration);
|
|
152141
152157
|
if (resolvedSourceFile && resolvedSourceFile.symbol) {
|
|
152142
152158
|
suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol);
|
|
152143
152159
|
}
|
|
@@ -152187,11 +152203,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
152187
152203
|
}
|
|
152188
152204
|
return flags;
|
|
152189
152205
|
}
|
|
152190
|
-
function getResolvedSourceFileFromImportDeclaration(
|
|
152206
|
+
function getResolvedSourceFileFromImportDeclaration(context, importDeclaration) {
|
|
152191
152207
|
var _a;
|
|
152192
152208
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
152193
152209
|
return void 0;
|
|
152194
|
-
const resolvedModule = (_a = context.program.
|
|
152210
|
+
const resolvedModule = (_a = context.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
152195
152211
|
if (!resolvedModule)
|
|
152196
152212
|
return void 0;
|
|
152197
152213
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -153180,6 +153196,240 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153180
153196
|
}
|
|
153181
153197
|
});
|
|
153182
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
|
+
|
|
153183
153433
|
// src/services/codefixes/fixCannotFindModule.ts
|
|
153184
153434
|
function getInstallCommand(fileName, packageName) {
|
|
153185
153435
|
return { type: "install package", file: fileName, packageName };
|
|
@@ -153196,7 +153446,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153196
153446
|
var _a;
|
|
153197
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;
|
|
153198
153448
|
}
|
|
153199
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
153449
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes30;
|
|
153200
153450
|
var init_fixCannotFindModule = __esm({
|
|
153201
153451
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
153202
153452
|
"use strict";
|
|
@@ -153205,12 +153455,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153205
153455
|
fixName2 = "fixCannotFindModule";
|
|
153206
153456
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
153207
153457
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
153208
|
-
|
|
153458
|
+
errorCodes30 = [
|
|
153209
153459
|
errorCodeCannotFindModule,
|
|
153210
153460
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
153211
153461
|
];
|
|
153212
153462
|
registerCodeFix({
|
|
153213
|
-
errorCodes:
|
|
153463
|
+
errorCodes: errorCodes30,
|
|
153214
153464
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
153215
153465
|
const { host, sourceFile, span: { start } } = context;
|
|
153216
153466
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -153229,7 +153479,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153229
153479
|
},
|
|
153230
153480
|
fixIds: [fixIdInstallTypesPackage],
|
|
153231
153481
|
getAllCodeActions: (context) => {
|
|
153232
|
-
return codeFixAll(context,
|
|
153482
|
+
return codeFixAll(context, errorCodes30, (_changes, diag2, commands) => {
|
|
153233
153483
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
153234
153484
|
if (packageName === void 0)
|
|
153235
153485
|
return void 0;
|
|
@@ -153268,18 +153518,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153268
153518
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
153269
153519
|
return !(flags & 2 /* Private */) && !!(flags & 64 /* Abstract */);
|
|
153270
153520
|
}
|
|
153271
|
-
var
|
|
153521
|
+
var errorCodes31, fixId25;
|
|
153272
153522
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
153273
153523
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
153274
153524
|
"use strict";
|
|
153275
153525
|
init_ts4();
|
|
153276
153526
|
init_ts_codefix();
|
|
153277
|
-
|
|
153527
|
+
errorCodes31 = [
|
|
153278
153528
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1.code
|
|
153279
153529
|
];
|
|
153280
153530
|
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
153281
153531
|
registerCodeFix({
|
|
153282
|
-
errorCodes:
|
|
153532
|
+
errorCodes: errorCodes31,
|
|
153283
153533
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
153284
153534
|
const { sourceFile, span } = context;
|
|
153285
153535
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
@@ -153288,7 +153538,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153288
153538
|
fixIds: [fixId25],
|
|
153289
153539
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
153290
153540
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
153291
|
-
return codeFixAll(context,
|
|
153541
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
153292
153542
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
153293
153543
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
153294
153544
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -153300,7 +153550,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153300
153550
|
});
|
|
153301
153551
|
|
|
153302
153552
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
153303
|
-
function
|
|
153553
|
+
function doChange20(changes, sourceFile, constructor, superCall) {
|
|
153304
153554
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
153305
153555
|
changes.delete(sourceFile, superCall);
|
|
153306
153556
|
}
|
|
@@ -153315,36 +153565,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153315
153565
|
function findSuperCall(n) {
|
|
153316
153566
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
153317
153567
|
}
|
|
153318
|
-
var fixId26,
|
|
153568
|
+
var fixId26, errorCodes32;
|
|
153319
153569
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
153320
153570
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
153321
153571
|
"use strict";
|
|
153322
153572
|
init_ts4();
|
|
153323
153573
|
init_ts_codefix();
|
|
153324
153574
|
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
153325
|
-
|
|
153575
|
+
errorCodes32 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
153326
153576
|
registerCodeFix({
|
|
153327
|
-
errorCodes:
|
|
153577
|
+
errorCodes: errorCodes32,
|
|
153328
153578
|
getCodeActions(context) {
|
|
153329
153579
|
const { sourceFile, span } = context;
|
|
153330
153580
|
const nodes = getNodes(sourceFile, span.start);
|
|
153331
153581
|
if (!nodes)
|
|
153332
153582
|
return void 0;
|
|
153333
153583
|
const { constructor, superCall } = nodes;
|
|
153334
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153584
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, constructor, superCall));
|
|
153335
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)];
|
|
153336
153586
|
},
|
|
153337
153587
|
fixIds: [fixId26],
|
|
153338
153588
|
getAllCodeActions(context) {
|
|
153339
153589
|
const { sourceFile } = context;
|
|
153340
153590
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
153341
|
-
return codeFixAll(context,
|
|
153591
|
+
return codeFixAll(context, errorCodes32, (changes, diag2) => {
|
|
153342
153592
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
153343
153593
|
if (!nodes)
|
|
153344
153594
|
return;
|
|
153345
153595
|
const { constructor, superCall } = nodes;
|
|
153346
153596
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
153347
|
-
|
|
153597
|
+
doChange20(changes, sourceFile, constructor, superCall);
|
|
153348
153598
|
}
|
|
153349
153599
|
});
|
|
153350
153600
|
}
|
|
@@ -153358,7 +153608,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153358
153608
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
153359
153609
|
return token.parent;
|
|
153360
153610
|
}
|
|
153361
|
-
function
|
|
153611
|
+
function doChange21(changes, sourceFile, ctr) {
|
|
153362
153612
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
153363
153613
|
factory.createSuper(),
|
|
153364
153614
|
/*typeArguments*/
|
|
@@ -153368,66 +153618,66 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153368
153618
|
));
|
|
153369
153619
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
153370
153620
|
}
|
|
153371
|
-
var fixId27,
|
|
153621
|
+
var fixId27, errorCodes33;
|
|
153372
153622
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
153373
153623
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
153374
153624
|
"use strict";
|
|
153375
153625
|
init_ts4();
|
|
153376
153626
|
init_ts_codefix();
|
|
153377
153627
|
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
153378
|
-
|
|
153628
|
+
errorCodes33 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
153379
153629
|
registerCodeFix({
|
|
153380
|
-
errorCodes:
|
|
153630
|
+
errorCodes: errorCodes33,
|
|
153381
153631
|
getCodeActions(context) {
|
|
153382
153632
|
const { sourceFile, span } = context;
|
|
153383
153633
|
const ctr = getNode(sourceFile, span.start);
|
|
153384
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153634
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, ctr));
|
|
153385
153635
|
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
153386
153636
|
},
|
|
153387
153637
|
fixIds: [fixId27],
|
|
153388
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153638
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes, diag2) => doChange21(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
153389
153639
|
});
|
|
153390
153640
|
}
|
|
153391
153641
|
});
|
|
153392
153642
|
|
|
153393
153643
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
153394
|
-
function
|
|
153644
|
+
function doChange22(changeTracker, configFile) {
|
|
153395
153645
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
153396
153646
|
}
|
|
153397
|
-
var fixID,
|
|
153647
|
+
var fixID, errorCodes34;
|
|
153398
153648
|
var init_fixEnableJsxFlag = __esm({
|
|
153399
153649
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
153400
153650
|
"use strict";
|
|
153401
153651
|
init_ts4();
|
|
153402
153652
|
init_ts_codefix();
|
|
153403
153653
|
fixID = "fixEnableJsxFlag";
|
|
153404
|
-
|
|
153654
|
+
errorCodes34 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
153405
153655
|
registerCodeFix({
|
|
153406
|
-
errorCodes:
|
|
153656
|
+
errorCodes: errorCodes34,
|
|
153407
153657
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
153408
153658
|
const { configFile } = context.program.getCompilerOptions();
|
|
153409
153659
|
if (configFile === void 0) {
|
|
153410
153660
|
return void 0;
|
|
153411
153661
|
}
|
|
153412
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) =>
|
|
153662
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => doChange22(changeTracker, configFile));
|
|
153413
153663
|
return [
|
|
153414
153664
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
153415
153665
|
];
|
|
153416
153666
|
},
|
|
153417
153667
|
fixIds: [fixID],
|
|
153418
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153668
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes) => {
|
|
153419
153669
|
const { configFile } = context.program.getCompilerOptions();
|
|
153420
153670
|
if (configFile === void 0) {
|
|
153421
153671
|
return void 0;
|
|
153422
153672
|
}
|
|
153423
|
-
|
|
153673
|
+
doChange22(changes, configFile);
|
|
153424
153674
|
})
|
|
153425
153675
|
});
|
|
153426
153676
|
}
|
|
153427
153677
|
});
|
|
153428
153678
|
|
|
153429
153679
|
// src/services/codefixes/fixNaNEquality.ts
|
|
153430
|
-
function
|
|
153680
|
+
function getInfo12(program, sourceFile, span) {
|
|
153431
153681
|
const diag2 = find(program.getSemanticDiagnostics(sourceFile), (diag3) => diag3.start === span.start && diag3.length === span.length);
|
|
153432
153682
|
if (diag2 === void 0 || diag2.relatedInformation === void 0)
|
|
153433
153683
|
return;
|
|
@@ -153442,7 +153692,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153442
153692
|
}
|
|
153443
153693
|
return void 0;
|
|
153444
153694
|
}
|
|
153445
|
-
function
|
|
153695
|
+
function doChange23(changes, sourceFile, arg, expression) {
|
|
153446
153696
|
const callExpression = factory.createCallExpression(
|
|
153447
153697
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
153448
153698
|
/*typeArguments*/
|
|
@@ -153460,33 +153710,33 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153460
153710
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/'(.*)'/) || [];
|
|
153461
153711
|
return suggestion;
|
|
153462
153712
|
}
|
|
153463
|
-
var fixId28,
|
|
153713
|
+
var fixId28, errorCodes35;
|
|
153464
153714
|
var init_fixNaNEquality = __esm({
|
|
153465
153715
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
153466
153716
|
"use strict";
|
|
153467
153717
|
init_ts4();
|
|
153468
153718
|
init_ts_codefix();
|
|
153469
153719
|
fixId28 = "fixNaNEquality";
|
|
153470
|
-
|
|
153720
|
+
errorCodes35 = [
|
|
153471
153721
|
Diagnostics.This_condition_will_always_return_0.code
|
|
153472
153722
|
];
|
|
153473
153723
|
registerCodeFix({
|
|
153474
|
-
errorCodes:
|
|
153724
|
+
errorCodes: errorCodes35,
|
|
153475
153725
|
getCodeActions(context) {
|
|
153476
153726
|
const { sourceFile, span, program } = context;
|
|
153477
|
-
const info =
|
|
153727
|
+
const info = getInfo12(program, sourceFile, span);
|
|
153478
153728
|
if (info === void 0)
|
|
153479
153729
|
return;
|
|
153480
153730
|
const { suggestion, expression, arg } = info;
|
|
153481
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153731
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, arg, expression));
|
|
153482
153732
|
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
153483
153733
|
},
|
|
153484
153734
|
fixIds: [fixId28],
|
|
153485
153735
|
getAllCodeActions: (context) => {
|
|
153486
|
-
return codeFixAll(context,
|
|
153487
|
-
const info =
|
|
153736
|
+
return codeFixAll(context, errorCodes35, (changes, diag2) => {
|
|
153737
|
+
const info = getInfo12(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
153488
153738
|
if (info) {
|
|
153489
|
-
|
|
153739
|
+
doChange23(changes, diag2.file, info.arg, info.expression);
|
|
153490
153740
|
}
|
|
153491
153741
|
});
|
|
153492
153742
|
}
|
|
@@ -153502,9 +153752,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153502
153752
|
init_ts_codefix();
|
|
153503
153753
|
registerCodeFix({
|
|
153504
153754
|
errorCodes: [
|
|
153505
|
-
Diagnostics.
|
|
153506
|
-
Diagnostics.
|
|
153507
|
-
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
|
|
153508
153758
|
],
|
|
153509
153759
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
153510
153760
|
const compilerOptions = context.program.getCompilerOptions();
|
|
@@ -153543,32 +153793,32 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153543
153793
|
});
|
|
153544
153794
|
|
|
153545
153795
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
153546
|
-
function
|
|
153796
|
+
function doChange24(changes, sourceFile, node) {
|
|
153547
153797
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
153548
153798
|
}
|
|
153549
153799
|
function getProperty2(sourceFile, pos) {
|
|
153550
153800
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
153551
153801
|
}
|
|
153552
|
-
var fixId29,
|
|
153802
|
+
var fixId29, errorCodes36;
|
|
153553
153803
|
var init_fixPropertyAssignment = __esm({
|
|
153554
153804
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
153555
153805
|
"use strict";
|
|
153556
153806
|
init_ts4();
|
|
153557
153807
|
init_ts_codefix();
|
|
153558
153808
|
fixId29 = "fixPropertyAssignment";
|
|
153559
|
-
|
|
153809
|
+
errorCodes36 = [
|
|
153560
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
|
|
153561
153811
|
];
|
|
153562
153812
|
registerCodeFix({
|
|
153563
|
-
errorCodes:
|
|
153813
|
+
errorCodes: errorCodes36,
|
|
153564
153814
|
fixIds: [fixId29],
|
|
153565
153815
|
getCodeActions(context) {
|
|
153566
153816
|
const { sourceFile, span } = context;
|
|
153567
153817
|
const property = getProperty2(sourceFile, span.start);
|
|
153568
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153818
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, context.sourceFile, property));
|
|
153569
153819
|
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
153570
153820
|
},
|
|
153571
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153821
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
153572
153822
|
});
|
|
153573
153823
|
}
|
|
153574
153824
|
});
|
|
@@ -153594,16 +153844,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153594
153844
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
153595
153845
|
}
|
|
153596
153846
|
}
|
|
153597
|
-
var fixId30,
|
|
153847
|
+
var fixId30, errorCodes37;
|
|
153598
153848
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
153599
153849
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
153600
153850
|
"use strict";
|
|
153601
153851
|
init_ts4();
|
|
153602
153852
|
init_ts_codefix();
|
|
153603
153853
|
fixId30 = "extendsInterfaceBecomesImplements";
|
|
153604
|
-
|
|
153854
|
+
errorCodes37 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
153605
153855
|
registerCodeFix({
|
|
153606
|
-
errorCodes:
|
|
153856
|
+
errorCodes: errorCodes37,
|
|
153607
153857
|
getCodeActions(context) {
|
|
153608
153858
|
const { sourceFile } = context;
|
|
153609
153859
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -153614,7 +153864,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153614
153864
|
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
153615
153865
|
},
|
|
153616
153866
|
fixIds: [fixId30],
|
|
153617
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153867
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
153618
153868
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
153619
153869
|
if (nodes)
|
|
153620
153870
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -153624,17 +153874,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153624
153874
|
});
|
|
153625
153875
|
|
|
153626
153876
|
// src/services/codefixes/fixForgottenThisPropertyAccess.ts
|
|
153627
|
-
function
|
|
153877
|
+
function getInfo13(sourceFile, pos, diagCode) {
|
|
153628
153878
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
153629
153879
|
if (isIdentifier(node) || isPrivateIdentifier(node)) {
|
|
153630
153880
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
153631
153881
|
}
|
|
153632
153882
|
}
|
|
153633
|
-
function
|
|
153883
|
+
function doChange25(changes, sourceFile, { node, className }) {
|
|
153634
153884
|
suppressLeadingAndTrailingTrivia(node);
|
|
153635
153885
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
153636
153886
|
}
|
|
153637
|
-
var fixId31, didYouMeanStaticMemberCode,
|
|
153887
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes38;
|
|
153638
153888
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
153639
153889
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
153640
153890
|
"use strict";
|
|
@@ -153642,27 +153892,27 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153642
153892
|
init_ts_codefix();
|
|
153643
153893
|
fixId31 = "forgottenThisPropertyAccess";
|
|
153644
153894
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
153645
|
-
|
|
153895
|
+
errorCodes38 = [
|
|
153646
153896
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
153647
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,
|
|
153648
153898
|
didYouMeanStaticMemberCode
|
|
153649
153899
|
];
|
|
153650
153900
|
registerCodeFix({
|
|
153651
|
-
errorCodes:
|
|
153901
|
+
errorCodes: errorCodes38,
|
|
153652
153902
|
getCodeActions(context) {
|
|
153653
153903
|
const { sourceFile } = context;
|
|
153654
|
-
const info =
|
|
153904
|
+
const info = getInfo13(sourceFile, context.span.start, context.errorCode);
|
|
153655
153905
|
if (!info) {
|
|
153656
153906
|
return void 0;
|
|
153657
153907
|
}
|
|
153658
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153908
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, info));
|
|
153659
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)];
|
|
153660
153910
|
},
|
|
153661
153911
|
fixIds: [fixId31],
|
|
153662
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
153663
|
-
const info =
|
|
153912
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes38, (changes, diag2) => {
|
|
153913
|
+
const info = getInfo13(diag2.file, diag2.start, diag2.code);
|
|
153664
153914
|
if (info)
|
|
153665
|
-
|
|
153915
|
+
doChange25(changes, context.sourceFile, info);
|
|
153666
153916
|
})
|
|
153667
153917
|
});
|
|
153668
153918
|
}
|
|
@@ -153672,7 +153922,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153672
153922
|
function isValidCharacter(character) {
|
|
153673
153923
|
return hasProperty(htmlEntity, character);
|
|
153674
153924
|
}
|
|
153675
|
-
function
|
|
153925
|
+
function doChange26(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
153676
153926
|
const character = sourceFile.getText()[start];
|
|
153677
153927
|
if (!isValidCharacter(character)) {
|
|
153678
153928
|
return;
|
|
@@ -153680,7 +153930,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153680
153930
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
153681
153931
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
153682
153932
|
}
|
|
153683
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
153933
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes39, htmlEntity;
|
|
153684
153934
|
var init_fixInvalidJsxCharacters = __esm({
|
|
153685
153935
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
153686
153936
|
"use strict";
|
|
@@ -153688,16 +153938,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153688
153938
|
init_ts_codefix();
|
|
153689
153939
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
153690
153940
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
153691
|
-
|
|
153941
|
+
errorCodes39 = [
|
|
153692
153942
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
153693
153943
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
153694
153944
|
];
|
|
153695
153945
|
registerCodeFix({
|
|
153696
|
-
errorCodes:
|
|
153946
|
+
errorCodes: errorCodes39,
|
|
153697
153947
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
153698
153948
|
getCodeActions(context) {
|
|
153699
153949
|
const { sourceFile, preferences, span } = context;
|
|
153700
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153950
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
153701
153951
|
t,
|
|
153702
153952
|
preferences,
|
|
153703
153953
|
sourceFile,
|
|
@@ -153705,7 +153955,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153705
153955
|
/*useHtmlEntity*/
|
|
153706
153956
|
false
|
|
153707
153957
|
));
|
|
153708
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
153958
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
153709
153959
|
t,
|
|
153710
153960
|
preferences,
|
|
153711
153961
|
sourceFile,
|
|
@@ -153719,7 +153969,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153719
153969
|
];
|
|
153720
153970
|
},
|
|
153721
153971
|
getAllCodeActions(context) {
|
|
153722
|
-
return codeFixAll(context,
|
|
153972
|
+
return codeFixAll(context, errorCodes39, (changes, diagnostic) => doChange26(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
153723
153973
|
}
|
|
153724
153974
|
});
|
|
153725
153975
|
htmlEntity = {
|
|
@@ -153766,7 +154016,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153766
154016
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
|
|
153767
154017
|
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
|
|
153768
154018
|
}
|
|
153769
|
-
function
|
|
154019
|
+
function getInfo14(sourceFile, pos) {
|
|
153770
154020
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
153771
154021
|
if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier(token.parent.name)) {
|
|
153772
154022
|
const jsDocParameterTag = token.parent;
|
|
@@ -153778,7 +154028,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153778
154028
|
}
|
|
153779
154029
|
return void 0;
|
|
153780
154030
|
}
|
|
153781
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
154031
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes40;
|
|
153782
154032
|
var init_fixUnmatchedParameter = __esm({
|
|
153783
154033
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
153784
154034
|
"use strict";
|
|
@@ -153786,16 +154036,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153786
154036
|
init_ts_codefix();
|
|
153787
154037
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
153788
154038
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
153789
|
-
|
|
154039
|
+
errorCodes40 = [
|
|
153790
154040
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
153791
154041
|
];
|
|
153792
154042
|
registerCodeFix({
|
|
153793
154043
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
153794
|
-
errorCodes:
|
|
154044
|
+
errorCodes: errorCodes40,
|
|
153795
154045
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
153796
154046
|
const { sourceFile, span } = context;
|
|
153797
154047
|
const actions2 = [];
|
|
153798
|
-
const info =
|
|
154048
|
+
const info = getInfo14(sourceFile, span.start);
|
|
153799
154049
|
if (info) {
|
|
153800
154050
|
append(actions2, getDeleteAction(context, info));
|
|
153801
154051
|
append(actions2, getRenameAction(context, info));
|
|
@@ -153806,8 +154056,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153806
154056
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
153807
154057
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
153808
154058
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
153809
|
-
eachDiagnostic(context,
|
|
153810
|
-
const info =
|
|
154059
|
+
eachDiagnostic(context, errorCodes40, ({ file, start }) => {
|
|
154060
|
+
const info = getInfo14(file, start);
|
|
153811
154061
|
if (info) {
|
|
153812
154062
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
153813
154063
|
}
|
|
@@ -153855,16 +154105,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
153855
154105
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
153856
154106
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
153857
154107
|
}
|
|
153858
|
-
var fixId32,
|
|
154108
|
+
var fixId32, errorCodes41;
|
|
153859
154109
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
153860
154110
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
153861
154111
|
"use strict";
|
|
153862
154112
|
init_ts4();
|
|
153863
154113
|
init_ts_codefix();
|
|
153864
154114
|
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
153865
|
-
|
|
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];
|
|
153866
154116
|
registerCodeFix({
|
|
153867
|
-
errorCodes:
|
|
154117
|
+
errorCodes: errorCodes41,
|
|
153868
154118
|
getCodeActions: (context) => {
|
|
153869
154119
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
153870
154120
|
if (!importDeclaration)
|
|
@@ -154051,7 +154301,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154051
154301
|
function mayDeleteExpression(node) {
|
|
154052
154302
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
154053
154303
|
}
|
|
154054
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
154304
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes42;
|
|
154055
154305
|
var init_fixUnusedIdentifier = __esm({
|
|
154056
154306
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
154057
154307
|
"use strict";
|
|
@@ -154062,7 +154312,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154062
154312
|
fixIdDelete = "unusedIdentifier_delete";
|
|
154063
154313
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
154064
154314
|
fixIdInfer = "unusedIdentifier_infer";
|
|
154065
|
-
|
|
154315
|
+
errorCodes42 = [
|
|
154066
154316
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
154067
154317
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
154068
154318
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -154072,7 +154322,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154072
154322
|
Diagnostics.All_type_parameters_are_unused.code
|
|
154073
154323
|
];
|
|
154074
154324
|
registerCodeFix({
|
|
154075
|
-
errorCodes:
|
|
154325
|
+
errorCodes: errorCodes42,
|
|
154076
154326
|
getCodeActions(context) {
|
|
154077
154327
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
154078
154328
|
const checker = program.getTypeChecker();
|
|
@@ -154158,7 +154408,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154158
154408
|
const { sourceFile, program, cancellationToken } = context;
|
|
154159
154409
|
const checker = program.getTypeChecker();
|
|
154160
154410
|
const sourceFiles = program.getSourceFiles();
|
|
154161
|
-
return codeFixAll(context,
|
|
154411
|
+
return codeFixAll(context, errorCodes42, (changes, diag2) => {
|
|
154162
154412
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
154163
154413
|
switch (context.fixId) {
|
|
154164
154414
|
case fixIdPrefix:
|
|
@@ -154230,7 +154480,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154230
154480
|
});
|
|
154231
154481
|
|
|
154232
154482
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
154233
|
-
function
|
|
154483
|
+
function doChange27(changes, sourceFile, start, length2, errorCode) {
|
|
154234
154484
|
const token = getTokenAtPosition(sourceFile, start);
|
|
154235
154485
|
const statement = findAncestor(token, isStatement);
|
|
154236
154486
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -154278,31 +154528,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154278
154528
|
}
|
|
154279
154529
|
return last2;
|
|
154280
154530
|
}
|
|
154281
|
-
var fixId33,
|
|
154531
|
+
var fixId33, errorCodes43;
|
|
154282
154532
|
var init_fixUnreachableCode = __esm({
|
|
154283
154533
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
154284
154534
|
"use strict";
|
|
154285
154535
|
init_ts4();
|
|
154286
154536
|
init_ts_codefix();
|
|
154287
154537
|
fixId33 = "fixUnreachableCode";
|
|
154288
|
-
|
|
154538
|
+
errorCodes43 = [Diagnostics.Unreachable_code_detected.code];
|
|
154289
154539
|
registerCodeFix({
|
|
154290
|
-
errorCodes:
|
|
154540
|
+
errorCodes: errorCodes43,
|
|
154291
154541
|
getCodeActions(context) {
|
|
154292
154542
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
154293
154543
|
if (syntacticDiagnostics.length)
|
|
154294
154544
|
return;
|
|
154295
|
-
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));
|
|
154296
154546
|
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
154297
154547
|
},
|
|
154298
154548
|
fixIds: [fixId33],
|
|
154299
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154549
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
154300
154550
|
});
|
|
154301
154551
|
}
|
|
154302
154552
|
});
|
|
154303
154553
|
|
|
154304
154554
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
154305
|
-
function
|
|
154555
|
+
function doChange28(changes, sourceFile, start) {
|
|
154306
154556
|
const token = getTokenAtPosition(sourceFile, start);
|
|
154307
154557
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
154308
154558
|
const pos = token.getStart(sourceFile);
|
|
@@ -154315,28 +154565,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154315
154565
|
);
|
|
154316
154566
|
changes.deleteRange(sourceFile, { pos, end });
|
|
154317
154567
|
}
|
|
154318
|
-
var fixId34,
|
|
154568
|
+
var fixId34, errorCodes44;
|
|
154319
154569
|
var init_fixUnusedLabel = __esm({
|
|
154320
154570
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
154321
154571
|
"use strict";
|
|
154322
154572
|
init_ts4();
|
|
154323
154573
|
init_ts_codefix();
|
|
154324
154574
|
fixId34 = "fixUnusedLabel";
|
|
154325
|
-
|
|
154575
|
+
errorCodes44 = [Diagnostics.Unused_label.code];
|
|
154326
154576
|
registerCodeFix({
|
|
154327
|
-
errorCodes:
|
|
154577
|
+
errorCodes: errorCodes44,
|
|
154328
154578
|
getCodeActions(context) {
|
|
154329
|
-
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));
|
|
154330
154580
|
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
154331
154581
|
},
|
|
154332
154582
|
fixIds: [fixId34],
|
|
154333
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154583
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => doChange28(changes, diag2.file, diag2.start))
|
|
154334
154584
|
});
|
|
154335
154585
|
}
|
|
154336
154586
|
});
|
|
154337
154587
|
|
|
154338
154588
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
154339
|
-
function
|
|
154589
|
+
function doChange29(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
154340
154590
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
154341
154591
|
newType,
|
|
154342
154592
|
/*enclosingDeclaration*/
|
|
@@ -154345,7 +154595,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154345
154595
|
void 0
|
|
154346
154596
|
));
|
|
154347
154597
|
}
|
|
154348
|
-
function
|
|
154598
|
+
function getInfo15(sourceFile, pos, checker) {
|
|
154349
154599
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
154350
154600
|
const typeNode = decl && decl.type;
|
|
154351
154601
|
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
@@ -154385,7 +154635,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154385
154635
|
}
|
|
154386
154636
|
return checker.getTypeFromTypeNode(node);
|
|
154387
154637
|
}
|
|
154388
|
-
var fixIdPlain, fixIdNullable,
|
|
154638
|
+
var fixIdPlain, fixIdNullable, errorCodes45;
|
|
154389
154639
|
var init_fixJSDocTypes = __esm({
|
|
154390
154640
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
154391
154641
|
"use strict";
|
|
@@ -154393,17 +154643,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154393
154643
|
init_ts_codefix();
|
|
154394
154644
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
154395
154645
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
154396
|
-
|
|
154646
|
+
errorCodes45 = [
|
|
154397
154647
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
154398
154648
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
154399
154649
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
154400
154650
|
];
|
|
154401
154651
|
registerCodeFix({
|
|
154402
|
-
errorCodes:
|
|
154652
|
+
errorCodes: errorCodes45,
|
|
154403
154653
|
getCodeActions(context) {
|
|
154404
154654
|
const { sourceFile } = context;
|
|
154405
154655
|
const checker = context.program.getTypeChecker();
|
|
154406
|
-
const info =
|
|
154656
|
+
const info = getInfo15(sourceFile, context.span.start, checker);
|
|
154407
154657
|
if (!info)
|
|
154408
154658
|
return void 0;
|
|
154409
154659
|
const { typeNode, type } = info;
|
|
@@ -154414,7 +154664,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154414
154664
|
}
|
|
154415
154665
|
return actions2;
|
|
154416
154666
|
function fix(type2, fixId52, fixAllDescription) {
|
|
154417
|
-
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));
|
|
154418
154668
|
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
154419
154669
|
}
|
|
154420
154670
|
},
|
|
@@ -154422,13 +154672,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154422
154672
|
getAllCodeActions(context) {
|
|
154423
154673
|
const { fixId: fixId52, program, sourceFile } = context;
|
|
154424
154674
|
const checker = program.getTypeChecker();
|
|
154425
|
-
return codeFixAll(context,
|
|
154426
|
-
const info =
|
|
154675
|
+
return codeFixAll(context, errorCodes45, (changes, err) => {
|
|
154676
|
+
const info = getInfo15(err.file, err.start, checker);
|
|
154427
154677
|
if (!info)
|
|
154428
154678
|
return;
|
|
154429
154679
|
const { typeNode, type } = info;
|
|
154430
154680
|
const fixedType = typeNode.kind === 321 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
154431
|
-
|
|
154681
|
+
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
154432
154682
|
});
|
|
154433
154683
|
}
|
|
154434
154684
|
});
|
|
@@ -154436,7 +154686,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154436
154686
|
});
|
|
154437
154687
|
|
|
154438
154688
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
154439
|
-
function
|
|
154689
|
+
function doChange30(changes, sourceFile, name) {
|
|
154440
154690
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
154441
154691
|
}
|
|
154442
154692
|
function getCallName(sourceFile, start) {
|
|
@@ -154453,31 +154703,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154453
154703
|
}
|
|
154454
154704
|
return void 0;
|
|
154455
154705
|
}
|
|
154456
|
-
var fixId35,
|
|
154706
|
+
var fixId35, errorCodes46;
|
|
154457
154707
|
var init_fixMissingCallParentheses = __esm({
|
|
154458
154708
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
154459
154709
|
"use strict";
|
|
154460
154710
|
init_ts4();
|
|
154461
154711
|
init_ts_codefix();
|
|
154462
154712
|
fixId35 = "fixMissingCallParentheses";
|
|
154463
|
-
|
|
154713
|
+
errorCodes46 = [
|
|
154464
154714
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
154465
154715
|
];
|
|
154466
154716
|
registerCodeFix({
|
|
154467
|
-
errorCodes:
|
|
154717
|
+
errorCodes: errorCodes46,
|
|
154468
154718
|
fixIds: [fixId35],
|
|
154469
154719
|
getCodeActions(context) {
|
|
154470
154720
|
const { sourceFile, span } = context;
|
|
154471
154721
|
const callName = getCallName(sourceFile, span.start);
|
|
154472
154722
|
if (!callName)
|
|
154473
154723
|
return;
|
|
154474
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154724
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, context.sourceFile, callName));
|
|
154475
154725
|
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
154476
154726
|
},
|
|
154477
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154727
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
154478
154728
|
const callName = getCallName(diag2.file, diag2.start);
|
|
154479
154729
|
if (callName)
|
|
154480
|
-
|
|
154730
|
+
doChange30(changes, diag2.file, callName);
|
|
154481
154731
|
})
|
|
154482
154732
|
});
|
|
154483
154733
|
}
|
|
@@ -154519,7 +154769,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154519
154769
|
returnType: getReturnType(containingFunction)
|
|
154520
154770
|
};
|
|
154521
154771
|
}
|
|
154522
|
-
function
|
|
154772
|
+
function doChange31(changes, sourceFile, { insertBefore, returnType }) {
|
|
154523
154773
|
if (returnType) {
|
|
154524
154774
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
154525
154775
|
if (!entityName || entityName.kind !== 80 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -154528,37 +154778,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154528
154778
|
}
|
|
154529
154779
|
changes.insertModifierBefore(sourceFile, 134 /* AsyncKeyword */, insertBefore);
|
|
154530
154780
|
}
|
|
154531
|
-
var fixId36,
|
|
154781
|
+
var fixId36, errorCodes47;
|
|
154532
154782
|
var init_fixAwaitInSyncFunction = __esm({
|
|
154533
154783
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
154534
154784
|
"use strict";
|
|
154535
154785
|
init_ts4();
|
|
154536
154786
|
init_ts_codefix();
|
|
154537
154787
|
fixId36 = "fixAwaitInSyncFunction";
|
|
154538
|
-
|
|
154788
|
+
errorCodes47 = [
|
|
154539
154789
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154540
154790
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154541
154791
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
154542
154792
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
154543
154793
|
];
|
|
154544
154794
|
registerCodeFix({
|
|
154545
|
-
errorCodes:
|
|
154795
|
+
errorCodes: errorCodes47,
|
|
154546
154796
|
getCodeActions(context) {
|
|
154547
154797
|
const { sourceFile, span } = context;
|
|
154548
154798
|
const nodes = getNodes3(sourceFile, span.start);
|
|
154549
154799
|
if (!nodes)
|
|
154550
154800
|
return void 0;
|
|
154551
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154801
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes));
|
|
154552
154802
|
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
154553
154803
|
},
|
|
154554
154804
|
fixIds: [fixId36],
|
|
154555
154805
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
154556
154806
|
const seen = /* @__PURE__ */ new Map();
|
|
154557
|
-
return codeFixAll(context,
|
|
154807
|
+
return codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
154558
154808
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
154559
154809
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
154560
154810
|
return;
|
|
154561
|
-
|
|
154811
|
+
doChange31(changes, context.sourceFile, nodes);
|
|
154562
154812
|
});
|
|
154563
154813
|
}
|
|
154564
154814
|
});
|
|
@@ -154566,7 +154816,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154566
154816
|
});
|
|
154567
154817
|
|
|
154568
154818
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
154569
|
-
function
|
|
154819
|
+
function doChange32(file, start, length2, code, context) {
|
|
154570
154820
|
let startPosition;
|
|
154571
154821
|
let endPosition;
|
|
154572
154822
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -154593,28 +154843,28 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154593
154843
|
}
|
|
154594
154844
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
154595
154845
|
}
|
|
154596
|
-
var
|
|
154846
|
+
var errorCodes48, fixId37;
|
|
154597
154847
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
154598
154848
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
154599
154849
|
"use strict";
|
|
154600
154850
|
init_ts4();
|
|
154601
154851
|
init_ts_codefix();
|
|
154602
|
-
|
|
154852
|
+
errorCodes48 = [
|
|
154603
154853
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
154604
154854
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
154605
154855
|
];
|
|
154606
154856
|
fixId37 = "fixPropertyOverrideAccessor";
|
|
154607
154857
|
registerCodeFix({
|
|
154608
|
-
errorCodes:
|
|
154858
|
+
errorCodes: errorCodes48,
|
|
154609
154859
|
getCodeActions(context) {
|
|
154610
|
-
const edits =
|
|
154860
|
+
const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
154611
154861
|
if (edits) {
|
|
154612
154862
|
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
154613
154863
|
}
|
|
154614
154864
|
},
|
|
154615
154865
|
fixIds: [fixId37],
|
|
154616
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154617
|
-
const edits =
|
|
154866
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
154867
|
+
const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
154618
154868
|
if (edits) {
|
|
154619
154869
|
for (const edit of edits) {
|
|
154620
154870
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -154661,7 +154911,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
154661
154911
|
}
|
|
154662
154912
|
return errorCode;
|
|
154663
154913
|
}
|
|
154664
|
-
function
|
|
154914
|
+
function doChange33(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
154665
154915
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 80 /* Identifier */ && token.kind !== 26 /* DotDotDotToken */ && token.kind !== 110 /* ThisKeyword */) {
|
|
154666
154916
|
return void 0;
|
|
154667
154917
|
}
|
|
@@ -155558,14 +155808,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155558
155808
|
}
|
|
155559
155809
|
}
|
|
155560
155810
|
}
|
|
155561
|
-
var fixId38,
|
|
155811
|
+
var fixId38, errorCodes49;
|
|
155562
155812
|
var init_inferFromUsage = __esm({
|
|
155563
155813
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
155564
155814
|
"use strict";
|
|
155565
155815
|
init_ts4();
|
|
155566
155816
|
init_ts_codefix();
|
|
155567
155817
|
fixId38 = "inferFromUsage";
|
|
155568
|
-
|
|
155818
|
+
errorCodes49 = [
|
|
155569
155819
|
// Variable declarations
|
|
155570
155820
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
155571
155821
|
// Variable uses
|
|
@@ -155599,13 +155849,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155599
155849
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
155600
155850
|
];
|
|
155601
155851
|
registerCodeFix({
|
|
155602
|
-
errorCodes:
|
|
155852
|
+
errorCodes: errorCodes49,
|
|
155603
155853
|
getCodeActions(context) {
|
|
155604
155854
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
155605
155855
|
const token = getTokenAtPosition(sourceFile, start);
|
|
155606
155856
|
let declaration;
|
|
155607
155857
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
155608
|
-
declaration =
|
|
155858
|
+
declaration = doChange33(
|
|
155609
155859
|
changes2,
|
|
155610
155860
|
sourceFile,
|
|
155611
155861
|
token,
|
|
@@ -155625,8 +155875,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155625
155875
|
getAllCodeActions(context) {
|
|
155626
155876
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
155627
155877
|
const markSeen = nodeSeenTracker();
|
|
155628
|
-
return codeFixAll(context,
|
|
155629
|
-
|
|
155878
|
+
return codeFixAll(context, errorCodes49, (changes, err) => {
|
|
155879
|
+
doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
155630
155880
|
});
|
|
155631
155881
|
}
|
|
155632
155882
|
});
|
|
@@ -155634,7 +155884,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155634
155884
|
});
|
|
155635
155885
|
|
|
155636
155886
|
// src/services/codefixes/fixReturnTypeInAsyncFunction.ts
|
|
155637
|
-
function
|
|
155887
|
+
function getInfo16(sourceFile, checker, pos) {
|
|
155638
155888
|
if (isInJSFile(sourceFile)) {
|
|
155639
155889
|
return void 0;
|
|
155640
155890
|
}
|
|
@@ -155657,31 +155907,31 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155657
155907
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
155658
155908
|
}
|
|
155659
155909
|
}
|
|
155660
|
-
function
|
|
155910
|
+
function doChange34(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
155661
155911
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
155662
155912
|
}
|
|
155663
|
-
var fixId39,
|
|
155913
|
+
var fixId39, errorCodes50;
|
|
155664
155914
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
155665
155915
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
155666
155916
|
"use strict";
|
|
155667
155917
|
init_ts4();
|
|
155668
155918
|
init_ts_codefix();
|
|
155669
155919
|
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
155670
|
-
|
|
155920
|
+
errorCodes50 = [
|
|
155671
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
|
|
155672
155922
|
];
|
|
155673
155923
|
registerCodeFix({
|
|
155674
|
-
errorCodes:
|
|
155924
|
+
errorCodes: errorCodes50,
|
|
155675
155925
|
fixIds: [fixId39],
|
|
155676
155926
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
155677
155927
|
const { sourceFile, program, span } = context;
|
|
155678
155928
|
const checker = program.getTypeChecker();
|
|
155679
|
-
const info =
|
|
155929
|
+
const info = getInfo16(sourceFile, program.getTypeChecker(), span.start);
|
|
155680
155930
|
if (!info) {
|
|
155681
155931
|
return void 0;
|
|
155682
155932
|
}
|
|
155683
155933
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
155684
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155934
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
155685
155935
|
return [createCodeFixAction(
|
|
155686
155936
|
fixId39,
|
|
155687
155937
|
changes,
|
|
@@ -155690,10 +155940,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155690
155940
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
155691
155941
|
)];
|
|
155692
155942
|
},
|
|
155693
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155694
|
-
const info =
|
|
155943
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
155944
|
+
const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
155695
155945
|
if (info) {
|
|
155696
|
-
|
|
155946
|
+
doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
155697
155947
|
}
|
|
155698
155948
|
})
|
|
155699
155949
|
});
|
|
@@ -155707,7 +155957,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155707
155957
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
155708
155958
|
}
|
|
155709
155959
|
}
|
|
155710
|
-
var fixName4, fixId40,
|
|
155960
|
+
var fixName4, fixId40, errorCodes51;
|
|
155711
155961
|
var init_disableJsDiagnostics = __esm({
|
|
155712
155962
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
155713
155963
|
"use strict";
|
|
@@ -155715,12 +155965,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155715
155965
|
init_ts_codefix();
|
|
155716
155966
|
fixName4 = "disableJsDiagnostics";
|
|
155717
155967
|
fixId40 = "disableJsDiagnostics";
|
|
155718
|
-
|
|
155968
|
+
errorCodes51 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
155719
155969
|
const diag2 = Diagnostics[key];
|
|
155720
155970
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
155721
155971
|
});
|
|
155722
155972
|
registerCodeFix({
|
|
155723
|
-
errorCodes:
|
|
155973
|
+
errorCodes: errorCodes51,
|
|
155724
155974
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
155725
155975
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
155726
155976
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -155748,7 +155998,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
155748
155998
|
fixIds: [fixId40],
|
|
155749
155999
|
getAllCodeActions: (context) => {
|
|
155750
156000
|
const seenLines = /* @__PURE__ */ new Set();
|
|
155751
|
-
return codeFixAll(context,
|
|
156001
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
155752
156002
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
155753
156003
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
155754
156004
|
}
|
|
@@ -156760,7 +157010,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156760
157010
|
});
|
|
156761
157011
|
|
|
156762
157012
|
// src/services/codefixes/fixStrictClassInitialization.ts
|
|
156763
|
-
function
|
|
157013
|
+
function getInfo17(sourceFile, pos) {
|
|
156764
157014
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
156765
157015
|
if (isIdentifier(token) && isPropertyDeclaration(token.parent)) {
|
|
156766
157016
|
const type = getEffectiveTypeAnnotationNode(token.parent);
|
|
@@ -156864,7 +157114,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156864
157114
|
}
|
|
156865
157115
|
return void 0;
|
|
156866
157116
|
}
|
|
156867
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
157117
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes52;
|
|
156868
157118
|
var init_fixStrictClassInitialization = __esm({
|
|
156869
157119
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
156870
157120
|
"use strict";
|
|
@@ -156874,11 +157124,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156874
157124
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
156875
157125
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
156876
157126
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
156877
|
-
|
|
157127
|
+
errorCodes52 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
156878
157128
|
registerCodeFix({
|
|
156879
|
-
errorCodes:
|
|
157129
|
+
errorCodes: errorCodes52,
|
|
156880
157130
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
156881
|
-
const info =
|
|
157131
|
+
const info = getInfo17(context.sourceFile, context.span.start);
|
|
156882
157132
|
if (!info)
|
|
156883
157133
|
return;
|
|
156884
157134
|
const result = [];
|
|
@@ -156889,8 +157139,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156889
157139
|
},
|
|
156890
157140
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
156891
157141
|
getAllCodeActions: (context) => {
|
|
156892
|
-
return codeFixAll(context,
|
|
156893
|
-
const info =
|
|
157142
|
+
return codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
157143
|
+
const info = getInfo17(diag2.file, diag2.start);
|
|
156894
157144
|
if (!info)
|
|
156895
157145
|
return;
|
|
156896
157146
|
switch (context.fixId) {
|
|
@@ -156917,7 +157167,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156917
157167
|
});
|
|
156918
157168
|
|
|
156919
157169
|
// src/services/codefixes/requireInTs.ts
|
|
156920
|
-
function
|
|
157170
|
+
function doChange35(changes, sourceFile, info) {
|
|
156921
157171
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
156922
157172
|
changes.replaceNode(
|
|
156923
157173
|
sourceFile,
|
|
@@ -156944,7 +157194,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156944
157194
|
)
|
|
156945
157195
|
);
|
|
156946
157196
|
}
|
|
156947
|
-
function
|
|
157197
|
+
function getInfo18(sourceFile, program, pos) {
|
|
156948
157198
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
156949
157199
|
if (!isRequireCall(
|
|
156950
157200
|
parent2,
|
|
@@ -156983,29 +157233,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
156983
157233
|
return factory.createNamedImports(importSpecifiers);
|
|
156984
157234
|
}
|
|
156985
157235
|
}
|
|
156986
|
-
var fixId41,
|
|
157236
|
+
var fixId41, errorCodes53;
|
|
156987
157237
|
var init_requireInTs = __esm({
|
|
156988
157238
|
"src/services/codefixes/requireInTs.ts"() {
|
|
156989
157239
|
"use strict";
|
|
156990
157240
|
init_ts4();
|
|
156991
157241
|
init_ts_codefix();
|
|
156992
157242
|
fixId41 = "requireInTs";
|
|
156993
|
-
|
|
157243
|
+
errorCodes53 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
156994
157244
|
registerCodeFix({
|
|
156995
|
-
errorCodes:
|
|
157245
|
+
errorCodes: errorCodes53,
|
|
156996
157246
|
getCodeActions(context) {
|
|
156997
|
-
const info =
|
|
157247
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
156998
157248
|
if (!info) {
|
|
156999
157249
|
return void 0;
|
|
157000
157250
|
}
|
|
157001
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157251
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info));
|
|
157002
157252
|
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
157003
157253
|
},
|
|
157004
157254
|
fixIds: [fixId41],
|
|
157005
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157006
|
-
const info =
|
|
157255
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
157256
|
+
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
157007
157257
|
if (info) {
|
|
157008
|
-
|
|
157258
|
+
doChange35(changes, context.sourceFile, info);
|
|
157009
157259
|
}
|
|
157010
157260
|
})
|
|
157011
157261
|
});
|
|
@@ -157013,7 +157263,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157013
157263
|
});
|
|
157014
157264
|
|
|
157015
157265
|
// src/services/codefixes/useDefaultImport.ts
|
|
157016
|
-
function
|
|
157266
|
+
function getInfo19(sourceFile, pos) {
|
|
157017
157267
|
const name = getTokenAtPosition(sourceFile, pos);
|
|
157018
157268
|
if (!isIdentifier(name))
|
|
157019
157269
|
return void 0;
|
|
@@ -157025,7 +157275,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157025
157275
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
157026
157276
|
}
|
|
157027
157277
|
}
|
|
157028
|
-
function
|
|
157278
|
+
function doChange36(changes, sourceFile, info, preferences) {
|
|
157029
157279
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
157030
157280
|
info.name,
|
|
157031
157281
|
/*namedImports*/
|
|
@@ -157034,29 +157284,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157034
157284
|
getQuotePreference(sourceFile, preferences)
|
|
157035
157285
|
));
|
|
157036
157286
|
}
|
|
157037
|
-
var fixId42,
|
|
157287
|
+
var fixId42, errorCodes54;
|
|
157038
157288
|
var init_useDefaultImport = __esm({
|
|
157039
157289
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
157040
157290
|
"use strict";
|
|
157041
157291
|
init_ts4();
|
|
157042
157292
|
init_ts_codefix();
|
|
157043
157293
|
fixId42 = "useDefaultImport";
|
|
157044
|
-
|
|
157294
|
+
errorCodes54 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
157045
157295
|
registerCodeFix({
|
|
157046
|
-
errorCodes:
|
|
157296
|
+
errorCodes: errorCodes54,
|
|
157047
157297
|
getCodeActions(context) {
|
|
157048
157298
|
const { sourceFile, span: { start } } = context;
|
|
157049
|
-
const info =
|
|
157299
|
+
const info = getInfo19(sourceFile, start);
|
|
157050
157300
|
if (!info)
|
|
157051
157301
|
return void 0;
|
|
157052
|
-
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));
|
|
157053
157303
|
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
157054
157304
|
},
|
|
157055
157305
|
fixIds: [fixId42],
|
|
157056
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157057
|
-
const info =
|
|
157306
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
157307
|
+
const info = getInfo19(diag2.file, diag2.start);
|
|
157058
157308
|
if (info)
|
|
157059
|
-
|
|
157309
|
+
doChange36(changes, diag2.file, info, context.preferences);
|
|
157060
157310
|
})
|
|
157061
157311
|
});
|
|
157062
157312
|
}
|
|
@@ -157071,18 +157321,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157071
157321
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
157072
157322
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
157073
157323
|
}
|
|
157074
|
-
var fixId43,
|
|
157324
|
+
var fixId43, errorCodes55;
|
|
157075
157325
|
var init_useBigintLiteral = __esm({
|
|
157076
157326
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
157077
157327
|
"use strict";
|
|
157078
157328
|
init_ts4();
|
|
157079
157329
|
init_ts_codefix();
|
|
157080
157330
|
fixId43 = "useBigintLiteral";
|
|
157081
|
-
|
|
157331
|
+
errorCodes55 = [
|
|
157082
157332
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
157083
157333
|
];
|
|
157084
157334
|
registerCodeFix({
|
|
157085
|
-
errorCodes:
|
|
157335
|
+
errorCodes: errorCodes55,
|
|
157086
157336
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
157087
157337
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
157088
157338
|
if (changes.length > 0) {
|
|
@@ -157091,7 +157341,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157091
157341
|
},
|
|
157092
157342
|
fixIds: [fixId43],
|
|
157093
157343
|
getAllCodeActions: (context) => {
|
|
157094
|
-
return codeFixAll(context,
|
|
157344
|
+
return codeFixAll(context, errorCodes55, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
157095
157345
|
}
|
|
157096
157346
|
});
|
|
157097
157347
|
}
|
|
@@ -157104,7 +157354,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157104
157354
|
Debug.assert(token.parent.kind === 205 /* ImportType */, "Token parent should be an ImportType");
|
|
157105
157355
|
return token.parent;
|
|
157106
157356
|
}
|
|
157107
|
-
function
|
|
157357
|
+
function doChange37(changes, sourceFile, importType) {
|
|
157108
157358
|
const newTypeNode = factory.updateImportTypeNode(
|
|
157109
157359
|
importType,
|
|
157110
157360
|
importType.argument,
|
|
@@ -157116,7 +157366,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157116
157366
|
);
|
|
157117
157367
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
157118
157368
|
}
|
|
157119
|
-
var fixIdAddMissingTypeof, fixId44,
|
|
157369
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes56;
|
|
157120
157370
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
157121
157371
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
157122
157372
|
"use strict";
|
|
@@ -157124,17 +157374,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157124
157374
|
init_ts_codefix();
|
|
157125
157375
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
157126
157376
|
fixId44 = fixIdAddMissingTypeof;
|
|
157127
|
-
|
|
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];
|
|
157128
157378
|
registerCodeFix({
|
|
157129
|
-
errorCodes:
|
|
157379
|
+
errorCodes: errorCodes56,
|
|
157130
157380
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
157131
157381
|
const { sourceFile, span } = context;
|
|
157132
157382
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
157133
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157383
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType));
|
|
157134
157384
|
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
157135
157385
|
},
|
|
157136
157386
|
fixIds: [fixId44],
|
|
157137
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157387
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
157138
157388
|
});
|
|
157139
157389
|
}
|
|
157140
157390
|
});
|
|
@@ -157153,7 +157403,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157153
157403
|
return void 0;
|
|
157154
157404
|
return binaryExpr;
|
|
157155
157405
|
}
|
|
157156
|
-
function
|
|
157406
|
+
function doChange38(changeTracker, sf, node) {
|
|
157157
157407
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
157158
157408
|
if (jsx)
|
|
157159
157409
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -157176,37 +157426,37 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157176
157426
|
return void 0;
|
|
157177
157427
|
}
|
|
157178
157428
|
}
|
|
157179
|
-
var fixID2,
|
|
157429
|
+
var fixID2, errorCodes57;
|
|
157180
157430
|
var init_wrapJsxInFragment = __esm({
|
|
157181
157431
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
157182
157432
|
"use strict";
|
|
157183
157433
|
init_ts4();
|
|
157184
157434
|
init_ts_codefix();
|
|
157185
157435
|
fixID2 = "wrapJsxInFragment";
|
|
157186
|
-
|
|
157436
|
+
errorCodes57 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
157187
157437
|
registerCodeFix({
|
|
157188
|
-
errorCodes:
|
|
157438
|
+
errorCodes: errorCodes57,
|
|
157189
157439
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
157190
157440
|
const { sourceFile, span } = context;
|
|
157191
157441
|
const node = findNodeToFix(sourceFile, span.start);
|
|
157192
157442
|
if (!node)
|
|
157193
157443
|
return void 0;
|
|
157194
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157444
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(t, sourceFile, node));
|
|
157195
157445
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
157196
157446
|
},
|
|
157197
157447
|
fixIds: [fixID2],
|
|
157198
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157448
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
157199
157449
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
157200
157450
|
if (!node)
|
|
157201
157451
|
return void 0;
|
|
157202
|
-
|
|
157452
|
+
doChange38(changes, context.sourceFile, node);
|
|
157203
157453
|
})
|
|
157204
157454
|
});
|
|
157205
157455
|
}
|
|
157206
157456
|
});
|
|
157207
157457
|
|
|
157208
157458
|
// src/services/codefixes/convertToMappedObjectType.ts
|
|
157209
|
-
function
|
|
157459
|
+
function getInfo20(sourceFile, pos) {
|
|
157210
157460
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
157211
157461
|
const indexSignature = tryCast(token.parent.parent, isIndexSignatureDeclaration);
|
|
157212
157462
|
if (!indexSignature)
|
|
@@ -157219,7 +157469,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157219
157469
|
function createTypeAliasFromInterface(declaration, type) {
|
|
157220
157470
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
157221
157471
|
}
|
|
157222
|
-
function
|
|
157472
|
+
function doChange39(changes, sourceFile, { indexSignature, container }) {
|
|
157223
157473
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
157224
157474
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
157225
157475
|
const parameter = first(indexSignature.parameters);
|
|
@@ -157246,48 +157496,48 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157246
157496
|
]);
|
|
157247
157497
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
157248
157498
|
}
|
|
157249
|
-
var fixId45,
|
|
157499
|
+
var fixId45, errorCodes58;
|
|
157250
157500
|
var init_convertToMappedObjectType = __esm({
|
|
157251
157501
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
157252
157502
|
"use strict";
|
|
157253
157503
|
init_ts4();
|
|
157254
157504
|
init_ts_codefix();
|
|
157255
157505
|
fixId45 = "fixConvertToMappedObjectType";
|
|
157256
|
-
|
|
157506
|
+
errorCodes58 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
157257
157507
|
registerCodeFix({
|
|
157258
|
-
errorCodes:
|
|
157508
|
+
errorCodes: errorCodes58,
|
|
157259
157509
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
157260
157510
|
const { sourceFile, span } = context;
|
|
157261
|
-
const info =
|
|
157511
|
+
const info = getInfo20(sourceFile, span.start);
|
|
157262
157512
|
if (!info)
|
|
157263
157513
|
return void 0;
|
|
157264
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157514
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
|
|
157265
157515
|
const name = idText(info.container.name);
|
|
157266
157516
|
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
157267
157517
|
},
|
|
157268
157518
|
fixIds: [fixId45],
|
|
157269
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157270
|
-
const info =
|
|
157519
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => {
|
|
157520
|
+
const info = getInfo20(diag2.file, diag2.start);
|
|
157271
157521
|
if (info)
|
|
157272
|
-
|
|
157522
|
+
doChange39(changes, diag2.file, info);
|
|
157273
157523
|
})
|
|
157274
157524
|
});
|
|
157275
157525
|
}
|
|
157276
157526
|
});
|
|
157277
157527
|
|
|
157278
157528
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
157279
|
-
var fixId46,
|
|
157529
|
+
var fixId46, errorCodes59;
|
|
157280
157530
|
var init_removeAccidentalCallParentheses = __esm({
|
|
157281
157531
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
157282
157532
|
"use strict";
|
|
157283
157533
|
init_ts4();
|
|
157284
157534
|
init_ts_codefix();
|
|
157285
157535
|
fixId46 = "removeAccidentalCallParentheses";
|
|
157286
|
-
|
|
157536
|
+
errorCodes59 = [
|
|
157287
157537
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
157288
157538
|
];
|
|
157289
157539
|
registerCodeFix({
|
|
157290
|
-
errorCodes:
|
|
157540
|
+
errorCodes: errorCodes59,
|
|
157291
157541
|
getCodeActions(context) {
|
|
157292
157542
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
157293
157543
|
if (!callExpression) {
|
|
@@ -157327,18 +157577,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157327
157577
|
}
|
|
157328
157578
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
157329
157579
|
}
|
|
157330
|
-
var fixId47,
|
|
157580
|
+
var fixId47, errorCodes60;
|
|
157331
157581
|
var init_removeUnnecessaryAwait = __esm({
|
|
157332
157582
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
157333
157583
|
"use strict";
|
|
157334
157584
|
init_ts4();
|
|
157335
157585
|
init_ts_codefix();
|
|
157336
157586
|
fixId47 = "removeUnnecessaryAwait";
|
|
157337
|
-
|
|
157587
|
+
errorCodes60 = [
|
|
157338
157588
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
157339
157589
|
];
|
|
157340
157590
|
registerCodeFix({
|
|
157341
|
-
errorCodes:
|
|
157591
|
+
errorCodes: errorCodes60,
|
|
157342
157592
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
157343
157593
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
157344
157594
|
if (changes.length > 0) {
|
|
@@ -157347,7 +157597,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157347
157597
|
},
|
|
157348
157598
|
fixIds: [fixId47],
|
|
157349
157599
|
getAllCodeActions: (context) => {
|
|
157350
|
-
return codeFixAll(context,
|
|
157600
|
+
return codeFixAll(context, errorCodes60, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
157351
157601
|
}
|
|
157352
157602
|
});
|
|
157353
157603
|
}
|
|
@@ -157397,16 +157647,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157397
157647
|
)
|
|
157398
157648
|
);
|
|
157399
157649
|
}
|
|
157400
|
-
var
|
|
157650
|
+
var errorCodes61, fixId48;
|
|
157401
157651
|
var init_splitTypeOnlyImport = __esm({
|
|
157402
157652
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
157403
157653
|
"use strict";
|
|
157404
157654
|
init_ts4();
|
|
157405
157655
|
init_ts_codefix();
|
|
157406
|
-
|
|
157656
|
+
errorCodes61 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
157407
157657
|
fixId48 = "splitTypeOnlyImport";
|
|
157408
157658
|
registerCodeFix({
|
|
157409
|
-
errorCodes:
|
|
157659
|
+
errorCodes: errorCodes61,
|
|
157410
157660
|
fixIds: [fixId48],
|
|
157411
157661
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
157412
157662
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
@@ -157416,7 +157666,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157416
157666
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
157417
157667
|
}
|
|
157418
157668
|
},
|
|
157419
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157669
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, error2) => {
|
|
157420
157670
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
157421
157671
|
})
|
|
157422
157672
|
});
|
|
@@ -157424,7 +157674,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157424
157674
|
});
|
|
157425
157675
|
|
|
157426
157676
|
// src/services/codefixes/convertConstToLet.ts
|
|
157427
|
-
function
|
|
157677
|
+
function getInfo21(sourceFile, pos, program) {
|
|
157428
157678
|
var _a;
|
|
157429
157679
|
const checker = program.getTypeChecker();
|
|
157430
157680
|
const symbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, pos));
|
|
@@ -157438,36 +157688,36 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157438
157688
|
return;
|
|
157439
157689
|
return { symbol, token: constToken };
|
|
157440
157690
|
}
|
|
157441
|
-
function
|
|
157691
|
+
function doChange40(changes, sourceFile, token) {
|
|
157442
157692
|
changes.replaceNode(sourceFile, token, factory.createToken(121 /* LetKeyword */));
|
|
157443
157693
|
}
|
|
157444
|
-
var fixId49,
|
|
157694
|
+
var fixId49, errorCodes62;
|
|
157445
157695
|
var init_convertConstToLet = __esm({
|
|
157446
157696
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
157447
157697
|
"use strict";
|
|
157448
157698
|
init_ts4();
|
|
157449
157699
|
init_ts_codefix();
|
|
157450
157700
|
fixId49 = "fixConvertConstToLet";
|
|
157451
|
-
|
|
157701
|
+
errorCodes62 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
157452
157702
|
registerCodeFix({
|
|
157453
|
-
errorCodes:
|
|
157703
|
+
errorCodes: errorCodes62,
|
|
157454
157704
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
157455
157705
|
const { sourceFile, span, program } = context;
|
|
157456
|
-
const info =
|
|
157706
|
+
const info = getInfo21(sourceFile, span.start, program);
|
|
157457
157707
|
if (info === void 0)
|
|
157458
157708
|
return;
|
|
157459
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157709
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
|
|
157460
157710
|
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
157461
157711
|
},
|
|
157462
157712
|
getAllCodeActions: (context) => {
|
|
157463
157713
|
const { program } = context;
|
|
157464
157714
|
const seen = /* @__PURE__ */ new Map();
|
|
157465
157715
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
157466
|
-
eachDiagnostic(context,
|
|
157467
|
-
const info =
|
|
157716
|
+
eachDiagnostic(context, errorCodes62, (diag2) => {
|
|
157717
|
+
const info = getInfo21(diag2.file, diag2.start, program);
|
|
157468
157718
|
if (info) {
|
|
157469
157719
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
157470
|
-
return
|
|
157720
|
+
return doChange40(changes, diag2.file, info.token);
|
|
157471
157721
|
}
|
|
157472
157722
|
}
|
|
157473
157723
|
return void 0;
|
|
@@ -157480,15 +157730,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157480
157730
|
});
|
|
157481
157731
|
|
|
157482
157732
|
// src/services/codefixes/fixExpectedComma.ts
|
|
157483
|
-
function
|
|
157733
|
+
function getInfo22(sourceFile, pos, _) {
|
|
157484
157734
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
157485
157735
|
return node.kind === 27 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
157486
157736
|
}
|
|
157487
|
-
function
|
|
157737
|
+
function doChange41(changes, sourceFile, { node }) {
|
|
157488
157738
|
const newNode = factory.createToken(28 /* CommaToken */);
|
|
157489
157739
|
changes.replaceNode(sourceFile, node, newNode);
|
|
157490
157740
|
}
|
|
157491
|
-
var fixId50, expectedErrorCode,
|
|
157741
|
+
var fixId50, expectedErrorCode, errorCodes63;
|
|
157492
157742
|
var init_fixExpectedComma = __esm({
|
|
157493
157743
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
157494
157744
|
"use strict";
|
|
@@ -157496,15 +157746,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157496
157746
|
init_ts_codefix();
|
|
157497
157747
|
fixId50 = "fixExpectedComma";
|
|
157498
157748
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
157499
|
-
|
|
157749
|
+
errorCodes63 = [expectedErrorCode];
|
|
157500
157750
|
registerCodeFix({
|
|
157501
|
-
errorCodes:
|
|
157751
|
+
errorCodes: errorCodes63,
|
|
157502
157752
|
getCodeActions(context) {
|
|
157503
157753
|
const { sourceFile } = context;
|
|
157504
|
-
const info =
|
|
157754
|
+
const info = getInfo22(sourceFile, context.span.start, context.errorCode);
|
|
157505
157755
|
if (!info)
|
|
157506
157756
|
return void 0;
|
|
157507
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157757
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
|
|
157508
157758
|
return [createCodeFixAction(
|
|
157509
157759
|
fixId50,
|
|
157510
157760
|
changes,
|
|
@@ -157514,10 +157764,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157514
157764
|
)];
|
|
157515
157765
|
},
|
|
157516
157766
|
fixIds: [fixId50],
|
|
157517
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157518
|
-
const info =
|
|
157767
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes63, (changes, diag2) => {
|
|
157768
|
+
const info = getInfo22(diag2.file, diag2.start, diag2.code);
|
|
157519
157769
|
if (info)
|
|
157520
|
-
|
|
157770
|
+
doChange41(changes, context.sourceFile, info);
|
|
157521
157771
|
})
|
|
157522
157772
|
});
|
|
157523
157773
|
}
|
|
@@ -157573,7 +157823,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157573
157823
|
return node.typeArguments;
|
|
157574
157824
|
}
|
|
157575
157825
|
}
|
|
157576
|
-
var fixName7, fixId51,
|
|
157826
|
+
var fixName7, fixId51, errorCodes64;
|
|
157577
157827
|
var init_fixAddVoidToPromise = __esm({
|
|
157578
157828
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
157579
157829
|
"use strict";
|
|
@@ -157581,12 +157831,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157581
157831
|
init_ts_codefix();
|
|
157582
157832
|
fixName7 = "addVoidToPromise";
|
|
157583
157833
|
fixId51 = "addVoidToPromise";
|
|
157584
|
-
|
|
157834
|
+
errorCodes64 = [
|
|
157585
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,
|
|
157586
157836
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
157587
157837
|
];
|
|
157588
157838
|
registerCodeFix({
|
|
157589
|
-
errorCodes:
|
|
157839
|
+
errorCodes: errorCodes64,
|
|
157590
157840
|
fixIds: [fixId51],
|
|
157591
157841
|
getCodeActions(context) {
|
|
157592
157842
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
@@ -157595,7 +157845,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157595
157845
|
}
|
|
157596
157846
|
},
|
|
157597
157847
|
getAllCodeActions(context) {
|
|
157598
|
-
return codeFixAll(context,
|
|
157848
|
+
return codeFixAll(context, errorCodes64, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
157599
157849
|
}
|
|
157600
157850
|
});
|
|
157601
157851
|
}
|
|
@@ -157679,6 +157929,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
157679
157929
|
init_returnValueCorrect();
|
|
157680
157930
|
init_fixAddMissingMember();
|
|
157681
157931
|
init_fixAddMissingNewOperator();
|
|
157932
|
+
init_fixAddMissingParam();
|
|
157682
157933
|
init_fixCannotFindModule();
|
|
157683
157934
|
init_fixClassDoesntImplementInheritedAbstractMember();
|
|
157684
157935
|
init_fixClassSuperMustPrecedeThisAccess();
|
|
@@ -159403,7 +159654,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159403
159654
|
const { name, source, data } = entryId;
|
|
159404
159655
|
const { previousToken, contextToken } = getRelevantTokens(position, sourceFile);
|
|
159405
159656
|
if (isInString(sourceFile, position, previousToken)) {
|
|
159406
|
-
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);
|
|
159407
159658
|
}
|
|
159408
159659
|
const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
|
|
159409
159660
|
switch (symbolCompletion.type) {
|
|
@@ -159625,7 +159876,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159625
159876
|
symbol,
|
|
159626
159877
|
enclosingDeclaration,
|
|
159627
159878
|
/*meaning*/
|
|
159628
|
-
|
|
159879
|
+
-1 /* All */,
|
|
159629
159880
|
/*useOnlyExternalAliasing*/
|
|
159630
159881
|
false
|
|
159631
159882
|
);
|
|
@@ -161637,7 +161888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161637
161888
|
if (isInString(sourceFile, position, contextToken)) {
|
|
161638
161889
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
161639
161890
|
return void 0;
|
|
161640
|
-
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program
|
|
161891
|
+
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences);
|
|
161641
161892
|
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
161642
161893
|
}
|
|
161643
161894
|
}
|
|
@@ -161707,11 +161958,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161707
161958
|
return Debug.assertNever(completion);
|
|
161708
161959
|
}
|
|
161709
161960
|
}
|
|
161710
|
-
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken,
|
|
161961
|
+
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, program, host, cancellationToken, preferences) {
|
|
161711
161962
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
161712
161963
|
return void 0;
|
|
161713
|
-
const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
161714
|
-
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);
|
|
161715
161966
|
}
|
|
161716
161967
|
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
|
|
161717
161968
|
switch (completion.kind) {
|
|
@@ -161769,13 +162020,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161769
162020
|
return Debug.assertNever(extension);
|
|
161770
162021
|
}
|
|
161771
162022
|
}
|
|
161772
|
-
function getStringLiteralCompletionEntries(sourceFile, node, position,
|
|
162023
|
+
function getStringLiteralCompletionEntries(sourceFile, node, position, program, host, preferences) {
|
|
162024
|
+
const typeChecker = program.getTypeChecker();
|
|
161773
162025
|
const parent2 = walkUpParentheses(node.parent);
|
|
161774
162026
|
switch (parent2.kind) {
|
|
161775
162027
|
case 201 /* LiteralType */: {
|
|
161776
162028
|
const grandParent = walkUpParentheses(parent2.parent);
|
|
161777
162029
|
if (grandParent.kind === 205 /* ImportType */) {
|
|
161778
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162030
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
161779
162031
|
}
|
|
161780
162032
|
return fromUnionableLiteralType(grandParent);
|
|
161781
162033
|
}
|
|
@@ -161801,7 +162053,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161801
162053
|
case 272 /* ImportDeclaration */:
|
|
161802
162054
|
case 278 /* ExportDeclaration */:
|
|
161803
162055
|
case 283 /* ExternalModuleReference */:
|
|
161804
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162056
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
161805
162057
|
case 296 /* CaseClause */:
|
|
161806
162058
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
161807
162059
|
const contextualTypes = fromContextualType();
|
|
@@ -161931,14 +162183,16 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161931
162183
|
const wholeSpan = text.length === 0 ? void 0 : createTextSpan(textStart, text.length);
|
|
161932
162184
|
return names.map(({ name, kind, extension }) => name.includes(directorySeparator) || name.includes(altDirectorySeparator) ? { name, kind, extension, span: wholeSpan } : { name, kind, extension, span });
|
|
161933
162185
|
}
|
|
161934
|
-
function getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
161935
|
-
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));
|
|
161936
162188
|
}
|
|
161937
|
-
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node,
|
|
162189
|
+
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences) {
|
|
161938
162190
|
const literalValue = normalizeSlashes(node.text);
|
|
161939
|
-
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
162191
|
+
const mode = isStringLiteralLike(node) ? program.getModeForUsageLocation(sourceFile, node) : void 0;
|
|
161940
162192
|
const scriptPath = sourceFile.path;
|
|
161941
162193
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
162194
|
+
const compilerOptions = program.getCompilerOptions();
|
|
162195
|
+
const typeChecker = program.getTypeChecker();
|
|
161942
162196
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
161943
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);
|
|
161944
162198
|
}
|
|
@@ -163580,7 +163834,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
163580
163834
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
163581
163835
|
if (isModuleSpecifierLike(node)) {
|
|
163582
163836
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
163583
|
-
const referencedFileName = (_b = (_a = program.
|
|
163837
|
+
const referencedFileName = (_b = (_a = program.getResolvedModuleFromModuleSpecifier(node)) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
163584
163838
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
163585
163839
|
if (referencedFile) {
|
|
163586
163840
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -165112,7 +165366,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165112
165366
|
}
|
|
165113
165367
|
}
|
|
165114
165368
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
165115
|
-
const ref = (_a = program.
|
|
165369
|
+
const ref = (_a = program.getResolvedModuleFromModuleSpecifier(fallbackNode)) == null ? void 0 : _a.resolvedModule;
|
|
165116
165370
|
if (ref) {
|
|
165117
165371
|
return [{
|
|
165118
165372
|
name: fallbackNode.text,
|
|
@@ -165227,7 +165481,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165227
165481
|
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
165228
165482
|
const node = getTouchingToken(sourceFile, position);
|
|
165229
165483
|
let resolution;
|
|
165230
|
-
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.
|
|
165484
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModuleFromModuleSpecifier(node))) {
|
|
165231
165485
|
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
165232
165486
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
165233
165487
|
return {
|
|
@@ -174639,11 +174893,18 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
174639
174893
|
ModuleKind3["ES6"] = "ES6";
|
|
174640
174894
|
ModuleKind3["ES2015"] = "ES2015";
|
|
174641
174895
|
ModuleKind3["ESNext"] = "ESNext";
|
|
174896
|
+
ModuleKind3["Node16"] = "Node16";
|
|
174897
|
+
ModuleKind3["NodeNext"] = "NodeNext";
|
|
174898
|
+
ModuleKind3["Preserve"] = "Preserve";
|
|
174642
174899
|
return ModuleKind3;
|
|
174643
174900
|
})(ModuleKind2 || {});
|
|
174644
174901
|
ModuleResolutionKind2 = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
174645
174902
|
ModuleResolutionKind3["Classic"] = "Classic";
|
|
174646
174903
|
ModuleResolutionKind3["Node"] = "Node";
|
|
174904
|
+
ModuleResolutionKind3["Node10"] = "Node10";
|
|
174905
|
+
ModuleResolutionKind3["Node16"] = "Node16";
|
|
174906
|
+
ModuleResolutionKind3["NodeNext"] = "NodeNext";
|
|
174907
|
+
ModuleResolutionKind3["Bundler"] = "Bundler";
|
|
174647
174908
|
return ModuleResolutionKind3;
|
|
174648
174909
|
})(ModuleResolutionKind2 || {});
|
|
174649
174910
|
NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
@@ -186645,6 +186906,7 @@ ${e.message}`;
|
|
|
186645
186906
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
186646
186907
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
186647
186908
|
getStringComparer: () => getStringComparer,
|
|
186909
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
186648
186910
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
186649
186911
|
getSuperContainer: () => getSuperContainer,
|
|
186650
186912
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -187731,7 +187993,6 @@ ${e.message}`;
|
|
|
187731
187993
|
setValueDeclaration: () => setValueDeclaration,
|
|
187732
187994
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
187733
187995
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
187734
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
187735
187996
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
187736
187997
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
187737
187998
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -187894,7 +188155,6 @@ ${e.message}`;
|
|
|
187894
188155
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
187895
188156
|
typeKeywords: () => typeKeywords,
|
|
187896
188157
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
187897
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
187898
188158
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
187899
188159
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
187900
188160
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -189067,6 +189327,7 @@ ${e.message}`;
|
|
|
189067
189327
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
189068
189328
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
189069
189329
|
getStringComparer: () => getStringComparer,
|
|
189330
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
189070
189331
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
189071
189332
|
getSuperContainer: () => getSuperContainer,
|
|
189072
189333
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -190153,7 +190414,6 @@ ${e.message}`;
|
|
|
190153
190414
|
setValueDeclaration: () => setValueDeclaration,
|
|
190154
190415
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
190155
190416
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
190156
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
190157
190417
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
190158
190418
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
190159
190419
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -190316,7 +190576,6 @@ ${e.message}`;
|
|
|
190316
190576
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
190317
190577
|
typeKeywords: () => typeKeywords,
|
|
190318
190578
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
190319
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
190320
190579
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
190321
190580
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
190322
190581
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|