@typescript-deploys/pr-build 5.4.0-pr-57008-39 → 5.4.0-pr-57114-8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cancellationToken.js +0 -1
- package/lib/lib.es5.d.ts +1 -0
- package/lib/tsc.js +190 -172
- package/lib/tsserver.js +691 -448
- package/lib/typescript.d.ts +51 -11
- package/lib/typescript.js +734 -481
- package/lib/typingsInstaller.js +23 -28
- package/package.json +28 -28
package/lib/tsserver.js
CHANGED
|
@@ -1042,6 +1042,7 @@ __export(server_exports, {
|
|
|
1042
1042
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
1043
1043
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
1044
1044
|
getStringComparer: () => getStringComparer,
|
|
1045
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
1045
1046
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
1046
1047
|
getSuperContainer: () => getSuperContainer,
|
|
1047
1048
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -2128,7 +2129,6 @@ __export(server_exports, {
|
|
|
2128
2129
|
setValueDeclaration: () => setValueDeclaration,
|
|
2129
2130
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
2130
2131
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
2131
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
2132
2132
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
2133
2133
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
2134
2134
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -2291,7 +2291,6 @@ __export(server_exports, {
|
|
|
2291
2291
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
2292
2292
|
typeKeywords: () => typeKeywords,
|
|
2293
2293
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
2294
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
2295
2294
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
2296
2295
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
2297
2296
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -2341,7 +2340,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2341
2340
|
|
|
2342
2341
|
// src/compiler/corePublic.ts
|
|
2343
2342
|
var versionMajorMinor = "5.4";
|
|
2344
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2343
|
+
var version = `${versionMajorMinor}.0-insiders.20240121`;
|
|
2345
2344
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2346
2345
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2347
2346
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6510,7 +6509,7 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags3) => {
|
|
|
6510
6509
|
SymbolFlags3[SymbolFlags3["Transient"] = 33554432] = "Transient";
|
|
6511
6510
|
SymbolFlags3[SymbolFlags3["Assignment"] = 67108864] = "Assignment";
|
|
6512
6511
|
SymbolFlags3[SymbolFlags3["ModuleExports"] = 134217728] = "ModuleExports";
|
|
6513
|
-
SymbolFlags3[SymbolFlags3["All"] =
|
|
6512
|
+
SymbolFlags3[SymbolFlags3["All"] = -1] = "All";
|
|
6514
6513
|
SymbolFlags3[SymbolFlags3["Enum"] = 384] = "Enum";
|
|
6515
6514
|
SymbolFlags3[SymbolFlags3["Variable"] = 3] = "Variable";
|
|
6516
6515
|
SymbolFlags3[SymbolFlags3["Value"] = 111551] = "Value";
|
|
@@ -6936,6 +6935,7 @@ var ModuleKind = /* @__PURE__ */ ((ModuleKind3) => {
|
|
|
6936
6935
|
ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
|
|
6937
6936
|
ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
|
|
6938
6937
|
ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
|
|
6938
|
+
ModuleKind3[ModuleKind3["Preserve"] = 200] = "Preserve";
|
|
6939
6939
|
return ModuleKind3;
|
|
6940
6940
|
})(ModuleKind || {});
|
|
6941
6941
|
var JsxEmit = /* @__PURE__ */ ((JsxEmit3) => {
|
|
@@ -7503,9 +7503,6 @@ var defaultChunkLevels = { Low: 32, Medium: 64, High: 256 };
|
|
|
7503
7503
|
var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels);
|
|
7504
7504
|
var unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels);
|
|
7505
7505
|
function setCustomPollingValues(system) {
|
|
7506
|
-
if (!system.getEnvironmentVariable) {
|
|
7507
|
-
return;
|
|
7508
|
-
}
|
|
7509
7506
|
const pollingIntervalChanged = setCustomLevels("TSC_WATCH_POLLINGINTERVAL", PollingInterval);
|
|
7510
7507
|
pollingChunkSize = getCustomPollingBasedLevels("TSC_WATCH_POLLINGCHUNKSIZE", defaultChunkLevels) || pollingChunkSize;
|
|
7511
7508
|
unchangedPollThresholds = getCustomPollingBasedLevels("TSC_WATCH_UNCHANGEDPOLLTHRESHOLDS", defaultChunkLevels) || unchangedPollThresholds;
|
|
@@ -9574,7 +9571,7 @@ var Diagnostics = {
|
|
|
9574
9571
|
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."),
|
|
9575
9572
|
_0_was_imported_here: diag(1376, 3 /* Message */, "_0_was_imported_here_1376", "'{0}' was imported here."),
|
|
9576
9573
|
_0_was_exported_here: diag(1377, 3 /* Message */, "_0_was_exported_here_1377", "'{0}' was exported here."),
|
|
9577
|
-
|
|
9574
|
+
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."),
|
|
9578
9575
|
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'."),
|
|
9579
9576
|
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'."),
|
|
9580
9577
|
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 `}`?"),
|
|
@@ -9625,7 +9622,7 @@ var Diagnostics = {
|
|
|
9625
9622
|
File_redirects_to_file_0: diag(1429, 3 /* Message */, "File_redirects_to_file_0_1429", "File redirects to file '{0}'"),
|
|
9626
9623
|
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:"),
|
|
9627
9624
|
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."),
|
|
9628
|
-
|
|
9625
|
+
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."),
|
|
9629
9626
|
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."),
|
|
9630
9627
|
Unexpected_keyword_or_identifier: diag(1434, 1 /* Error */, "Unexpected_keyword_or_identifier_1434", "Unexpected keyword or identifier."),
|
|
9631
9628
|
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}'?"),
|
|
@@ -10208,9 +10205,9 @@ var Diagnostics = {
|
|
|
10208
10205
|
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."),
|
|
10209
10206
|
Namespace_name_cannot_be_0: diag(2819, 1 /* Error */, "Namespace_name_cannot_be_0_2819", "Namespace name cannot be '{0}'."),
|
|
10210
10207
|
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}'?"),
|
|
10211
|
-
|
|
10208
|
+
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'."),
|
|
10212
10209
|
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."),
|
|
10213
|
-
|
|
10210
|
+
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'."),
|
|
10214
10211
|
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}'?"),
|
|
10215
10212
|
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."),
|
|
10216
10213
|
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}'?"),
|
|
@@ -10230,7 +10227,7 @@ var Diagnostics = {
|
|
|
10230
10227
|
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'."),
|
|
10231
10228
|
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."),
|
|
10232
10229
|
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."),
|
|
10233
|
-
|
|
10230
|
+
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."),
|
|
10234
10231
|
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."),
|
|
10235
10232
|
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."),
|
|
10236
10233
|
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."),
|
|
@@ -10386,7 +10383,7 @@ var Diagnostics = {
|
|
|
10386
10383
|
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."),
|
|
10387
10384
|
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}'."),
|
|
10388
10385
|
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'."),
|
|
10389
|
-
|
|
10386
|
+
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'."),
|
|
10390
10387
|
Unknown_build_option_0: diag(5072, 1 /* Error */, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
|
|
10391
10388
|
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}."),
|
|
10392
10389
|
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."),
|
|
@@ -10409,7 +10406,7 @@ var Diagnostics = {
|
|
|
10409
10406
|
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."),
|
|
10410
10407
|
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'."),
|
|
10411
10408
|
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'."),
|
|
10412
|
-
|
|
10409
|
+
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."),
|
|
10413
10410
|
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."),
|
|
10414
10411
|
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."),
|
|
10415
10412
|
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'."),
|
|
@@ -11329,6 +11326,12 @@ var Diagnostics = {
|
|
|
11329
11326
|
Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
|
|
11330
11327
|
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."),
|
|
11331
11328
|
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}'."),
|
|
11329
|
+
Add_missing_parameter_to_0: diag(95188, 3 /* Message */, "Add_missing_parameter_to_0_95188", "Add missing parameter to '{0}'"),
|
|
11330
|
+
Add_missing_parameters_to_0: diag(95189, 3 /* Message */, "Add_missing_parameters_to_0_95189", "Add missing parameters to '{0}'"),
|
|
11331
|
+
Add_all_missing_parameters: diag(95190, 3 /* Message */, "Add_all_missing_parameters_95190", "Add all missing parameters"),
|
|
11332
|
+
Add_optional_parameter_to_0: diag(95191, 3 /* Message */, "Add_optional_parameter_to_0_95191", "Add optional parameter to '{0}'"),
|
|
11333
|
+
Add_optional_parameters_to_0: diag(95192, 3 /* Message */, "Add_optional_parameters_to_0_95192", "Add optional parameters to '{0}'"),
|
|
11334
|
+
Add_all_optional_parameters: diag(95193, 3 /* Message */, "Add_all_optional_parameters_95193", "Add all optional parameters"),
|
|
11332
11335
|
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."),
|
|
11333
11336
|
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'."),
|
|
11334
11337
|
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?"),
|
|
@@ -15354,14 +15357,12 @@ function packageIdToString(packageId) {
|
|
|
15354
15357
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
15355
15358
|
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;
|
|
15356
15359
|
}
|
|
15357
|
-
function hasChangesInResolutions(names,
|
|
15360
|
+
function hasChangesInResolutions(names, newResolutions, getOldResolution, comparer) {
|
|
15358
15361
|
Debug.assert(names.length === newResolutions.length);
|
|
15359
15362
|
for (let i = 0; i < names.length; i++) {
|
|
15360
15363
|
const newResolution = newResolutions[i];
|
|
15361
15364
|
const entry = names[i];
|
|
15362
|
-
const
|
|
15363
|
-
const mode = nameAndModeGetter.getMode(entry, newSourceFile);
|
|
15364
|
-
const oldResolution = getOldResolution(name, mode);
|
|
15365
|
+
const oldResolution = getOldResolution(entry);
|
|
15365
15366
|
const changed = oldResolution ? !newResolution || !comparer(oldResolution, newResolution) : newResolution;
|
|
15366
15367
|
if (changed) {
|
|
15367
15368
|
return true;
|
|
@@ -20628,6 +20629,9 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
20628
20629
|
case 199 /* NodeNext */:
|
|
20629
20630
|
moduleResolution = 99 /* NodeNext */;
|
|
20630
20631
|
break;
|
|
20632
|
+
case 200 /* Preserve */:
|
|
20633
|
+
moduleResolution = 100 /* Bundler */;
|
|
20634
|
+
break;
|
|
20631
20635
|
default:
|
|
20632
20636
|
moduleResolution = 1 /* Classic */;
|
|
20633
20637
|
break;
|
|
@@ -20657,6 +20661,7 @@ var computedOptions = createComputedCompilerOptions({
|
|
|
20657
20661
|
switch (computedOptions.module.computeValue(compilerOptions)) {
|
|
20658
20662
|
case 100 /* Node16 */:
|
|
20659
20663
|
case 199 /* NodeNext */:
|
|
20664
|
+
case 200 /* Preserve */:
|
|
20660
20665
|
return true;
|
|
20661
20666
|
}
|
|
20662
20667
|
return false;
|
|
@@ -20824,18 +20829,12 @@ function emitModuleKindIsNonNodeESM(moduleKind) {
|
|
|
20824
20829
|
}
|
|
20825
20830
|
function hasJsonModuleEmitEnabled(options) {
|
|
20826
20831
|
switch (getEmitModuleKind(options)) {
|
|
20827
|
-
case
|
|
20828
|
-
case
|
|
20829
|
-
case
|
|
20830
|
-
case 6 /* ES2020 */:
|
|
20831
|
-
case 7 /* ES2022 */:
|
|
20832
|
-
case 99 /* ESNext */:
|
|
20833
|
-
case 100 /* Node16 */:
|
|
20834
|
-
case 199 /* NodeNext */:
|
|
20835
|
-
return true;
|
|
20836
|
-
default:
|
|
20832
|
+
case 0 /* None */:
|
|
20833
|
+
case 4 /* System */:
|
|
20834
|
+
case 3 /* UMD */:
|
|
20837
20835
|
return false;
|
|
20838
20836
|
}
|
|
20837
|
+
return true;
|
|
20839
20838
|
}
|
|
20840
20839
|
function importNameElisionDisabled(options) {
|
|
20841
20840
|
return options.verbatimModuleSyntax || options.isolatedModules && options.preserveValueImports;
|
|
@@ -20849,9 +20848,6 @@ function unusedLabelIsError(options) {
|
|
|
20849
20848
|
function moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution) {
|
|
20850
20849
|
return moduleResolution >= 3 /* Node16 */ && moduleResolution <= 99 /* NodeNext */ || moduleResolution === 100 /* Bundler */;
|
|
20851
20850
|
}
|
|
20852
|
-
function shouldResolveJsRequire(compilerOptions) {
|
|
20853
|
-
return !!compilerOptions.noDtsResolution || getEmitModuleResolutionKind(compilerOptions) !== 100 /* Bundler */;
|
|
20854
|
-
}
|
|
20855
20851
|
function getStrictOptionValue(compilerOptions, flag) {
|
|
20856
20852
|
return compilerOptions[flag] === void 0 ? !!compilerOptions.strict : !!compilerOptions[flag];
|
|
20857
20853
|
}
|
|
@@ -21028,7 +21024,7 @@ function getPatternFromSpec(spec, basePath, usage) {
|
|
|
21028
21024
|
const pattern = spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]);
|
|
21029
21025
|
return pattern && `^(${pattern})${usage === "exclude" ? "($|/)" : "$"}`;
|
|
21030
21026
|
}
|
|
21031
|
-
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 }) {
|
|
21027
|
+
function getSubPatternFromSpec(spec, basePath, usage, { singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter: replaceWildcardCharacter2 } = wildcardMatchers[usage]) {
|
|
21032
21028
|
let subpattern = "";
|
|
21033
21029
|
let hasWrittenComponent = false;
|
|
21034
21030
|
const components = getNormalizedPathComponents(spec, basePath);
|
|
@@ -21248,7 +21244,8 @@ function usesExtensionsOnImports({ imports }, hasExtension2 = or(hasJSFileExtens
|
|
|
21248
21244
|
return firstDefined(imports, ({ text }) => pathIsRelative(text) && !fileExtensionIsOneOf(text, extensionsNotSupportingExtensionlessResolution) ? hasExtension2(text) : void 0) || false;
|
|
21249
21245
|
}
|
|
21250
21246
|
function getModuleSpecifierEndingPreference(preference, resolutionMode, compilerOptions, sourceFile) {
|
|
21251
|
-
|
|
21247
|
+
const moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
21248
|
+
if (preference === "js" || resolutionMode === 99 /* ESNext */ && 3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */) {
|
|
21252
21249
|
if (!shouldAllowImportingTsExtension(compilerOptions)) {
|
|
21253
21250
|
return 2 /* JsExtension */;
|
|
21254
21251
|
}
|
|
@@ -38868,7 +38865,8 @@ var moduleOptionDeclaration = {
|
|
|
38868
38865
|
es2022: 7 /* ES2022 */,
|
|
38869
38866
|
esnext: 99 /* ESNext */,
|
|
38870
38867
|
node16: 100 /* Node16 */,
|
|
38871
|
-
nodenext: 199 /* NodeNext
|
|
38868
|
+
nodenext: 199 /* NodeNext */,
|
|
38869
|
+
preserve: 200 /* Preserve */
|
|
38872
38870
|
})),
|
|
38873
38871
|
affectsSourceFile: true,
|
|
38874
38872
|
affectsModuleResolution: true,
|
|
@@ -42576,20 +42574,7 @@ function resolveModuleName(moduleName, containingFile, compilerOptions, host, ca
|
|
|
42576
42574
|
} else {
|
|
42577
42575
|
let moduleResolution = compilerOptions.moduleResolution;
|
|
42578
42576
|
if (moduleResolution === void 0) {
|
|
42579
|
-
|
|
42580
|
-
case 1 /* CommonJS */:
|
|
42581
|
-
moduleResolution = 2 /* Node10 */;
|
|
42582
|
-
break;
|
|
42583
|
-
case 100 /* Node16 */:
|
|
42584
|
-
moduleResolution = 3 /* Node16 */;
|
|
42585
|
-
break;
|
|
42586
|
-
case 199 /* NodeNext */:
|
|
42587
|
-
moduleResolution = 99 /* NodeNext */;
|
|
42588
|
-
break;
|
|
42589
|
-
default:
|
|
42590
|
-
moduleResolution = 1 /* Classic */;
|
|
42591
|
-
break;
|
|
42592
|
-
}
|
|
42577
|
+
moduleResolution = getEmitModuleResolutionKind(compilerOptions);
|
|
42593
42578
|
if (traceEnabled) {
|
|
42594
42579
|
trace(host, Diagnostics.Module_resolution_kind_is_not_specified_using_0, ModuleResolutionKind[moduleResolution]);
|
|
42595
42580
|
}
|
|
@@ -46466,7 +46451,7 @@ function createBinder() {
|
|
|
46466
46451
|
} else if (isJsonSourceFile(file)) {
|
|
46467
46452
|
bindSourceFileAsExternalModule();
|
|
46468
46453
|
const originalSymbol = file.symbol;
|
|
46469
|
-
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */,
|
|
46454
|
+
declareSymbol(file.symbol.exports, file.symbol, file, 4 /* Property */, -1 /* All */);
|
|
46470
46455
|
file.symbol = originalSymbol;
|
|
46471
46456
|
}
|
|
46472
46457
|
}
|
|
@@ -46478,7 +46463,7 @@ function createBinder() {
|
|
|
46478
46463
|
bindAnonymousDeclaration(node, 111551 /* Value */, getDeclarationName(node));
|
|
46479
46464
|
} else {
|
|
46480
46465
|
const flags = exportAssignmentIsAlias(node) ? 2097152 /* Alias */ : 4 /* Property */;
|
|
46481
|
-
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags,
|
|
46466
|
+
const symbol = declareSymbol(container.symbol.exports, container.symbol, node, flags, -1 /* All */);
|
|
46482
46467
|
if (node.isExportEquals) {
|
|
46483
46468
|
setValueDeclaration(symbol, node);
|
|
46484
46469
|
}
|
|
@@ -46931,7 +46916,7 @@ function createBinder() {
|
|
|
46931
46916
|
}
|
|
46932
46917
|
if (!isBindingPattern(node.name)) {
|
|
46933
46918
|
const possibleVariableDecl = node.kind === 260 /* VariableDeclaration */ ? node : node.parent.parent;
|
|
46934
|
-
if (isInJSFile(node) &&
|
|
46919
|
+
if (isInJSFile(node) && isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !getJSDocTypeTag(node) && !(getCombinedModifierFlags(node) & 32 /* Export */)) {
|
|
46935
46920
|
declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
|
|
46936
46921
|
} else if (isBlockOrCatchScoped(node)) {
|
|
46937
46922
|
bindBlockScopedDeclaration(node, 2 /* BlockScopedVariable */, 111551 /* BlockScopedVariableExcludes */);
|
|
@@ -47505,7 +47490,7 @@ function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFi
|
|
|
47505
47490
|
(reason) => {
|
|
47506
47491
|
if (reason.kind !== 3 /* Import */ || reason.file !== importingSourceFile.path)
|
|
47507
47492
|
return void 0;
|
|
47508
|
-
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index))
|
|
47493
|
+
if (importingSourceFile.impliedNodeFormat && importingSourceFile.impliedNodeFormat !== getModeForResolutionAtIndex(importingSourceFile, reason.index, compilerOptions))
|
|
47509
47494
|
return void 0;
|
|
47510
47495
|
const specifier = getModuleNameStringLiteralAt(importingSourceFile, reason.index).text;
|
|
47511
47496
|
return preferences.relativePreference !== 1 /* NonRelative */ || !pathIsRelative(specifier) ? specifier : void 0;
|
|
@@ -47998,7 +47983,7 @@ function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory,
|
|
|
47998
47983
|
return processEnding(shortest, allowedEndings, compilerOptions);
|
|
47999
47984
|
}
|
|
48000
47985
|
function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileName, canonicalSourceDirectory }, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) {
|
|
48001
|
-
if (!host.
|
|
47986
|
+
if (!host.readFile) {
|
|
48002
47987
|
return void 0;
|
|
48003
47988
|
}
|
|
48004
47989
|
const parts = getNodeModulePathParts(path);
|
|
@@ -48105,8 +48090,6 @@ function tryGetModuleNameAsNodeModule({ path, isRedirect }, { getCanonicalFileNa
|
|
|
48105
48090
|
}
|
|
48106
48091
|
}
|
|
48107
48092
|
function tryGetAnyFileFromPath(host, path) {
|
|
48108
|
-
if (!host.fileExists)
|
|
48109
|
-
return;
|
|
48110
48093
|
const extensions = flatten(getSupportedExtensions({ allowJs: true }, [{ extension: "node", isMixedContent: false }, { extension: "json", isMixedContent: false, scriptKind: 6 /* JSON */ }]));
|
|
48111
48094
|
for (const e of extensions) {
|
|
48112
48095
|
const fullPath = path + e;
|
|
@@ -48367,7 +48350,7 @@ function createTypeChecker(host) {
|
|
|
48367
48350
|
var requestedExternalEmitHelpers;
|
|
48368
48351
|
var externalHelpersModule;
|
|
48369
48352
|
var Symbol47 = objectAllocator.getSymbolConstructor();
|
|
48370
|
-
var
|
|
48353
|
+
var Type28 = objectAllocator.getTypeConstructor();
|
|
48371
48354
|
var Signature14 = objectAllocator.getSignatureConstructor();
|
|
48372
48355
|
var typeCount = 0;
|
|
48373
48356
|
var symbolCount = 0;
|
|
@@ -49098,14 +49081,6 @@ function createTypeChecker(host) {
|
|
|
49098
49081
|
emptyArray,
|
|
49099
49082
|
emptyArray
|
|
49100
49083
|
);
|
|
49101
|
-
var resolvingApparentMappedType = createAnonymousType(
|
|
49102
|
-
/*symbol*/
|
|
49103
|
-
void 0,
|
|
49104
|
-
emptySymbols,
|
|
49105
|
-
emptyArray,
|
|
49106
|
-
emptyArray,
|
|
49107
|
-
emptyArray
|
|
49108
|
-
);
|
|
49109
49084
|
var markerSuperType = createTypeParameter();
|
|
49110
49085
|
var markerSubType = createTypeParameter();
|
|
49111
49086
|
markerSubType.constraint = markerSuperType;
|
|
@@ -49513,7 +49488,7 @@ function createTypeChecker(host) {
|
|
|
49513
49488
|
symbol.links.checkFlags = checkFlags || 0 /* None */;
|
|
49514
49489
|
return symbol;
|
|
49515
49490
|
}
|
|
49516
|
-
function
|
|
49491
|
+
function createParameter2(name, type) {
|
|
49517
49492
|
const symbol = createSymbol(1 /* FunctionScopedVariable */, name);
|
|
49518
49493
|
symbol.links.type = type;
|
|
49519
49494
|
return symbol;
|
|
@@ -50761,7 +50736,7 @@ function createTypeChecker(host) {
|
|
|
50761
50736
|
return isExportAssignment(node) && !node.isExportEquals || hasSyntacticModifier(node, 2048 /* Default */) || isExportSpecifier(node) || isNamespaceExport(node);
|
|
50762
50737
|
}
|
|
50763
50738
|
function getUsageModeForExpression(usage) {
|
|
50764
|
-
return isStringLiteralLike(usage) ? getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
50739
|
+
return isStringLiteralLike(usage) ? host.getModeForUsageLocation(getSourceFileOfNode(usage), usage) : void 0;
|
|
50765
50740
|
}
|
|
50766
50741
|
function isESMFormatImportImportingCommonjsFormatFile(usageMode, targetMode) {
|
|
50767
50742
|
return usageMode === 99 /* ESNext */ && targetMode === 1 /* CommonJS */;
|
|
@@ -50772,7 +50747,7 @@ function createTypeChecker(host) {
|
|
|
50772
50747
|
}
|
|
50773
50748
|
function canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias, usage) {
|
|
50774
50749
|
const usageMode = file && getUsageModeForExpression(usage);
|
|
50775
|
-
if (file && usageMode !== void 0) {
|
|
50750
|
+
if (file && usageMode !== void 0 && 100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) {
|
|
50776
50751
|
const result = isESMFormatImportImportingCommonjsFormatFile(usageMode, file.impliedNodeFormat);
|
|
50777
50752
|
if (usageMode === 99 /* ESNext */ || result) {
|
|
50778
50753
|
return result;
|
|
@@ -51305,7 +51280,7 @@ function createTypeChecker(host) {
|
|
|
51305
51280
|
break;
|
|
51306
51281
|
}
|
|
51307
51282
|
if (target === unknownSymbol) {
|
|
51308
|
-
return
|
|
51283
|
+
return -1 /* All */;
|
|
51309
51284
|
}
|
|
51310
51285
|
if (target === symbol || (seenSymbols == null ? void 0 : seenSymbols.has(target))) {
|
|
51311
51286
|
break;
|
|
@@ -51666,8 +51641,12 @@ function createTypeChecker(host) {
|
|
|
51666
51641
|
return ambientModule;
|
|
51667
51642
|
}
|
|
51668
51643
|
const currentSourceFile = getSourceFileOfNode(location);
|
|
51669
|
-
const contextSpecifier = isStringLiteralLike(location) ? location : ((_a =
|
|
51670
|
-
|
|
51644
|
+
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(
|
|
51645
|
+
location.initializer,
|
|
51646
|
+
/*requireStringLiteralLikeArgument*/
|
|
51647
|
+
true
|
|
51648
|
+
) ? 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);
|
|
51649
|
+
const mode = contextSpecifier && isStringLiteralLike(contextSpecifier) ? host.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
51671
51650
|
const moduleResolutionKind = getEmitModuleResolutionKind(compilerOptions);
|
|
51672
51651
|
const resolvedModule = (_g = host.getResolvedModule(currentSourceFile, moduleReference, mode)) == null ? void 0 : _g.resolvedModule;
|
|
51673
51652
|
const resolutionDiagnostic = resolvedModule && getResolutionDiagnostic(compilerOptions, resolvedModule, currentSourceFile);
|
|
@@ -52291,7 +52270,7 @@ function createTypeChecker(host) {
|
|
|
52291
52270
|
}
|
|
52292
52271
|
function createType(flags) {
|
|
52293
52272
|
var _a;
|
|
52294
|
-
const result = new
|
|
52273
|
+
const result = new Type28(checker, flags);
|
|
52295
52274
|
typeCount++;
|
|
52296
52275
|
result.id = typeCount;
|
|
52297
52276
|
(_a = tracing) == null ? void 0 : _a.recordType(result);
|
|
@@ -52303,7 +52282,7 @@ function createTypeChecker(host) {
|
|
|
52303
52282
|
return result;
|
|
52304
52283
|
}
|
|
52305
52284
|
function createOriginType(flags) {
|
|
52306
|
-
return new
|
|
52285
|
+
return new Type28(checker, flags);
|
|
52307
52286
|
}
|
|
52308
52287
|
function createIntrinsicType(kind, intrinsicName, objectFlags = 0 /* None */, debugIntrinsicName) {
|
|
52309
52288
|
checkIntrinsicName(intrinsicName, debugIntrinsicName);
|
|
@@ -54821,7 +54800,7 @@ function createTypeChecker(host) {
|
|
|
54821
54800
|
}
|
|
54822
54801
|
const sym = resolveEntityName(
|
|
54823
54802
|
leftmost,
|
|
54824
|
-
|
|
54803
|
+
-1 /* All */,
|
|
54825
54804
|
/*ignoreErrors*/
|
|
54826
54805
|
true,
|
|
54827
54806
|
/*dontResolveAlias*/
|
|
@@ -54831,13 +54810,13 @@ function createTypeChecker(host) {
|
|
|
54831
54810
|
if (isSymbolAccessible(
|
|
54832
54811
|
sym,
|
|
54833
54812
|
context.enclosingDeclaration,
|
|
54834
|
-
|
|
54813
|
+
-1 /* All */,
|
|
54835
54814
|
/*shouldComputeAliasesToMakeVisible*/
|
|
54836
54815
|
false
|
|
54837
54816
|
).accessibility !== 0 /* Accessible */) {
|
|
54838
54817
|
introducesError = true;
|
|
54839
54818
|
} else {
|
|
54840
|
-
context.tracker.trackSymbol(sym, context.enclosingDeclaration,
|
|
54819
|
+
context.tracker.trackSymbol(sym, context.enclosingDeclaration, -1 /* All */);
|
|
54841
54820
|
includePrivateSymbol == null ? void 0 : includePrivateSymbol(sym);
|
|
54842
54821
|
}
|
|
54843
54822
|
if (isIdentifier(node)) {
|
|
@@ -55949,7 +55928,7 @@ function createTypeChecker(host) {
|
|
|
55949
55928
|
isLocalImport ? symbolToName(
|
|
55950
55929
|
target,
|
|
55951
55930
|
context,
|
|
55952
|
-
|
|
55931
|
+
-1 /* All */,
|
|
55953
55932
|
/*expectsIdentifier*/
|
|
55954
55933
|
false
|
|
55955
55934
|
) : factory.createExternalModuleReference(factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))
|
|
@@ -56108,7 +56087,7 @@ function createTypeChecker(host) {
|
|
|
56108
56087
|
const first2 = expr && isEntityNameExpression(expr) ? getFirstNonModuleExportsIdentifier(expr) : void 0;
|
|
56109
56088
|
const referenced = first2 && resolveEntityName(
|
|
56110
56089
|
first2,
|
|
56111
|
-
|
|
56090
|
+
-1 /* All */,
|
|
56112
56091
|
/*ignoreErrors*/
|
|
56113
56092
|
true,
|
|
56114
56093
|
/*dontResolveAlias*/
|
|
@@ -56125,7 +56104,7 @@ function createTypeChecker(host) {
|
|
|
56125
56104
|
/*modifiers*/
|
|
56126
56105
|
void 0,
|
|
56127
56106
|
isExportEquals,
|
|
56128
|
-
symbolToExpression(target, context,
|
|
56107
|
+
symbolToExpression(target, context, -1 /* All */)
|
|
56129
56108
|
));
|
|
56130
56109
|
} else {
|
|
56131
56110
|
if (first2 === expr && first2) {
|
|
@@ -56144,7 +56123,7 @@ function createTypeChecker(host) {
|
|
|
56144
56123
|
symbolToName(
|
|
56145
56124
|
target,
|
|
56146
56125
|
context,
|
|
56147
|
-
|
|
56126
|
+
-1 /* All */,
|
|
56148
56127
|
/*expectsIdentifier*/
|
|
56149
56128
|
false
|
|
56150
56129
|
)
|
|
@@ -60057,30 +60036,14 @@ function createTypeChecker(host) {
|
|
|
60057
60036
|
return !!(typeParameter.symbol && forEach(typeParameter.symbol.declarations, (decl) => isTypeParameterDeclaration(decl) && decl.default));
|
|
60058
60037
|
}
|
|
60059
60038
|
function getApparentTypeOfMappedType(type) {
|
|
60060
|
-
|
|
60061
|
-
if (type.resolvedApparentType === resolvingApparentMappedType) {
|
|
60062
|
-
return type.resolvedApparentType = type;
|
|
60063
|
-
}
|
|
60064
|
-
return type.resolvedApparentType;
|
|
60065
|
-
}
|
|
60066
|
-
type.resolvedApparentType = resolvingApparentMappedType;
|
|
60067
|
-
return type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type);
|
|
60039
|
+
return type.resolvedApparentType || (type.resolvedApparentType = getResolvedApparentTypeOfMappedType(type));
|
|
60068
60040
|
}
|
|
60069
60041
|
function getResolvedApparentTypeOfMappedType(type) {
|
|
60070
|
-
const
|
|
60071
|
-
|
|
60072
|
-
|
|
60073
|
-
let constraint;
|
|
60074
|
-
if (!type.target) {
|
|
60075
|
-
constraint = getConstraintOfTypeParameter(typeVariable);
|
|
60076
|
-
} else {
|
|
60077
|
-
const modifiersConstraint = getConstraintOfType(getModifiersTypeFromMappedType(type));
|
|
60078
|
-
if (modifiersConstraint) {
|
|
60079
|
-
constraint = getApparentType(modifiersConstraint);
|
|
60080
|
-
}
|
|
60081
|
-
}
|
|
60042
|
+
const typeVariable = getHomomorphicTypeVariable(type);
|
|
60043
|
+
if (typeVariable && !type.declaration.nameType) {
|
|
60044
|
+
const constraint = getConstraintOfTypeParameter(typeVariable);
|
|
60082
60045
|
if (constraint && everyType(constraint, isArrayOrTupleType)) {
|
|
60083
|
-
return instantiateType(
|
|
60046
|
+
return instantiateType(type, prependTypeMapping(typeVariable, constraint, type.mapper));
|
|
60084
60047
|
}
|
|
60085
60048
|
}
|
|
60086
60049
|
return type;
|
|
@@ -61404,7 +61367,7 @@ function createTypeChecker(host) {
|
|
|
61404
61367
|
if (constraint) {
|
|
61405
61368
|
constraints = append(constraints, constraint);
|
|
61406
61369
|
}
|
|
61407
|
-
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && node === parent2.type) {
|
|
61370
|
+
} else if (type.flags & 262144 /* TypeParameter */ && parent2.kind === 200 /* MappedType */ && !parent2.nameType && node === parent2.type) {
|
|
61408
61371
|
const mappedType = getTypeFromTypeNode(parent2);
|
|
61409
61372
|
if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) {
|
|
61410
61373
|
const typeParameter = getHomomorphicTypeVariable(mappedType);
|
|
@@ -64464,11 +64427,8 @@ function createTypeChecker(host) {
|
|
|
64464
64427
|
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
|
|
64465
64428
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
64466
64429
|
}
|
|
64467
|
-
if (isGenericTupleType(t)) {
|
|
64468
|
-
return instantiateMappedGenericTupleType(t, type, typeVariable, mapper);
|
|
64469
|
-
}
|
|
64470
64430
|
if (isTupleType(t)) {
|
|
64471
|
-
return instantiateMappedTupleType(t, type,
|
|
64431
|
+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
|
|
64472
64432
|
}
|
|
64473
64433
|
}
|
|
64474
64434
|
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
|
|
@@ -64485,17 +64445,18 @@ function createTypeChecker(host) {
|
|
|
64485
64445
|
function getModifiedReadonlyState(state, modifiers) {
|
|
64486
64446
|
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;
|
|
64487
64447
|
}
|
|
64488
|
-
function
|
|
64448
|
+
function instantiateMappedTupleType(tupleType, mappedType, typeVariable, mapper) {
|
|
64489
64449
|
const elementFlags = tupleType.target.elementFlags;
|
|
64490
|
-
const
|
|
64491
|
-
|
|
64492
|
-
|
|
64493
|
-
|
|
64494
|
-
|
|
64495
|
-
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
64450
|
+
const fixedLength = tupleType.target.fixedLength;
|
|
64451
|
+
const fixedMapper = fixedLength ? prependTypeMapping(typeVariable, tupleType, mapper) : mapper;
|
|
64452
|
+
const newElementTypes = map(getElementTypes(tupleType), (type, i) => {
|
|
64453
|
+
const flags = elementFlags[i];
|
|
64454
|
+
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;
|
|
64496
64455
|
});
|
|
64456
|
+
const modifiers = getMappedTypeModifiers(mappedType);
|
|
64457
|
+
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;
|
|
64497
64458
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
64498
|
-
return
|
|
64459
|
+
return contains(newElementTypes, errorType) ? errorType : createTupleType(newElementTypes, newElementFlags, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
64499
64460
|
}
|
|
64500
64461
|
function instantiateMappedArrayType(arrayType, mappedType, mapper) {
|
|
64501
64462
|
const elementType = instantiateMappedTypeTemplate(
|
|
@@ -64507,14 +64468,6 @@ function createTypeChecker(host) {
|
|
|
64507
64468
|
);
|
|
64508
64469
|
return isErrorType(elementType) ? errorType : createArrayType(elementType, getModifiedReadonlyState(isReadonlyArrayType(arrayType), getMappedTypeModifiers(mappedType)));
|
|
64509
64470
|
}
|
|
64510
|
-
function instantiateMappedTupleType(tupleType, mappedType, mapper) {
|
|
64511
|
-
const elementFlags = tupleType.target.elementFlags;
|
|
64512
|
-
const elementTypes = map(getElementTypes(tupleType), (_, i) => instantiateMappedTypeTemplate(mappedType, getStringLiteralType("" + i), !!(elementFlags[i] & 2 /* Optional */), mapper));
|
|
64513
|
-
const modifiers = getMappedTypeModifiers(mappedType);
|
|
64514
|
-
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;
|
|
64515
|
-
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, modifiers);
|
|
64516
|
-
return contains(elementTypes, errorType) ? errorType : createTupleType(elementTypes, newTupleModifiers, newReadonly, tupleType.target.labeledElementDeclarations);
|
|
64517
|
-
}
|
|
64518
64471
|
function instantiateMappedTypeTemplate(type, key, isOptional, mapper) {
|
|
64519
64472
|
const templateMapper = appendTypeMapping(mapper, getTypeParameterFromMappedType(type), key);
|
|
64520
64473
|
const propType = instantiateType(getTemplateTypeFromMappedType(type.target || type), templateMapper);
|
|
@@ -65286,7 +65239,8 @@ function createTypeChecker(host) {
|
|
|
65286
65239
|
if (isOmittedExpression(elem))
|
|
65287
65240
|
continue;
|
|
65288
65241
|
const nameType = getNumberLiteralType(i);
|
|
65289
|
-
|
|
65242
|
+
const checkNode = getEffectiveCheckNode(elem);
|
|
65243
|
+
yield { errorNode: checkNode, innerExpression: checkNode, nameType };
|
|
65290
65244
|
}
|
|
65291
65245
|
}
|
|
65292
65246
|
function elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer) {
|
|
@@ -74792,7 +74746,12 @@ function createTypeChecker(host) {
|
|
|
74792
74746
|
}
|
|
74793
74747
|
const isClassic = getEmitModuleResolutionKind(compilerOptions) === 1 /* Classic */;
|
|
74794
74748
|
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;
|
|
74795
|
-
const
|
|
74749
|
+
const jsxImportIndex = compilerOptions.importHelpers ? 1 : 0;
|
|
74750
|
+
const specifier = file == null ? void 0 : file.imports[jsxImportIndex];
|
|
74751
|
+
if (specifier) {
|
|
74752
|
+
Debug.assert(nodeIsSynthesized(specifier) && specifier.text === runtimeImportSpecifier, `Expected sourceFile.imports[${jsxImportIndex}] to be the synthesized JSX runtime import`);
|
|
74753
|
+
}
|
|
74754
|
+
const mod = resolveExternalModule(specifier || location, runtimeImportSpecifier, errorMessage, location);
|
|
74796
74755
|
const result = mod && mod !== unknownSymbol ? getMergedSymbol(resolveSymbol(mod)) : void 0;
|
|
74797
74756
|
if (links) {
|
|
74798
74757
|
links.jsxImplicitImportContainer = result || false;
|
|
@@ -75035,7 +74994,7 @@ function createTypeChecker(host) {
|
|
|
75035
74994
|
);
|
|
75036
74995
|
}
|
|
75037
74996
|
if (jsxFactorySym) {
|
|
75038
|
-
jsxFactorySym.isReferenced =
|
|
74997
|
+
jsxFactorySym.isReferenced = -1 /* All */;
|
|
75039
74998
|
if (canCollectSymbolAliasAccessabilityData && jsxFactorySym.flags & 2097152 /* Alias */ && !getTypeOnlyAliasDeclaration(jsxFactorySym)) {
|
|
75040
74999
|
markAliasSymbolAsReferenced(jsxFactorySym);
|
|
75041
75000
|
}
|
|
@@ -75875,7 +75834,7 @@ function createTypeChecker(host) {
|
|
|
75875
75834
|
return;
|
|
75876
75835
|
}
|
|
75877
75836
|
}
|
|
75878
|
-
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced =
|
|
75837
|
+
(getCheckFlags(prop) & 1 /* Instantiated */ ? getSymbolLinks(prop).target : prop).isReferenced = -1 /* All */;
|
|
75879
75838
|
}
|
|
75880
75839
|
function isSelfTypeAccess(name, parent2) {
|
|
75881
75840
|
return name.kind === 110 /* ThisKeyword */ || !!parent2 && isEntityNameExpression(name) && parent2 === getResolvedSymbol(getFirstIdentifier(name));
|
|
@@ -76438,6 +76397,10 @@ function createTypeChecker(host) {
|
|
|
76438
76397
|
return false;
|
|
76439
76398
|
}
|
|
76440
76399
|
}
|
|
76400
|
+
function getEffectiveCheckNode(argument) {
|
|
76401
|
+
argument = skipParentheses(argument);
|
|
76402
|
+
return isSatisfiesExpression(argument) ? skipParentheses(argument.expression) : argument;
|
|
76403
|
+
}
|
|
76441
76404
|
function getSignatureApplicabilityError(node, args, signature, relation, checkMode, reportErrors2, containingMessageChain) {
|
|
76442
76405
|
const errorOutputContainer = { errors: void 0, skipLogging: true };
|
|
76443
76406
|
if (isJsxOpeningLikeElement(node)) {
|
|
@@ -76473,7 +76436,8 @@ function createTypeChecker(host) {
|
|
|
76473
76436
|
checkMode
|
|
76474
76437
|
);
|
|
76475
76438
|
const checkArgType = checkMode & 4 /* SkipContextSensitive */ ? getRegularTypeOfObjectLiteral(argType) : argType;
|
|
76476
|
-
|
|
76439
|
+
const effectiveCheckArgumentNode = getEffectiveCheckNode(arg);
|
|
76440
|
+
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors2 ? effectiveCheckArgumentNode : void 0, effectiveCheckArgumentNode, headMessage, containingMessageChain, errorOutputContainer)) {
|
|
76477
76441
|
Debug.assert(!reportErrors2 || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
|
76478
76442
|
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
|
76479
76443
|
return errorOutputContainer.errors || emptyArray;
|
|
@@ -76491,7 +76455,7 @@ function createTypeChecker(host) {
|
|
|
76491
76455
|
checkMode
|
|
76492
76456
|
);
|
|
76493
76457
|
const restArgCount = args.length - argCount;
|
|
76494
|
-
const errorNode = !reportErrors2 ? void 0 : restArgCount === 0 ? node : restArgCount === 1 ? args[argCount] : setTextRangePosEnd(createSyntheticExpression(node, spreadType), args[argCount].pos, args[args.length - 1].end);
|
|
76458
|
+
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);
|
|
76495
76459
|
if (!checkTypeRelatedTo(
|
|
76496
76460
|
spreadType,
|
|
76497
76461
|
restType,
|
|
@@ -76976,8 +76940,8 @@ function createTypeChecker(host) {
|
|
|
76976
76940
|
const oldCandidateForArgumentArityError = candidateForArgumentArityError;
|
|
76977
76941
|
const oldCandidateForTypeArgumentError = candidateForTypeArgumentError;
|
|
76978
76942
|
const failedSignatureDeclarations = ((_b = (_a = failed.declaration) == null ? void 0 : _a.symbol) == null ? void 0 : _b.declarations) || emptyArray;
|
|
76979
|
-
const
|
|
76980
|
-
const implDecl =
|
|
76943
|
+
const isOverload2 = failedSignatureDeclarations.length > 1;
|
|
76944
|
+
const implDecl = isOverload2 ? find(failedSignatureDeclarations, (d) => isFunctionLikeDeclaration(d) && nodeIsPresent(d.body)) : void 0;
|
|
76981
76945
|
if (implDecl) {
|
|
76982
76946
|
const candidate = getSignatureFromDeclaration(implDecl);
|
|
76983
76947
|
const isSingleNonGenericCandidate2 = !candidate.typeParameters;
|
|
@@ -77833,7 +77797,7 @@ function createTypeChecker(host) {
|
|
|
77833
77797
|
return anyType;
|
|
77834
77798
|
}
|
|
77835
77799
|
}
|
|
77836
|
-
if (isInJSFile(node) &&
|
|
77800
|
+
if (isInJSFile(node) && isCommonJsRequire(node)) {
|
|
77837
77801
|
return resolveExternalModuleTypeByLiteral(node.arguments[0]);
|
|
77838
77802
|
}
|
|
77839
77803
|
const returnType = getReturnTypeOfSignature(signature);
|
|
@@ -78685,8 +78649,8 @@ function createTypeChecker(host) {
|
|
|
78685
78649
|
), [thisType, valueType]);
|
|
78686
78650
|
}
|
|
78687
78651
|
function createClassFieldDecoratorInitializerMutatorType(thisType, valueType) {
|
|
78688
|
-
const thisParam =
|
|
78689
|
-
const valueParam =
|
|
78652
|
+
const thisParam = createParameter2("this", thisType);
|
|
78653
|
+
const valueParam = createParameter2("value", valueType);
|
|
78690
78654
|
return createFunctionType(
|
|
78691
78655
|
/*typeParameters*/
|
|
78692
78656
|
void 0,
|
|
@@ -78699,8 +78663,8 @@ function createTypeChecker(host) {
|
|
|
78699
78663
|
);
|
|
78700
78664
|
}
|
|
78701
78665
|
function createESDecoratorCallSignature(targetType, contextType, nonOptionalReturnType) {
|
|
78702
|
-
const targetParam =
|
|
78703
|
-
const contextParam =
|
|
78666
|
+
const targetParam = createParameter2("target", targetType);
|
|
78667
|
+
const contextParam = createParameter2("context", contextType);
|
|
78704
78668
|
const returnType = getUnionType([nonOptionalReturnType, voidType]);
|
|
78705
78669
|
return createCallSignature(
|
|
78706
78670
|
/*typeParameters*/
|
|
@@ -78765,7 +78729,7 @@ function createTypeChecker(host) {
|
|
|
78765
78729
|
case 231 /* ClassExpression */: {
|
|
78766
78730
|
const node = parent2;
|
|
78767
78731
|
const targetType = getTypeOfSymbol(getSymbolOfDeclaration(node));
|
|
78768
|
-
const targetParam =
|
|
78732
|
+
const targetParam = createParameter2("target", targetType);
|
|
78769
78733
|
links.decoratorSignature = createCallSignature(
|
|
78770
78734
|
/*typeParameters*/
|
|
78771
78735
|
void 0,
|
|
@@ -78789,9 +78753,9 @@ function createTypeChecker(host) {
|
|
|
78789
78753
|
const targetType = isConstructorDeclaration(node.parent) ? getTypeOfSymbol(getSymbolOfDeclaration(node.parent.parent)) : getParentTypeOfClassElement(node.parent);
|
|
78790
78754
|
const keyType = isConstructorDeclaration(node.parent) ? undefinedType : getClassElementPropertyKeyType(node.parent);
|
|
78791
78755
|
const indexType = getNumberLiteralType(index);
|
|
78792
|
-
const targetParam =
|
|
78793
|
-
const keyParam =
|
|
78794
|
-
const indexParam =
|
|
78756
|
+
const targetParam = createParameter2("target", targetType);
|
|
78757
|
+
const keyParam = createParameter2("propertyKey", keyType);
|
|
78758
|
+
const indexParam = createParameter2("parameterIndex", indexType);
|
|
78795
78759
|
links.decoratorSignature = createCallSignature(
|
|
78796
78760
|
/*typeParameters*/
|
|
78797
78761
|
void 0,
|
|
@@ -78810,14 +78774,14 @@ function createTypeChecker(host) {
|
|
|
78810
78774
|
if (!isClassLike(node.parent))
|
|
78811
78775
|
break;
|
|
78812
78776
|
const targetType = getParentTypeOfClassElement(node);
|
|
78813
|
-
const targetParam =
|
|
78777
|
+
const targetParam = createParameter2("target", targetType);
|
|
78814
78778
|
const keyType = getClassElementPropertyKeyType(node);
|
|
78815
|
-
const keyParam =
|
|
78779
|
+
const keyParam = createParameter2("propertyKey", keyType);
|
|
78816
78780
|
const returnType = isPropertyDeclaration(node) ? voidType : createTypedPropertyDescriptorType(getTypeOfNode(node));
|
|
78817
78781
|
const hasPropDesc = languageVersion !== 0 /* ES3 */ && (!isPropertyDeclaration(parent2) || hasAccessorModifier(parent2));
|
|
78818
78782
|
if (hasPropDesc) {
|
|
78819
78783
|
const descriptorType = createTypedPropertyDescriptorType(getTypeOfNode(node));
|
|
78820
|
-
const descriptorParam =
|
|
78784
|
+
const descriptorParam = createParameter2("descriptor", descriptorType);
|
|
78821
78785
|
links.decoratorSignature = createCallSignature(
|
|
78822
78786
|
/*typeParameters*/
|
|
78823
78787
|
void 0,
|
|
@@ -79313,17 +79277,18 @@ function createTypeChecker(host) {
|
|
|
79313
79277
|
const exprType = checkExpression(node.body);
|
|
79314
79278
|
const returnOrPromisedType = returnType && unwrapReturnType(returnType, functionFlags);
|
|
79315
79279
|
if (returnOrPromisedType) {
|
|
79280
|
+
const effectiveCheckNode = getEffectiveCheckNode(node.body);
|
|
79316
79281
|
if ((functionFlags & 3 /* AsyncGenerator */) === 2 /* Async */) {
|
|
79317
79282
|
const awaitedType = checkAwaitedType(
|
|
79318
79283
|
exprType,
|
|
79319
79284
|
/*withAlias*/
|
|
79320
79285
|
false,
|
|
79321
|
-
|
|
79286
|
+
effectiveCheckNode,
|
|
79322
79287
|
Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member
|
|
79323
79288
|
);
|
|
79324
|
-
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType,
|
|
79289
|
+
checkTypeAssignableToAndOptionallyElaborate(awaitedType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
79325
79290
|
} else {
|
|
79326
|
-
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType,
|
|
79291
|
+
checkTypeAssignableToAndOptionallyElaborate(exprType, returnOrPromisedType, effectiveCheckNode, effectiveCheckNode);
|
|
79327
79292
|
}
|
|
79328
79293
|
}
|
|
79329
79294
|
}
|
|
@@ -79485,13 +79450,14 @@ function createTypeChecker(host) {
|
|
|
79485
79450
|
}
|
|
79486
79451
|
case 7 /* ES2022 */:
|
|
79487
79452
|
case 99 /* ESNext */:
|
|
79453
|
+
case 200 /* Preserve */:
|
|
79488
79454
|
case 4 /* System */:
|
|
79489
79455
|
if (languageVersion >= 4 /* ES2017 */) {
|
|
79490
79456
|
break;
|
|
79491
79457
|
}
|
|
79492
79458
|
default:
|
|
79493
79459
|
span ?? (span = getSpanOfTokenAtPosition(sourceFile, node.pos));
|
|
79494
|
-
const message = isAwaitExpression(node) ? Diagnostics.
|
|
79460
|
+
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;
|
|
79495
79461
|
diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message));
|
|
79496
79462
|
hasError = true;
|
|
79497
79463
|
break;
|
|
@@ -81739,11 +81705,10 @@ function createTypeChecker(host) {
|
|
|
81739
81705
|
checkSourceElement(node.elementType);
|
|
81740
81706
|
}
|
|
81741
81707
|
function checkTupleType(node) {
|
|
81742
|
-
const elementTypes = node.elements;
|
|
81743
81708
|
let seenOptionalElement = false;
|
|
81744
81709
|
let seenRestElement = false;
|
|
81745
|
-
for (const e of
|
|
81746
|
-
|
|
81710
|
+
for (const e of node.elements) {
|
|
81711
|
+
let flags = getTupleElementFlags(e);
|
|
81747
81712
|
if (flags & 8 /* Variadic */) {
|
|
81748
81713
|
const type = getTypeFromTypeNode(e.type);
|
|
81749
81714
|
if (!isArrayLikeType(type)) {
|
|
@@ -81751,9 +81716,10 @@ function createTypeChecker(host) {
|
|
|
81751
81716
|
break;
|
|
81752
81717
|
}
|
|
81753
81718
|
if (isArrayType(type) || isTupleType(type) && type.target.combinedFlags & 4 /* Rest */) {
|
|
81754
|
-
|
|
81719
|
+
flags |= 4 /* Rest */;
|
|
81755
81720
|
}
|
|
81756
|
-
}
|
|
81721
|
+
}
|
|
81722
|
+
if (flags & 4 /* Rest */) {
|
|
81757
81723
|
if (seenRestElement) {
|
|
81758
81724
|
grammarErrorOnNode(e, Diagnostics.A_rest_element_cannot_follow_another_rest_element);
|
|
81759
81725
|
break;
|
|
@@ -81765,7 +81731,7 @@ function createTypeChecker(host) {
|
|
|
81765
81731
|
break;
|
|
81766
81732
|
}
|
|
81767
81733
|
seenOptionalElement = true;
|
|
81768
|
-
} else if (seenOptionalElement) {
|
|
81734
|
+
} else if (flags & 1 /* Required */ && seenOptionalElement) {
|
|
81769
81735
|
grammarErrorOnNode(e, Diagnostics.A_required_element_cannot_follow_an_optional_element);
|
|
81770
81736
|
break;
|
|
81771
81737
|
}
|
|
@@ -82518,7 +82484,7 @@ function createTypeChecker(host) {
|
|
|
82518
82484
|
);
|
|
82519
82485
|
}
|
|
82520
82486
|
function createSetterFunctionType(type) {
|
|
82521
|
-
const valueParam =
|
|
82487
|
+
const valueParam = createParameter2("value", type);
|
|
82522
82488
|
return createFunctionType(
|
|
82523
82489
|
/*typeParameters*/
|
|
82524
82490
|
void 0,
|
|
@@ -83561,7 +83527,7 @@ function createTypeChecker(host) {
|
|
|
83561
83527
|
}
|
|
83562
83528
|
}
|
|
83563
83529
|
function helper(condExpr2, body2) {
|
|
83564
|
-
const location = isLogicalOrCoalescingBinaryExpression(condExpr2) ? skipParentheses(condExpr2.right) : condExpr2;
|
|
83530
|
+
const location = isLogicalOrCoalescingBinaryExpression(condExpr2) ? skipParentheses(condExpr2.right) : isPrefixUnaryExpression(condExpr2) ? condExpr2.operand : condExpr2;
|
|
83565
83531
|
if (isModuleExportsAccessExpression(location)) {
|
|
83566
83532
|
return;
|
|
83567
83533
|
}
|
|
@@ -83573,7 +83539,8 @@ function createTypeChecker(host) {
|
|
|
83573
83539
|
const isPropertyExpressionCast = isPropertyAccessExpression(location) && isTypeAssertion(location.expression);
|
|
83574
83540
|
if (!hasTypeFacts(type, 4194304 /* Truthy */) || isPropertyExpressionCast)
|
|
83575
83541
|
return;
|
|
83576
|
-
const
|
|
83542
|
+
const testedType = isPrefixUnaryExpression(condExpr2) ? checkExpression(location) : type;
|
|
83543
|
+
const callSignatures = getSignaturesOfType(testedType, 0 /* Call */);
|
|
83577
83544
|
const isPromise = !!getAwaitedTypeOfPromise(type);
|
|
83578
83545
|
if (callSignatures.length === 0 && !isPromise) {
|
|
83579
83546
|
return;
|
|
@@ -86006,8 +85973,8 @@ function createTypeChecker(host) {
|
|
|
86006
85973
|
return;
|
|
86007
85974
|
}
|
|
86008
85975
|
const mode = moduleKind === 199 /* NodeNext */ && declaration.moduleSpecifier && getUsageModeForExpression(declaration.moduleSpecifier);
|
|
86009
|
-
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */) {
|
|
86010
|
-
const message = isImportAttributes2 ? moduleKind === 199 /* NodeNext */ ? Diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls : Diagnostics.
|
|
85976
|
+
if (mode !== 99 /* ESNext */ && moduleKind !== 99 /* ESNext */ && moduleKind !== 200 /* Preserve */) {
|
|
85977
|
+
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;
|
|
86011
85978
|
return grammarErrorOnNode(node, message);
|
|
86012
85979
|
}
|
|
86013
85980
|
if (isImportDeclaration(declaration) ? (_a = declaration.importClause) == null ? void 0 : _a.isTypeOnly : declaration.isTypeOnly) {
|
|
@@ -86079,7 +86046,7 @@ function createTypeChecker(host) {
|
|
|
86079
86046
|
grammarErrorOnNode(node, Diagnostics.An_import_alias_cannot_use_import_type);
|
|
86080
86047
|
}
|
|
86081
86048
|
} else {
|
|
86082
|
-
if (moduleKind >= 5 /* ES2015 */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
86049
|
+
if (moduleKind >= 5 /* ES2015 */ && moduleKind !== 200 /* Preserve */ && getSourceFileOfNode(node).impliedNodeFormat === void 0 && !node.isTypeOnly && !(node.flags & 33554432 /* Ambient */)) {
|
|
86083
86050
|
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);
|
|
86084
86051
|
}
|
|
86085
86052
|
}
|
|
@@ -86240,7 +86207,7 @@ function createTypeChecker(host) {
|
|
|
86240
86207
|
const id = node.expression;
|
|
86241
86208
|
const sym = getExportSymbolOfValueSymbolIfExported(resolveEntityName(
|
|
86242
86209
|
id,
|
|
86243
|
-
|
|
86210
|
+
-1 /* All */,
|
|
86244
86211
|
/*ignoreErrors*/
|
|
86245
86212
|
true,
|
|
86246
86213
|
/*dontResolveAlias*/
|
|
@@ -86314,7 +86281,7 @@ function createTypeChecker(host) {
|
|
|
86314
86281
|
grammarErrorOnNode(node.expression, Diagnostics.The_expression_of_an_export_assignment_must_be_an_identifier_or_qualified_name_in_an_ambient_context);
|
|
86315
86282
|
}
|
|
86316
86283
|
if (node.isExportEquals) {
|
|
86317
|
-
if (moduleKind >= 5 /* ES2015 */ && (node.flags & 33554432 /* Ambient */ && getSourceFileOfNode(node).impliedNodeFormat === 99 /* ESNext */ || !(node.flags & 33554432 /* Ambient */) && getSourceFileOfNode(node).impliedNodeFormat !== 1 /* CommonJS */)) {
|
|
86284
|
+
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 */)) {
|
|
86318
86285
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
|
86319
86286
|
} else if (moduleKind === 4 /* System */ && !(node.flags & 33554432 /* Ambient */)) {
|
|
86320
86287
|
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
|
@@ -87306,7 +87273,7 @@ function createTypeChecker(host) {
|
|
|
87306
87273
|
return void 0;
|
|
87307
87274
|
case 11 /* StringLiteral */:
|
|
87308
87275
|
case 15 /* NoSubstitutionTemplateLiteral */:
|
|
87309
|
-
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) &&
|
|
87276
|
+
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(
|
|
87310
87277
|
node.parent,
|
|
87311
87278
|
/*requireStringLiteralLikeArgument*/
|
|
87312
87279
|
false
|
|
@@ -89368,7 +89335,7 @@ function createTypeChecker(host) {
|
|
|
89368
89335
|
}
|
|
89369
89336
|
default:
|
|
89370
89337
|
diagnostics.add(
|
|
89371
|
-
createDiagnosticForNode(forInOrOfStatement.awaitModifier, Diagnostics.
|
|
89338
|
+
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)
|
|
89372
89339
|
);
|
|
89373
89340
|
break;
|
|
89374
89341
|
}
|
|
@@ -112884,7 +112851,7 @@ function transformECMAScriptModule(context) {
|
|
|
112884
112851
|
setTextRange(factory2.createNodeArray(insertStatementsAfterCustomPrologue(result.statements.slice(), importRequireStatements)), result.statements)
|
|
112885
112852
|
);
|
|
112886
112853
|
}
|
|
112887
|
-
if (!isExternalModule(node) || some(result.statements, isExternalModuleIndicator)) {
|
|
112854
|
+
if (!isExternalModule(node) || getEmitModuleKind(compilerOptions) === 200 /* Preserve */ || some(result.statements, isExternalModuleIndicator)) {
|
|
112888
112855
|
return result;
|
|
112889
112856
|
}
|
|
112890
112857
|
return factory2.updateSourceFile(
|
|
@@ -112927,6 +112894,14 @@ function transformECMAScriptModule(context) {
|
|
|
112927
112894
|
if (moduleName) {
|
|
112928
112895
|
args.push(moduleName);
|
|
112929
112896
|
}
|
|
112897
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
112898
|
+
return factory2.createCallExpression(
|
|
112899
|
+
factory2.createIdentifier("require"),
|
|
112900
|
+
/*typeArguments*/
|
|
112901
|
+
void 0,
|
|
112902
|
+
args
|
|
112903
|
+
);
|
|
112904
|
+
}
|
|
112930
112905
|
if (!importRequireStatements) {
|
|
112931
112906
|
const createRequireName = factory2.createUniqueName("_createRequire", 16 /* Optimistic */ | 32 /* FileLevel */);
|
|
112932
112907
|
const importStatement = factory2.createImportDeclaration(
|
|
@@ -113041,7 +113016,25 @@ function transformECMAScriptModule(context) {
|
|
|
113041
113016
|
return statements;
|
|
113042
113017
|
}
|
|
113043
113018
|
function visitExportAssignment(node) {
|
|
113044
|
-
|
|
113019
|
+
if (node.isExportEquals) {
|
|
113020
|
+
if (getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
113021
|
+
const statement = setOriginalNode(
|
|
113022
|
+
factory2.createExpressionStatement(
|
|
113023
|
+
factory2.createAssignment(
|
|
113024
|
+
factory2.createPropertyAccessExpression(
|
|
113025
|
+
factory2.createIdentifier("module"),
|
|
113026
|
+
"exports"
|
|
113027
|
+
),
|
|
113028
|
+
node.expression
|
|
113029
|
+
)
|
|
113030
|
+
),
|
|
113031
|
+
node
|
|
113032
|
+
);
|
|
113033
|
+
return statement;
|
|
113034
|
+
}
|
|
113035
|
+
return void 0;
|
|
113036
|
+
}
|
|
113037
|
+
return node;
|
|
113045
113038
|
}
|
|
113046
113039
|
function visitExportDeclaration(node) {
|
|
113047
113040
|
if (compilerOptions.module !== void 0 && compilerOptions.module > 5 /* ES2015 */) {
|
|
@@ -113502,7 +113495,7 @@ function transformDeclarations(context) {
|
|
|
113502
113495
|
}
|
|
113503
113496
|
}
|
|
113504
113497
|
function trackReferencedAmbientModule(node, symbol) {
|
|
113505
|
-
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol,
|
|
113498
|
+
const directives = resolver.getTypeReferenceDirectivesForSymbol(symbol, -1 /* All */);
|
|
113506
113499
|
if (length(directives)) {
|
|
113507
113500
|
return recordTypeReferenceDirectivesIfNecessary(directives);
|
|
113508
113501
|
}
|
|
@@ -115168,6 +115161,7 @@ function getModuleTransformer(moduleKind) {
|
|
|
115168
115161
|
case 7 /* ES2022 */:
|
|
115169
115162
|
case 6 /* ES2020 */:
|
|
115170
115163
|
case 5 /* ES2015 */:
|
|
115164
|
+
case 200 /* Preserve */:
|
|
115171
115165
|
return transformECMAScriptModule;
|
|
115172
115166
|
case 4 /* System */:
|
|
115173
115167
|
return transformSystemModule;
|
|
@@ -121991,8 +121985,8 @@ function flattenDiagnosticMessageText(diag2, newLine, indent3 = 0) {
|
|
|
121991
121985
|
function getModeForFileReference(ref, containingFileMode) {
|
|
121992
121986
|
return (isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode;
|
|
121993
121987
|
}
|
|
121994
|
-
function getModeForResolutionAtIndex(file, index) {
|
|
121995
|
-
return
|
|
121988
|
+
function getModeForResolutionAtIndex(file, index, compilerOptions) {
|
|
121989
|
+
return getModeForUsageLocationWorker(file, getModuleNameStringLiteralAt(file, index), compilerOptions);
|
|
121996
121990
|
}
|
|
121997
121991
|
function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
121998
121992
|
var _a;
|
|
@@ -122004,7 +121998,10 @@ function isExclusivelyTypeOnlyImportOrExport(decl) {
|
|
|
122004
121998
|
}
|
|
122005
121999
|
return false;
|
|
122006
122000
|
}
|
|
122007
|
-
function getModeForUsageLocation(file, usage) {
|
|
122001
|
+
function getModeForUsageLocation(file, usage, compilerOptions) {
|
|
122002
|
+
return getModeForUsageLocationWorker(file, usage, compilerOptions);
|
|
122003
|
+
}
|
|
122004
|
+
function getModeForUsageLocationWorker(file, usage, compilerOptions) {
|
|
122008
122005
|
var _a;
|
|
122009
122006
|
if (isImportDeclaration(usage.parent) || isExportDeclaration(usage.parent)) {
|
|
122010
122007
|
const isTypeOnly = isExclusivelyTypeOnlyImportOrExport(usage.parent);
|
|
@@ -122021,6 +122018,13 @@ function getModeForUsageLocation(file, usage) {
|
|
|
122021
122018
|
return override;
|
|
122022
122019
|
}
|
|
122023
122020
|
}
|
|
122021
|
+
if (compilerOptions && getEmitModuleKind(compilerOptions) === 200 /* Preserve */) {
|
|
122022
|
+
return usage.parent.parent && isImportEqualsDeclaration(usage.parent.parent) || isRequireCall(
|
|
122023
|
+
usage.parent,
|
|
122024
|
+
/*requireStringLiteralLikeArgument*/
|
|
122025
|
+
false
|
|
122026
|
+
) ? 1 /* CommonJS */ : 99 /* ESNext */;
|
|
122027
|
+
}
|
|
122024
122028
|
if (file.impliedNodeFormat === void 0)
|
|
122025
122029
|
return void 0;
|
|
122026
122030
|
if (file.impliedNodeFormat !== 99 /* ESNext */) {
|
|
@@ -122066,7 +122070,7 @@ function getModuleResolutionName(literal) {
|
|
|
122066
122070
|
}
|
|
122067
122071
|
var moduleResolutionNameAndModeGetter = {
|
|
122068
122072
|
getName: getModuleResolutionName,
|
|
122069
|
-
getMode: (entry, file) => getModeForUsageLocation(file, entry)
|
|
122073
|
+
getMode: (entry, file, compilerOptions) => getModeForUsageLocation(file, entry, compilerOptions)
|
|
122070
122074
|
};
|
|
122071
122075
|
function createModuleResolutionLoader(containingFile, redirectedReference, options, host, cache) {
|
|
122072
122076
|
return {
|
|
@@ -122111,7 +122115,7 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
|
122111
122115
|
const loader = createLoader(containingFile, redirectedReference, options, host, resolutionCache);
|
|
122112
122116
|
for (const entry of entries) {
|
|
122113
122117
|
const name = loader.nameAndMode.getName(entry);
|
|
122114
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
122118
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
122115
122119
|
const key = createModeAwareCacheKey(name, mode);
|
|
122116
122120
|
let result = cache.get(key);
|
|
122117
122121
|
if (!result) {
|
|
@@ -122197,7 +122201,7 @@ function getReferencedFileLocation(program, ref) {
|
|
|
122197
122201
|
switch (kind) {
|
|
122198
122202
|
case 3 /* Import */:
|
|
122199
122203
|
const importLiteral = getModuleNameStringLiteralAt(file, index);
|
|
122200
|
-
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text,
|
|
122204
|
+
packageId = (_b = (_a = program.getResolvedModule(file, importLiteral.text, program.getModeForUsageLocation(file, importLiteral))) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.packageId;
|
|
122201
122205
|
if (importLiteral.pos === -1)
|
|
122202
122206
|
return { file, packageId, text: importLiteral.text };
|
|
122203
122207
|
pos = skipTrivia(file.text, importLiteral.pos);
|
|
@@ -122730,6 +122734,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122730
122734
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
|
122731
122735
|
isSourceFileFromExternalLibrary,
|
|
122732
122736
|
isSourceFileDefaultLibrary,
|
|
122737
|
+
getModeForUsageLocation: getModeForUsageLocation2,
|
|
122738
|
+
getModeForResolutionAtIndex: getModeForResolutionAtIndex2,
|
|
122733
122739
|
getSourceFileFromReference,
|
|
122734
122740
|
getLibFileFromReference,
|
|
122735
122741
|
sourceFileToPackageName,
|
|
@@ -122739,6 +122745,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122739
122745
|
resolvedTypeReferenceDirectiveNames,
|
|
122740
122746
|
resolvedLibReferences,
|
|
122741
122747
|
getResolvedModule,
|
|
122748
|
+
getResolvedModuleFromModuleSpecifier,
|
|
122742
122749
|
getResolvedTypeReferenceDirective,
|
|
122743
122750
|
forEachResolvedModule,
|
|
122744
122751
|
forEachResolvedTypeReferenceDirective,
|
|
@@ -122789,6 +122796,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122789
122796
|
var _a2;
|
|
122790
122797
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
|
122791
122798
|
}
|
|
122799
|
+
function getResolvedModuleFromModuleSpecifier(moduleSpecifier) {
|
|
122800
|
+
const sourceFile = getSourceFileOfNode(moduleSpecifier);
|
|
122801
|
+
Debug.assertIsDefined(sourceFile, "`moduleSpecifier` must have a `SourceFile` ancestor. Use `program.getResolvedModule` instead to provide the containing file and resolution mode.");
|
|
122802
|
+
return getResolvedModule(sourceFile, moduleSpecifier.text, getModeForUsageLocation2(sourceFile, moduleSpecifier));
|
|
122803
|
+
}
|
|
122792
122804
|
function getResolvedTypeReferenceDirective(file, typeDirectiveName, mode) {
|
|
122793
122805
|
var _a2;
|
|
122794
122806
|
return (_a2 = resolvedTypeReferenceDirectiveNames == null ? void 0 : resolvedTypeReferenceDirectiveNames.get(file.path)) == null ? void 0 : _a2.get(typeDirectiveName, mode);
|
|
@@ -122961,8 +122973,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
122961
122973
|
for (let i = 0; i < moduleNames.length; i++) {
|
|
122962
122974
|
const moduleName = moduleNames[i];
|
|
122963
122975
|
if (file === oldSourceFile && !hasInvalidatedResolutions(file.path)) {
|
|
122964
|
-
const
|
|
122965
|
-
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, mode);
|
|
122976
|
+
const oldResolution = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName));
|
|
122966
122977
|
if (oldResolution == null ? void 0 : oldResolution.resolvedModule) {
|
|
122967
122978
|
if (isTraceEnabled(options, host)) {
|
|
122968
122979
|
trace(
|
|
@@ -123010,7 +123021,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123010
123021
|
return result;
|
|
123011
123022
|
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
|
|
123012
123023
|
var _a2;
|
|
123013
|
-
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text,
|
|
123024
|
+
const resolutionToFile = (_a2 = oldProgram == null ? void 0 : oldProgram.getResolvedModule(file, moduleName.text, getModeForUsageLocation2(file, moduleName))) == null ? void 0 : _a2.resolvedModule;
|
|
123014
123025
|
const resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
|
|
123015
123026
|
if (resolutionToFile && resolvedFile) {
|
|
123016
123027
|
return false;
|
|
@@ -123228,11 +123239,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123228
123239
|
(resolvedModulesProcessing ?? (resolvedModulesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, resolutions);
|
|
123229
123240
|
const resolutionsChanged = hasChangesInResolutions(
|
|
123230
123241
|
moduleNames,
|
|
123231
|
-
newSourceFile,
|
|
123232
123242
|
resolutions,
|
|
123233
|
-
(name
|
|
123234
|
-
moduleResolutionIsEqualTo
|
|
123235
|
-
moduleResolutionNameAndModeGetter
|
|
123243
|
+
(name) => oldProgram.getResolvedModule(newSourceFile, name.text, getModeForUsageLocation2(newSourceFile, name)),
|
|
123244
|
+
moduleResolutionIsEqualTo
|
|
123236
123245
|
);
|
|
123237
123246
|
if (resolutionsChanged)
|
|
123238
123247
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -123241,11 +123250,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123241
123250
|
(resolvedTypeReferenceDirectiveNamesProcessing ?? (resolvedTypeReferenceDirectiveNamesProcessing = /* @__PURE__ */ new Map())).set(newSourceFile.path, typeReferenceResolutions);
|
|
123242
123251
|
const typeReferenceResolutionsChanged = hasChangesInResolutions(
|
|
123243
123252
|
typesReferenceDirectives,
|
|
123244
|
-
newSourceFile,
|
|
123245
123253
|
typeReferenceResolutions,
|
|
123246
|
-
(name
|
|
123247
|
-
typeDirectiveIsEqualTo
|
|
123248
|
-
typeReferenceResolutionNameAndModeGetter
|
|
123254
|
+
(name) => oldProgram.getResolvedTypeReferenceDirective(newSourceFile, getTypeReferenceResolutionName(name), getModeForFileReference(name, newSourceFile.impliedNodeFormat)),
|
|
123255
|
+
typeDirectiveIsEqualTo
|
|
123249
123256
|
);
|
|
123250
123257
|
if (typeReferenceResolutionsChanged)
|
|
123251
123258
|
structureIsReused = 1 /* SafeModules */;
|
|
@@ -123912,8 +123919,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123912
123919
|
false
|
|
123913
123920
|
);
|
|
123914
123921
|
}
|
|
123915
|
-
|
|
123916
|
-
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || shouldProcessRequires) {
|
|
123922
|
+
if (file.flags & 4194304 /* PossiblyContainsDynamicImport */ || isJavaScriptFile) {
|
|
123917
123923
|
collectDynamicImportOrRequireCalls(file);
|
|
123918
123924
|
}
|
|
123919
123925
|
file.imports = imports || emptyArray;
|
|
@@ -123962,7 +123968,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
123962
123968
|
const r = /import|require/g;
|
|
123963
123969
|
while (r.exec(file2.text) !== null) {
|
|
123964
123970
|
const node = getNodeAtPosition(file2, r.lastIndex);
|
|
123965
|
-
if (
|
|
123971
|
+
if (isJavaScriptFile && isRequireCall(
|
|
123966
123972
|
node,
|
|
123967
123973
|
/*requireStringLiteralLikeArgument*/
|
|
123968
123974
|
true
|
|
@@ -124517,13 +124523,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124517
124523
|
const moduleNames = getModuleNames(file);
|
|
124518
124524
|
const resolutions = (resolvedModulesProcessing == null ? void 0 : resolvedModulesProcessing.get(file.path)) || resolveModuleNamesReusingOldState(moduleNames, file);
|
|
124519
124525
|
Debug.assert(resolutions.length === moduleNames.length);
|
|
124520
|
-
const optionsForFile = (
|
|
124526
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
124521
124527
|
const resolutionsInFile = createModeAwareCache();
|
|
124522
124528
|
(resolvedModules ?? (resolvedModules = /* @__PURE__ */ new Map())).set(file.path, resolutionsInFile);
|
|
124523
124529
|
for (let index = 0; index < moduleNames.length; index++) {
|
|
124524
124530
|
const resolution = resolutions[index].resolvedModule;
|
|
124525
124531
|
const moduleName = moduleNames[index].text;
|
|
124526
|
-
const mode =
|
|
124532
|
+
const mode = getModeForUsageLocationWorker(file, moduleNames[index], optionsForFile);
|
|
124527
124533
|
resolutionsInFile.set(moduleName, mode, resolutions[index]);
|
|
124528
124534
|
addResolutionDiagnosticsFromResolutionOrCache(file, moduleName, resolutions[index], mode);
|
|
124529
124535
|
if (!resolution) {
|
|
@@ -124803,7 +124809,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124803
124809
|
if (getEmitModuleResolutionKind(options) === 1 /* Classic */) {
|
|
124804
124810
|
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_moduleResolution_is_set_to_classic, "resolveJsonModule");
|
|
124805
124811
|
} else if (!hasJsonModuleEmitEnabled(options)) {
|
|
124806
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
124812
|
+
createDiagnosticForOptionName(Diagnostics.Option_resolveJsonModule_cannot_be_specified_when_module_is_set_to_none_system_or_umd, "resolveJsonModule", "module");
|
|
124807
124813
|
}
|
|
124808
124814
|
}
|
|
124809
124815
|
if (options.outDir || // there is --outDir specified
|
|
@@ -124867,7 +124873,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124867
124873
|
}
|
|
124868
124874
|
}
|
|
124869
124875
|
if (options.preserveValueImports && getEmitModuleKind(options) < 5 /* ES2015 */) {
|
|
124870
|
-
createDiagnosticForOptionName(Diagnostics.
|
|
124876
|
+
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "preserveValueImports");
|
|
124871
124877
|
}
|
|
124872
124878
|
const moduleKind = getEmitModuleKind(options);
|
|
124873
124879
|
if (options.verbatimModuleSyntax) {
|
|
@@ -124894,8 +124900,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
124894
124900
|
if (options.customConditions && !moduleResolutionSupportsPackageJsonExportsAndImports(moduleResolution)) {
|
|
124895
124901
|
createDiagnosticForOptionName(Diagnostics.Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler, "customConditions");
|
|
124896
124902
|
}
|
|
124897
|
-
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind)) {
|
|
124898
|
-
createOptionValueDiagnostic("moduleResolution", Diagnostics.
|
|
124903
|
+
if (moduleResolution === 100 /* Bundler */ && !emitModuleKindIsNonNodeESM(moduleKind) && moduleKind !== 200 /* Preserve */) {
|
|
124904
|
+
createOptionValueDiagnostic("moduleResolution", Diagnostics.Option_0_can_only_be_used_when_module_is_set_to_preserve_or_to_es2015_or_later, "bundler");
|
|
124899
124905
|
}
|
|
124900
124906
|
if (ModuleKind[moduleKind] && (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */) && !(3 /* Node16 */ <= moduleResolution && moduleResolution <= 99 /* NodeNext */)) {
|
|
124901
124907
|
const moduleKindName = ModuleKind[moduleKind];
|
|
@@ -125402,6 +125408,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125402
125408
|
}
|
|
125403
125409
|
return symlinks;
|
|
125404
125410
|
}
|
|
125411
|
+
function getModeForUsageLocation2(file, usage) {
|
|
125412
|
+
var _a2;
|
|
125413
|
+
const optionsForFile = ((_a2 = getRedirectReferenceForResolution(file)) == null ? void 0 : _a2.commandLine.options) || options;
|
|
125414
|
+
return getModeForUsageLocationWorker(file, usage, optionsForFile);
|
|
125415
|
+
}
|
|
125416
|
+
function getModeForResolutionAtIndex2(file, index) {
|
|
125417
|
+
return getModeForUsageLocation2(file, getModuleNameStringLiteralAt(file, index));
|
|
125418
|
+
}
|
|
125405
125419
|
}
|
|
125406
125420
|
function updateHostForUseSourceOfProjectReferenceRedirect(host) {
|
|
125407
125421
|
let setOfDeclarationDirectories;
|
|
@@ -127867,7 +127881,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127867
127881
|
const seenNamesInFile = createModeAwareCache();
|
|
127868
127882
|
for (const entry of entries) {
|
|
127869
127883
|
const name = loader.nameAndMode.getName(entry);
|
|
127870
|
-
const mode = loader.nameAndMode.getMode(entry, containingSourceFile);
|
|
127884
|
+
const mode = loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options);
|
|
127871
127885
|
let resolution = resolutionsInFile.get(name, mode);
|
|
127872
127886
|
if (!seenNamesInFile.has(name, mode) && (allModuleAndTypeResolutionsAreInvalidated || unmatchedRedirects || !resolution || resolution.isInvalidated || // If the name is unresolved import that was invalidated, recalculate
|
|
127873
127887
|
hasInvalidatedNonRelativeUnresolvedImport && !isExternalModuleNameRelative(name) && shouldRetryResolution(resolution))) {
|
|
@@ -127908,7 +127922,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
127908
127922
|
reusedNames == null ? void 0 : reusedNames.forEach(
|
|
127909
127923
|
(entry) => seenNamesInFile.set(
|
|
127910
127924
|
loader.nameAndMode.getName(entry),
|
|
127911
|
-
loader.nameAndMode.getMode(entry, containingSourceFile),
|
|
127925
|
+
loader.nameAndMode.getMode(entry, containingSourceFile, (redirectedReference == null ? void 0 : redirectedReference.commandLine.options) || options),
|
|
127912
127926
|
true
|
|
127913
127927
|
)
|
|
127914
127928
|
);
|
|
@@ -134956,9 +134970,6 @@ function findPackageJson(directory, host) {
|
|
|
134956
134970
|
return packageJson;
|
|
134957
134971
|
}
|
|
134958
134972
|
function getPackageJsonsVisibleToFile(fileName, host) {
|
|
134959
|
-
if (!host.fileExists) {
|
|
134960
|
-
return [];
|
|
134961
|
-
}
|
|
134962
134973
|
const packageJsons = [];
|
|
134963
134974
|
forEachAncestorDirectory(getDirectoryPath(fileName), (ancestor) => {
|
|
134964
134975
|
const packageJsonFileName = combinePaths(ancestor, "package.json");
|
|
@@ -135638,7 +135649,7 @@ function forEachExternalModuleToImportFrom(program, host, preferences, useAutoIm
|
|
|
135638
135649
|
var _a, _b;
|
|
135639
135650
|
const useCaseSensitiveFileNames2 = hostUsesCaseSensitiveFileNames(host);
|
|
135640
135651
|
const excludePatterns = preferences.autoImportFileExcludePatterns && mapDefined(preferences.autoImportFileExcludePatterns, (spec) => {
|
|
135641
|
-
const pattern =
|
|
135652
|
+
const pattern = getSubPatternFromSpec(spec, "", "exclude");
|
|
135642
135653
|
return pattern ? getRegexFromPattern(pattern, useCaseSensitiveFileNames2) : void 0;
|
|
135643
135654
|
});
|
|
135644
135655
|
forEachExternalModule(program.getTypeChecker(), program.getSourceFiles(), excludePatterns, host, (module2, file) => cb(
|
|
@@ -137469,8 +137480,8 @@ function getSourceFileToImport(importedModuleSymbol, importLiteral, importingSou
|
|
|
137469
137480
|
const newFileName = oldToNew(oldFileName);
|
|
137470
137481
|
return newFileName === void 0 ? { newFileName: oldFileName, updated: false } : { newFileName, updated: true };
|
|
137471
137482
|
} else {
|
|
137472
|
-
const mode = getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
137473
|
-
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.
|
|
137483
|
+
const mode = program.getModeForUsageLocation(importingSourceFile, importLiteral);
|
|
137484
|
+
const resolved = host.resolveModuleNameLiterals || !host.resolveModuleNames ? program.getResolvedModuleFromModuleSpecifier(importLiteral) : host.getResolvedModuleWithFailedLookupLocationsFromCache && host.getResolvedModuleWithFailedLookupLocationsFromCache(importLiteral.text, importingSourceFile.fileName, mode);
|
|
137474
137485
|
return getSourceFileToImportFromResolved(importLiteral, resolved, oldToNew, program.getSourceFiles());
|
|
137475
137486
|
}
|
|
137476
137487
|
}
|
|
@@ -138382,7 +138393,7 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
138382
138393
|
const name = importNameForConvertToDefaultImport(importNode);
|
|
138383
138394
|
if (!name)
|
|
138384
138395
|
continue;
|
|
138385
|
-
const module2 = (_a = program.
|
|
138396
|
+
const module2 = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
138386
138397
|
const resolvedFile = module2 && program.getSourceFile(module2.resolvedFileName);
|
|
138387
138398
|
if (resolvedFile && resolvedFile.externalModuleIndicator && resolvedFile.externalModuleIndicator !== true && isExportAssignment(resolvedFile.externalModuleIndicator) && resolvedFile.externalModuleIndicator.isExportEquals) {
|
|
138388
138399
|
diags.push(createDiagnosticForNode(name, Diagnostics.Import_may_be_converted_to_a_default_import));
|
|
@@ -139967,7 +139978,7 @@ function doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, allow
|
|
|
139967
139978
|
if (checker.resolveName(
|
|
139968
139979
|
exportName,
|
|
139969
139980
|
id,
|
|
139970
|
-
|
|
139981
|
+
-1 /* All */,
|
|
139971
139982
|
/*excludeGlobals*/
|
|
139972
139983
|
true
|
|
139973
139984
|
)) {
|
|
@@ -140030,7 +140041,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
|
|
|
140030
140041
|
const symbol = checker.resolveName(
|
|
140031
140042
|
preferredName,
|
|
140032
140043
|
id,
|
|
140033
|
-
|
|
140044
|
+
-1 /* All */,
|
|
140034
140045
|
/*excludeGlobals*/
|
|
140035
140046
|
true
|
|
140036
140047
|
);
|
|
@@ -140582,7 +140593,7 @@ function isDeclarationExported(declaration) {
|
|
|
140582
140593
|
function getReferenceNodes(declaration, checker, file) {
|
|
140583
140594
|
const references = [];
|
|
140584
140595
|
const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
|
|
140585
|
-
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
|
|
140596
|
+
if (ts_FindAllReferences_exports.isWriteAccessForReference(ref) && !isShorthandPropertyAssignment(ref.parent)) {
|
|
140586
140597
|
return true;
|
|
140587
140598
|
}
|
|
140588
140599
|
if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
|
|
@@ -140610,6 +140621,9 @@ function getReplacementExpression(reference, replacement) {
|
|
|
140610
140621
|
if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
|
|
140611
140622
|
return factory.createParenthesizedExpression(replacement);
|
|
140612
140623
|
}
|
|
140624
|
+
if (isIdentifier(reference) && isShorthandPropertyAssignment(parent2)) {
|
|
140625
|
+
return factory.createPropertyAssignment(reference, replacement);
|
|
140626
|
+
}
|
|
140613
140627
|
return replacement;
|
|
140614
140628
|
}
|
|
140615
140629
|
|
|
@@ -140859,10 +140873,11 @@ function getTargetFileImportsAndAddExportInOldFile(oldFile, targetFile, importsT
|
|
|
140859
140873
|
forEachImportInStatement(oldStatement, (i) => {
|
|
140860
140874
|
var _a;
|
|
140861
140875
|
const moduleSpecifier = moduleSpecifierFromImport(i);
|
|
140862
|
-
const
|
|
140876
|
+
const compilerOptions = program.getCompilerOptions();
|
|
140877
|
+
const resolved = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier);
|
|
140863
140878
|
const fileName = (_a = resolved == null ? void 0 : resolved.resolvedModule) == null ? void 0 : _a.resolvedFileName;
|
|
140864
140879
|
if (fileName && targetSourceFile) {
|
|
140865
|
-
const newModuleSpecifier = getModuleSpecifier(
|
|
140880
|
+
const newModuleSpecifier = getModuleSpecifier(compilerOptions, targetSourceFile, targetSourceFile.fileName, fileName, createModuleSpecifierResolutionHost(program, host));
|
|
140866
140881
|
append(copiedOldImports, filterImport(i, makeStringLiteral(newModuleSpecifier, quotePreference), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
140867
140882
|
} else {
|
|
140868
140883
|
append(copiedOldImports, filterImport(i, factory.createStringLiteral(moduleSpecifierFromImport(i).text), (name) => importsToCopy.has(checker.getSymbolAtLocation(name))));
|
|
@@ -140973,7 +140988,7 @@ function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, n
|
|
|
140973
140988
|
needUniqueName = needUniqueName || !!checker.resolveName(
|
|
140974
140989
|
preferredNewNamespaceName,
|
|
140975
140990
|
ref,
|
|
140976
|
-
|
|
140991
|
+
-1 /* All */,
|
|
140977
140992
|
/*excludeGlobals*/
|
|
140978
140993
|
true
|
|
140979
140994
|
);
|
|
@@ -146737,12 +146752,12 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
146737
146752
|
}
|
|
146738
146753
|
return [];
|
|
146739
146754
|
}
|
|
146740
|
-
function getCodeFixesAtPosition(fileName, start2, end,
|
|
146755
|
+
function getCodeFixesAtPosition(fileName, start2, end, errorCodes65, formatOptions, preferences = emptyOptions) {
|
|
146741
146756
|
synchronizeHostData();
|
|
146742
146757
|
const sourceFile = getValidSourceFile(fileName);
|
|
146743
146758
|
const span = createTextSpanFromBounds(start2, end);
|
|
146744
146759
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
146745
|
-
return flatMap(deduplicate(
|
|
146760
|
+
return flatMap(deduplicate(errorCodes65, equateValues, compareValues), (errorCode) => {
|
|
146746
146761
|
cancellationToken.throwIfCancellationRequested();
|
|
146747
146762
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
146748
146763
|
});
|
|
@@ -148450,10 +148465,10 @@ function getSupportedErrorCodes() {
|
|
|
148450
148465
|
return errorCodeToFixesArray ?? (errorCodeToFixesArray = arrayFrom(errorCodeToFixes.keys()));
|
|
148451
148466
|
}
|
|
148452
148467
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
148453
|
-
const { errorCodes:
|
|
148468
|
+
const { errorCodes: errorCodes65 } = registration;
|
|
148454
148469
|
let maybeFixableDiagnostics = 0;
|
|
148455
148470
|
for (const diag2 of diagnostics) {
|
|
148456
|
-
if (contains(
|
|
148471
|
+
if (contains(errorCodes65, diag2.code))
|
|
148457
148472
|
maybeFixableDiagnostics++;
|
|
148458
148473
|
if (maybeFixableDiagnostics > 1)
|
|
148459
148474
|
break;
|
|
@@ -148477,14 +148492,14 @@ function createCombinedCodeActions(changes, commands) {
|
|
|
148477
148492
|
function createFileTextChanges(fileName, textChanges2) {
|
|
148478
148493
|
return { fileName, textChanges: textChanges2 };
|
|
148479
148494
|
}
|
|
148480
|
-
function codeFixAll(context,
|
|
148495
|
+
function codeFixAll(context, errorCodes65, use) {
|
|
148481
148496
|
const commands = [];
|
|
148482
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
148497
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes65, (diag2) => use(t, diag2, commands)));
|
|
148483
148498
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
148484
148499
|
}
|
|
148485
|
-
function eachDiagnostic(context,
|
|
148500
|
+
function eachDiagnostic(context, errorCodes65, cb) {
|
|
148486
148501
|
for (const diag2 of getDiagnostics(context)) {
|
|
148487
|
-
if (contains(
|
|
148502
|
+
if (contains(errorCodes65, diag2.code)) {
|
|
148488
148503
|
cb(diag2);
|
|
148489
148504
|
}
|
|
148490
148505
|
}
|
|
@@ -150308,7 +150323,7 @@ registerCodeFix({
|
|
|
150308
150323
|
function fixImportOfModuleExports(importingFile, exportingFile, program, changes, quotePreference) {
|
|
150309
150324
|
var _a;
|
|
150310
150325
|
for (const moduleSpecifier of importingFile.imports) {
|
|
150311
|
-
const imported = (_a = program.
|
|
150326
|
+
const imported = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
150312
150327
|
if (!imported || imported.resolvedFileName !== exportingFile.fileName) {
|
|
150313
150328
|
continue;
|
|
150314
150329
|
}
|
|
@@ -152225,6 +152240,7 @@ function getUmdImportKind(importingFile, compilerOptions, forceImportKeyword) {
|
|
|
152225
152240
|
case 7 /* ES2022 */:
|
|
152226
152241
|
case 99 /* ESNext */:
|
|
152227
152242
|
case 0 /* None */:
|
|
152243
|
+
case 200 /* Preserve */:
|
|
152228
152244
|
return 2 /* Namespace */;
|
|
152229
152245
|
case 100 /* Node16 */:
|
|
152230
152246
|
case 199 /* NodeNext */:
|
|
@@ -152456,7 +152472,7 @@ function promoteFromTypeOnly(changes, aliasDeclaration, program, sourceFile, pre
|
|
|
152456
152472
|
changes.delete(sourceFile, getTypeKeywordOfTypeOnlyImport(importClause, sourceFile));
|
|
152457
152473
|
if (!compilerOptions.allowImportingTsExtensions) {
|
|
152458
152474
|
const moduleSpecifier = tryGetModuleSpecifierFromDeclaration(importClause.parent);
|
|
152459
|
-
const resolvedModule = moduleSpecifier && ((_a = program.
|
|
152475
|
+
const resolvedModule = moduleSpecifier && ((_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule);
|
|
152460
152476
|
if (resolvedModule == null ? void 0 : resolvedModule.resolvedUsingTsExtension) {
|
|
152461
152477
|
const changedExtension = changeAnyExtension(moduleSpecifier.text, getOutputExtension(moduleSpecifier.text, compilerOptions));
|
|
152462
152478
|
changes.replaceNode(sourceFile, moduleSpecifier, factory.createStringLiteral(changedExtension));
|
|
@@ -153133,15 +153149,10 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
153133
153149
|
const importDeclaration = findAncestor(token, isImportDeclaration);
|
|
153134
153150
|
if (importDeclaration === void 0)
|
|
153135
153151
|
return void 0;
|
|
153136
|
-
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier
|
|
153152
|
+
const moduleSpecifier = isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier : void 0;
|
|
153137
153153
|
if (moduleSpecifier === void 0)
|
|
153138
153154
|
return void 0;
|
|
153139
|
-
const resolvedModule = (_a = program.
|
|
153140
|
-
sourceFile,
|
|
153141
|
-
moduleSpecifier,
|
|
153142
|
-
/*mode*/
|
|
153143
|
-
void 0
|
|
153144
|
-
)) == null ? void 0 : _a.resolvedModule;
|
|
153155
|
+
const resolvedModule = (_a = program.getResolvedModuleFromModuleSpecifier(moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
153145
153156
|
if (resolvedModule === void 0)
|
|
153146
153157
|
return void 0;
|
|
153147
153158
|
const moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -153158,7 +153169,7 @@ function getInfo7(sourceFile, pos, program) {
|
|
|
153158
153169
|
if (node === void 0)
|
|
153159
153170
|
return void 0;
|
|
153160
153171
|
const exportName = { node: token, isTypeOnly: isTypeDeclaration(node) };
|
|
153161
|
-
return { exportName, node, moduleSourceFile, moduleSpecifier };
|
|
153172
|
+
return { exportName, node, moduleSourceFile, moduleSpecifier: moduleSpecifier.text };
|
|
153162
153173
|
}
|
|
153163
153174
|
return void 0;
|
|
153164
153175
|
}
|
|
@@ -153352,7 +153363,7 @@ function getInfo8(sourceFile, pos, context, errorCode) {
|
|
|
153352
153363
|
} else if (isImportSpecifier(parent2) && parent2.name === node) {
|
|
153353
153364
|
Debug.assertNode(node, isIdentifier, "Expected an identifier for spelling (import)");
|
|
153354
153365
|
const importDeclaration = findAncestor(node, isImportDeclaration);
|
|
153355
|
-
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(
|
|
153366
|
+
const resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(context, importDeclaration);
|
|
153356
153367
|
if (resolvedSourceFile && resolvedSourceFile.symbol) {
|
|
153357
153368
|
suggestedSymbol = checker.getSuggestedSymbolForNonexistentModule(node, resolvedSourceFile.symbol);
|
|
153358
153369
|
}
|
|
@@ -153402,11 +153413,11 @@ function convertSemanticMeaningToSymbolFlags(meaning) {
|
|
|
153402
153413
|
}
|
|
153403
153414
|
return flags;
|
|
153404
153415
|
}
|
|
153405
|
-
function getResolvedSourceFileFromImportDeclaration(
|
|
153416
|
+
function getResolvedSourceFileFromImportDeclaration(context, importDeclaration) {
|
|
153406
153417
|
var _a;
|
|
153407
153418
|
if (!importDeclaration || !isStringLiteralLike(importDeclaration.moduleSpecifier))
|
|
153408
153419
|
return void 0;
|
|
153409
|
-
const resolvedModule = (_a = context.program.
|
|
153420
|
+
const resolvedModule = (_a = context.program.getResolvedModuleFromModuleSpecifier(importDeclaration.moduleSpecifier)) == null ? void 0 : _a.resolvedModule;
|
|
153410
153421
|
if (!resolvedModule)
|
|
153411
153422
|
return void 0;
|
|
153412
153423
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
@@ -154326,16 +154337,242 @@ function findAncestorMatchingSpan2(sourceFile, span) {
|
|
|
154326
154337
|
return token;
|
|
154327
154338
|
}
|
|
154328
154339
|
|
|
154340
|
+
// src/services/codefixes/fixAddMissingParam.ts
|
|
154341
|
+
var addMissingParamFixId = "addMissingParam";
|
|
154342
|
+
var addOptionalParamFixId = "addOptionalParam";
|
|
154343
|
+
var errorCodes29 = [Diagnostics.Expected_0_arguments_but_got_1.code];
|
|
154344
|
+
registerCodeFix({
|
|
154345
|
+
errorCodes: errorCodes29,
|
|
154346
|
+
fixIds: [addMissingParamFixId, addOptionalParamFixId],
|
|
154347
|
+
getCodeActions(context) {
|
|
154348
|
+
const info = getInfo11(context.sourceFile, context.program, context.span.start);
|
|
154349
|
+
if (info === void 0)
|
|
154350
|
+
return void 0;
|
|
154351
|
+
const { name, declarations, newParameters, newOptionalParameters } = info;
|
|
154352
|
+
const actions2 = [];
|
|
154353
|
+
if (length(newParameters)) {
|
|
154354
|
+
append(
|
|
154355
|
+
actions2,
|
|
154356
|
+
createCodeFixAction(
|
|
154357
|
+
addMissingParamFixId,
|
|
154358
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newParameters)),
|
|
154359
|
+
[length(newParameters) > 1 ? Diagnostics.Add_missing_parameters_to_0 : Diagnostics.Add_missing_parameter_to_0, name],
|
|
154360
|
+
addMissingParamFixId,
|
|
154361
|
+
Diagnostics.Add_all_missing_parameters
|
|
154362
|
+
)
|
|
154363
|
+
);
|
|
154364
|
+
}
|
|
154365
|
+
if (length(newOptionalParameters)) {
|
|
154366
|
+
append(
|
|
154367
|
+
actions2,
|
|
154368
|
+
createCodeFixAction(
|
|
154369
|
+
addOptionalParamFixId,
|
|
154370
|
+
ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, declarations, newOptionalParameters)),
|
|
154371
|
+
[length(newOptionalParameters) > 1 ? Diagnostics.Add_optional_parameters_to_0 : Diagnostics.Add_optional_parameter_to_0, name],
|
|
154372
|
+
addOptionalParamFixId,
|
|
154373
|
+
Diagnostics.Add_all_optional_parameters
|
|
154374
|
+
)
|
|
154375
|
+
);
|
|
154376
|
+
}
|
|
154377
|
+
return actions2;
|
|
154378
|
+
},
|
|
154379
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes29, (changes, diag2) => {
|
|
154380
|
+
const info = getInfo11(context.sourceFile, context.program, diag2.start);
|
|
154381
|
+
if (info) {
|
|
154382
|
+
const { declarations, newParameters, newOptionalParameters } = info;
|
|
154383
|
+
if (context.fixId === addMissingParamFixId) {
|
|
154384
|
+
doChange19(changes, context.sourceFile, declarations, newParameters);
|
|
154385
|
+
}
|
|
154386
|
+
if (context.fixId === addOptionalParamFixId) {
|
|
154387
|
+
doChange19(changes, context.sourceFile, declarations, newOptionalParameters);
|
|
154388
|
+
}
|
|
154389
|
+
}
|
|
154390
|
+
})
|
|
154391
|
+
});
|
|
154392
|
+
function getInfo11(sourceFile, program, pos) {
|
|
154393
|
+
const token = getTokenAtPosition(sourceFile, pos);
|
|
154394
|
+
const callExpression = findAncestor(token, isCallExpression);
|
|
154395
|
+
if (callExpression === void 0 || length(callExpression.arguments) === 0) {
|
|
154396
|
+
return void 0;
|
|
154397
|
+
}
|
|
154398
|
+
const checker = program.getTypeChecker();
|
|
154399
|
+
const type = checker.getTypeAtLocation(callExpression.expression);
|
|
154400
|
+
const convertibleSignatureDeclarations = filter(type.symbol.declarations, isConvertibleSignatureDeclaration);
|
|
154401
|
+
if (convertibleSignatureDeclarations === void 0) {
|
|
154402
|
+
return void 0;
|
|
154403
|
+
}
|
|
154404
|
+
const nonOverloadDeclaration = lastOrUndefined(convertibleSignatureDeclarations);
|
|
154405
|
+
if (nonOverloadDeclaration === void 0 || nonOverloadDeclaration.body === void 0 || isSourceFileFromLibrary(program, nonOverloadDeclaration.getSourceFile())) {
|
|
154406
|
+
return void 0;
|
|
154407
|
+
}
|
|
154408
|
+
const name = tryGetName2(nonOverloadDeclaration);
|
|
154409
|
+
if (name === void 0) {
|
|
154410
|
+
return void 0;
|
|
154411
|
+
}
|
|
154412
|
+
const newParameters = [];
|
|
154413
|
+
const newOptionalParameters = [];
|
|
154414
|
+
const parametersLength = length(nonOverloadDeclaration.parameters);
|
|
154415
|
+
const argumentsLength = length(callExpression.arguments);
|
|
154416
|
+
if (parametersLength > argumentsLength) {
|
|
154417
|
+
return void 0;
|
|
154418
|
+
}
|
|
154419
|
+
const declarations = [nonOverloadDeclaration, ...getOverloads(nonOverloadDeclaration, convertibleSignatureDeclarations)];
|
|
154420
|
+
for (let i = 0, pos2 = 0, paramIndex = 0; i < argumentsLength; i++) {
|
|
154421
|
+
const arg = callExpression.arguments[i];
|
|
154422
|
+
const expr = isAccessExpression(arg) ? getNameOfAccessExpression(arg) : arg;
|
|
154423
|
+
const type2 = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(arg)));
|
|
154424
|
+
const parameter = pos2 < parametersLength ? nonOverloadDeclaration.parameters[pos2] : void 0;
|
|
154425
|
+
if (parameter && checker.isTypeAssignableTo(type2, checker.getTypeAtLocation(parameter))) {
|
|
154426
|
+
pos2++;
|
|
154427
|
+
continue;
|
|
154428
|
+
}
|
|
154429
|
+
const name2 = expr && isIdentifier(expr) ? expr.text : `p${paramIndex++}`;
|
|
154430
|
+
const typeNode = typeToTypeNode(checker, type2, nonOverloadDeclaration);
|
|
154431
|
+
append(newParameters, {
|
|
154432
|
+
pos: i,
|
|
154433
|
+
declaration: createParameter(
|
|
154434
|
+
name2,
|
|
154435
|
+
typeNode,
|
|
154436
|
+
/*questionToken*/
|
|
154437
|
+
void 0
|
|
154438
|
+
)
|
|
154439
|
+
});
|
|
154440
|
+
if (isOptionalPos(declarations, pos2)) {
|
|
154441
|
+
continue;
|
|
154442
|
+
}
|
|
154443
|
+
append(newOptionalParameters, {
|
|
154444
|
+
pos: i,
|
|
154445
|
+
declaration: createParameter(name2, typeNode, factory.createToken(58 /* QuestionToken */))
|
|
154446
|
+
});
|
|
154447
|
+
}
|
|
154448
|
+
return {
|
|
154449
|
+
newParameters,
|
|
154450
|
+
newOptionalParameters,
|
|
154451
|
+
name: declarationNameToString(name),
|
|
154452
|
+
declarations
|
|
154453
|
+
};
|
|
154454
|
+
}
|
|
154455
|
+
function tryGetName2(node) {
|
|
154456
|
+
const name = getNameOfDeclaration(node);
|
|
154457
|
+
if (name) {
|
|
154458
|
+
return name;
|
|
154459
|
+
}
|
|
154460
|
+
if (isVariableDeclaration(node.parent) && isIdentifier(node.parent.name) || isPropertyDeclaration(node.parent) || isParameter(node.parent)) {
|
|
154461
|
+
return node.parent.name;
|
|
154462
|
+
}
|
|
154463
|
+
}
|
|
154464
|
+
function typeToTypeNode(checker, type, enclosingDeclaration) {
|
|
154465
|
+
return checker.typeToTypeNode(checker.getWidenedType(type), enclosingDeclaration, 1 /* NoTruncation */) ?? factory.createKeywordTypeNode(159 /* UnknownKeyword */);
|
|
154466
|
+
}
|
|
154467
|
+
function doChange19(changes, sourceFile, declarations, newParameters) {
|
|
154468
|
+
forEach(declarations, (declaration) => {
|
|
154469
|
+
if (length(declaration.parameters)) {
|
|
154470
|
+
changes.replaceNodeRangeWithNodes(
|
|
154471
|
+
sourceFile,
|
|
154472
|
+
first(declaration.parameters),
|
|
154473
|
+
last(declaration.parameters),
|
|
154474
|
+
updateParameters(declaration, newParameters),
|
|
154475
|
+
{
|
|
154476
|
+
joiner: ", ",
|
|
154477
|
+
indentation: 0,
|
|
154478
|
+
leadingTriviaOption: ts_textChanges_exports.LeadingTriviaOption.IncludeAll,
|
|
154479
|
+
trailingTriviaOption: ts_textChanges_exports.TrailingTriviaOption.Include
|
|
154480
|
+
}
|
|
154481
|
+
);
|
|
154482
|
+
} else {
|
|
154483
|
+
forEach(updateParameters(declaration, newParameters), (parameter, index) => {
|
|
154484
|
+
if (length(declaration.parameters) === 0 && index === 0) {
|
|
154485
|
+
changes.insertNodeAt(sourceFile, declaration.parameters.end, parameter);
|
|
154486
|
+
} else {
|
|
154487
|
+
changes.insertNodeAtEndOfList(sourceFile, declaration.parameters, parameter);
|
|
154488
|
+
}
|
|
154489
|
+
});
|
|
154490
|
+
}
|
|
154491
|
+
});
|
|
154492
|
+
}
|
|
154493
|
+
function isConvertibleSignatureDeclaration(node) {
|
|
154494
|
+
switch (node.kind) {
|
|
154495
|
+
case 262 /* FunctionDeclaration */:
|
|
154496
|
+
case 218 /* FunctionExpression */:
|
|
154497
|
+
case 174 /* MethodDeclaration */:
|
|
154498
|
+
case 219 /* ArrowFunction */:
|
|
154499
|
+
return true;
|
|
154500
|
+
default:
|
|
154501
|
+
return false;
|
|
154502
|
+
}
|
|
154503
|
+
}
|
|
154504
|
+
function updateParameters(node, newParameters) {
|
|
154505
|
+
const parameters = map(node.parameters, (p) => factory.createParameterDeclaration(
|
|
154506
|
+
p.modifiers,
|
|
154507
|
+
p.dotDotDotToken,
|
|
154508
|
+
p.name,
|
|
154509
|
+
p.questionToken,
|
|
154510
|
+
p.type,
|
|
154511
|
+
p.initializer
|
|
154512
|
+
));
|
|
154513
|
+
for (const { pos, declaration } of newParameters) {
|
|
154514
|
+
const prev = pos > 0 ? parameters[pos - 1] : void 0;
|
|
154515
|
+
parameters.splice(
|
|
154516
|
+
pos,
|
|
154517
|
+
0,
|
|
154518
|
+
factory.updateParameterDeclaration(
|
|
154519
|
+
declaration,
|
|
154520
|
+
declaration.modifiers,
|
|
154521
|
+
declaration.dotDotDotToken,
|
|
154522
|
+
declaration.name,
|
|
154523
|
+
prev && prev.questionToken ? factory.createToken(58 /* QuestionToken */) : declaration.questionToken,
|
|
154524
|
+
declaration.type,
|
|
154525
|
+
declaration.initializer
|
|
154526
|
+
)
|
|
154527
|
+
);
|
|
154528
|
+
}
|
|
154529
|
+
return parameters;
|
|
154530
|
+
}
|
|
154531
|
+
function getOverloads(implementation, declarations) {
|
|
154532
|
+
const overloads = [];
|
|
154533
|
+
for (const declaration of declarations) {
|
|
154534
|
+
if (isOverload(declaration)) {
|
|
154535
|
+
if (length(declaration.parameters) === length(implementation.parameters)) {
|
|
154536
|
+
overloads.push(declaration);
|
|
154537
|
+
continue;
|
|
154538
|
+
}
|
|
154539
|
+
if (length(declaration.parameters) > length(implementation.parameters)) {
|
|
154540
|
+
return [];
|
|
154541
|
+
}
|
|
154542
|
+
}
|
|
154543
|
+
}
|
|
154544
|
+
return overloads;
|
|
154545
|
+
}
|
|
154546
|
+
function isOverload(declaration) {
|
|
154547
|
+
return isConvertibleSignatureDeclaration(declaration) && declaration.body === void 0;
|
|
154548
|
+
}
|
|
154549
|
+
function createParameter(name, type, questionToken) {
|
|
154550
|
+
return factory.createParameterDeclaration(
|
|
154551
|
+
/*modifiers*/
|
|
154552
|
+
void 0,
|
|
154553
|
+
/*dotDotDotToken*/
|
|
154554
|
+
void 0,
|
|
154555
|
+
name,
|
|
154556
|
+
questionToken,
|
|
154557
|
+
type,
|
|
154558
|
+
/*initializer*/
|
|
154559
|
+
void 0
|
|
154560
|
+
);
|
|
154561
|
+
}
|
|
154562
|
+
function isOptionalPos(declarations, pos) {
|
|
154563
|
+
return length(declarations) && some(declarations, (d) => pos < length(d.parameters) && !!d.parameters[pos] && d.parameters[pos].questionToken === void 0);
|
|
154564
|
+
}
|
|
154565
|
+
|
|
154329
154566
|
// src/services/codefixes/fixCannotFindModule.ts
|
|
154330
154567
|
var fixName2 = "fixCannotFindModule";
|
|
154331
154568
|
var fixIdInstallTypesPackage = "installTypesPackage";
|
|
154332
154569
|
var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
154333
|
-
var
|
|
154570
|
+
var errorCodes30 = [
|
|
154334
154571
|
errorCodeCannotFindModule,
|
|
154335
154572
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
154336
154573
|
];
|
|
154337
154574
|
registerCodeFix({
|
|
154338
|
-
errorCodes:
|
|
154575
|
+
errorCodes: errorCodes30,
|
|
154339
154576
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
154340
154577
|
const { host, sourceFile, span: { start: start2 } } = context;
|
|
154341
154578
|
const packageName = tryGetImportedPackageName(sourceFile, start2);
|
|
@@ -154354,7 +154591,7 @@ registerCodeFix({
|
|
|
154354
154591
|
},
|
|
154355
154592
|
fixIds: [fixIdInstallTypesPackage],
|
|
154356
154593
|
getAllCodeActions: (context) => {
|
|
154357
|
-
return codeFixAll(context,
|
|
154594
|
+
return codeFixAll(context, errorCodes30, (_changes, diag2, commands) => {
|
|
154358
154595
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
154359
154596
|
if (packageName === void 0)
|
|
154360
154597
|
return void 0;
|
|
@@ -154389,12 +154626,12 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
|
|
|
154389
154626
|
}
|
|
154390
154627
|
|
|
154391
154628
|
// src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
|
|
154392
|
-
var
|
|
154629
|
+
var errorCodes31 = [
|
|
154393
154630
|
Diagnostics.Non_abstract_class_0_does_not_implement_all_abstract_members_of_1.code
|
|
154394
154631
|
];
|
|
154395
154632
|
var fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
154396
154633
|
registerCodeFix({
|
|
154397
|
-
errorCodes:
|
|
154634
|
+
errorCodes: errorCodes31,
|
|
154398
154635
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
154399
154636
|
const { sourceFile, span } = context;
|
|
154400
154637
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
@@ -154403,7 +154640,7 @@ registerCodeFix({
|
|
|
154403
154640
|
fixIds: [fixId25],
|
|
154404
154641
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
154405
154642
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
154406
|
-
return codeFixAll(context,
|
|
154643
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
154407
154644
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
154408
154645
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
154409
154646
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -154431,34 +154668,34 @@ function symbolPointsToNonPrivateAndAbstractMember(symbol) {
|
|
|
154431
154668
|
|
|
154432
154669
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
154433
154670
|
var fixId26 = "classSuperMustPrecedeThisAccess";
|
|
154434
|
-
var
|
|
154671
|
+
var errorCodes32 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
154435
154672
|
registerCodeFix({
|
|
154436
|
-
errorCodes:
|
|
154673
|
+
errorCodes: errorCodes32,
|
|
154437
154674
|
getCodeActions(context) {
|
|
154438
154675
|
const { sourceFile, span } = context;
|
|
154439
154676
|
const nodes = getNodes(sourceFile, span.start);
|
|
154440
154677
|
if (!nodes)
|
|
154441
154678
|
return void 0;
|
|
154442
154679
|
const { constructor, superCall } = nodes;
|
|
154443
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154680
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, constructor, superCall));
|
|
154444
154681
|
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)];
|
|
154445
154682
|
},
|
|
154446
154683
|
fixIds: [fixId26],
|
|
154447
154684
|
getAllCodeActions(context) {
|
|
154448
154685
|
const { sourceFile } = context;
|
|
154449
154686
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
154450
|
-
return codeFixAll(context,
|
|
154687
|
+
return codeFixAll(context, errorCodes32, (changes, diag2) => {
|
|
154451
154688
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
154452
154689
|
if (!nodes)
|
|
154453
154690
|
return;
|
|
154454
154691
|
const { constructor, superCall } = nodes;
|
|
154455
154692
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
154456
|
-
|
|
154693
|
+
doChange20(changes, sourceFile, constructor, superCall);
|
|
154457
154694
|
}
|
|
154458
154695
|
});
|
|
154459
154696
|
}
|
|
154460
154697
|
});
|
|
154461
|
-
function
|
|
154698
|
+
function doChange20(changes, sourceFile, constructor, superCall) {
|
|
154462
154699
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
154463
154700
|
changes.delete(sourceFile, superCall);
|
|
154464
154701
|
}
|
|
@@ -154476,24 +154713,24 @@ function findSuperCall(n) {
|
|
|
154476
154713
|
|
|
154477
154714
|
// src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
|
|
154478
154715
|
var fixId27 = "constructorForDerivedNeedSuperCall";
|
|
154479
|
-
var
|
|
154716
|
+
var errorCodes33 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
154480
154717
|
registerCodeFix({
|
|
154481
|
-
errorCodes:
|
|
154718
|
+
errorCodes: errorCodes33,
|
|
154482
154719
|
getCodeActions(context) {
|
|
154483
154720
|
const { sourceFile, span } = context;
|
|
154484
154721
|
const ctr = getNode(sourceFile, span.start);
|
|
154485
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154722
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, ctr));
|
|
154486
154723
|
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
154487
154724
|
},
|
|
154488
154725
|
fixIds: [fixId27],
|
|
154489
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154726
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes, diag2) => doChange21(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
154490
154727
|
});
|
|
154491
154728
|
function getNode(sourceFile, pos) {
|
|
154492
154729
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
154493
154730
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
154494
154731
|
return token.parent;
|
|
154495
154732
|
}
|
|
154496
|
-
function
|
|
154733
|
+
function doChange21(changes, sourceFile, ctr) {
|
|
154497
154734
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
154498
154735
|
factory.createSuper(),
|
|
154499
154736
|
/*typeArguments*/
|
|
@@ -154506,59 +154743,59 @@ function doChange20(changes, sourceFile, ctr) {
|
|
|
154506
154743
|
|
|
154507
154744
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
154508
154745
|
var fixID = "fixEnableJsxFlag";
|
|
154509
|
-
var
|
|
154746
|
+
var errorCodes34 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
154510
154747
|
registerCodeFix({
|
|
154511
|
-
errorCodes:
|
|
154748
|
+
errorCodes: errorCodes34,
|
|
154512
154749
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
154513
154750
|
const { configFile } = context.program.getCompilerOptions();
|
|
154514
154751
|
if (configFile === void 0) {
|
|
154515
154752
|
return void 0;
|
|
154516
154753
|
}
|
|
154517
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) =>
|
|
154754
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => doChange22(changeTracker, configFile));
|
|
154518
154755
|
return [
|
|
154519
154756
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
154520
154757
|
];
|
|
154521
154758
|
},
|
|
154522
154759
|
fixIds: [fixID],
|
|
154523
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154760
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes) => {
|
|
154524
154761
|
const { configFile } = context.program.getCompilerOptions();
|
|
154525
154762
|
if (configFile === void 0) {
|
|
154526
154763
|
return void 0;
|
|
154527
154764
|
}
|
|
154528
|
-
|
|
154765
|
+
doChange22(changes, configFile);
|
|
154529
154766
|
})
|
|
154530
154767
|
});
|
|
154531
|
-
function
|
|
154768
|
+
function doChange22(changeTracker, configFile) {
|
|
154532
154769
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
154533
154770
|
}
|
|
154534
154771
|
|
|
154535
154772
|
// src/services/codefixes/fixNaNEquality.ts
|
|
154536
154773
|
var fixId28 = "fixNaNEquality";
|
|
154537
|
-
var
|
|
154774
|
+
var errorCodes35 = [
|
|
154538
154775
|
Diagnostics.This_condition_will_always_return_0.code
|
|
154539
154776
|
];
|
|
154540
154777
|
registerCodeFix({
|
|
154541
|
-
errorCodes:
|
|
154778
|
+
errorCodes: errorCodes35,
|
|
154542
154779
|
getCodeActions(context) {
|
|
154543
154780
|
const { sourceFile, span, program } = context;
|
|
154544
|
-
const info =
|
|
154781
|
+
const info = getInfo12(program, sourceFile, span);
|
|
154545
154782
|
if (info === void 0)
|
|
154546
154783
|
return;
|
|
154547
154784
|
const { suggestion, expression, arg } = info;
|
|
154548
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154785
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, arg, expression));
|
|
154549
154786
|
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
154550
154787
|
},
|
|
154551
154788
|
fixIds: [fixId28],
|
|
154552
154789
|
getAllCodeActions: (context) => {
|
|
154553
|
-
return codeFixAll(context,
|
|
154554
|
-
const info =
|
|
154790
|
+
return codeFixAll(context, errorCodes35, (changes, diag2) => {
|
|
154791
|
+
const info = getInfo12(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
154555
154792
|
if (info) {
|
|
154556
|
-
|
|
154793
|
+
doChange23(changes, diag2.file, info.arg, info.expression);
|
|
154557
154794
|
}
|
|
154558
154795
|
});
|
|
154559
154796
|
}
|
|
154560
154797
|
});
|
|
154561
|
-
function
|
|
154798
|
+
function getInfo12(program, sourceFile, span) {
|
|
154562
154799
|
const diag2 = find(program.getSemanticDiagnostics(sourceFile), (diag3) => diag3.start === span.start && diag3.length === span.length);
|
|
154563
154800
|
if (diag2 === void 0 || diag2.relatedInformation === void 0)
|
|
154564
154801
|
return;
|
|
@@ -154573,7 +154810,7 @@ function getInfo11(program, sourceFile, span) {
|
|
|
154573
154810
|
}
|
|
154574
154811
|
return void 0;
|
|
154575
154812
|
}
|
|
154576
|
-
function
|
|
154813
|
+
function doChange23(changes, sourceFile, arg, expression) {
|
|
154577
154814
|
const callExpression = factory.createCallExpression(
|
|
154578
154815
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
154579
154816
|
/*typeArguments*/
|
|
@@ -154595,9 +154832,9 @@ function getSuggestion(messageText) {
|
|
|
154595
154832
|
// src/services/codefixes/fixModuleAndTargetOptions.ts
|
|
154596
154833
|
registerCodeFix({
|
|
154597
154834
|
errorCodes: [
|
|
154598
|
-
Diagnostics.
|
|
154599
|
-
Diagnostics.
|
|
154600
|
-
Diagnostics.
|
|
154835
|
+
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,
|
|
154836
|
+
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,
|
|
154837
|
+
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
|
|
154601
154838
|
],
|
|
154602
154839
|
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
154603
154840
|
const compilerOptions = context.program.getCompilerOptions();
|
|
@@ -154635,21 +154872,21 @@ registerCodeFix({
|
|
|
154635
154872
|
|
|
154636
154873
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
154637
154874
|
var fixId29 = "fixPropertyAssignment";
|
|
154638
|
-
var
|
|
154875
|
+
var errorCodes36 = [
|
|
154639
154876
|
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
|
|
154640
154877
|
];
|
|
154641
154878
|
registerCodeFix({
|
|
154642
|
-
errorCodes:
|
|
154879
|
+
errorCodes: errorCodes36,
|
|
154643
154880
|
fixIds: [fixId29],
|
|
154644
154881
|
getCodeActions(context) {
|
|
154645
154882
|
const { sourceFile, span } = context;
|
|
154646
154883
|
const property = getProperty2(sourceFile, span.start);
|
|
154647
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154884
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, context.sourceFile, property));
|
|
154648
154885
|
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
154649
154886
|
},
|
|
154650
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154887
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => doChange24(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
154651
154888
|
});
|
|
154652
|
-
function
|
|
154889
|
+
function doChange24(changes, sourceFile, node) {
|
|
154653
154890
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
154654
154891
|
}
|
|
154655
154892
|
function getProperty2(sourceFile, pos) {
|
|
@@ -154658,9 +154895,9 @@ function getProperty2(sourceFile, pos) {
|
|
|
154658
154895
|
|
|
154659
154896
|
// src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
|
|
154660
154897
|
var fixId30 = "extendsInterfaceBecomesImplements";
|
|
154661
|
-
var
|
|
154898
|
+
var errorCodes37 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
154662
154899
|
registerCodeFix({
|
|
154663
|
-
errorCodes:
|
|
154900
|
+
errorCodes: errorCodes37,
|
|
154664
154901
|
getCodeActions(context) {
|
|
154665
154902
|
const { sourceFile } = context;
|
|
154666
154903
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -154671,7 +154908,7 @@ registerCodeFix({
|
|
|
154671
154908
|
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
154672
154909
|
},
|
|
154673
154910
|
fixIds: [fixId30],
|
|
154674
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154911
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
154675
154912
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
154676
154913
|
if (nodes)
|
|
154677
154914
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -154701,36 +154938,36 @@ function doChanges2(changes, sourceFile, extendsToken, heritageClauses) {
|
|
|
154701
154938
|
// src/services/codefixes/fixForgottenThisPropertyAccess.ts
|
|
154702
154939
|
var fixId31 = "forgottenThisPropertyAccess";
|
|
154703
154940
|
var didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
154704
|
-
var
|
|
154941
|
+
var errorCodes38 = [
|
|
154705
154942
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
154706
154943
|
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,
|
|
154707
154944
|
didYouMeanStaticMemberCode
|
|
154708
154945
|
];
|
|
154709
154946
|
registerCodeFix({
|
|
154710
|
-
errorCodes:
|
|
154947
|
+
errorCodes: errorCodes38,
|
|
154711
154948
|
getCodeActions(context) {
|
|
154712
154949
|
const { sourceFile } = context;
|
|
154713
|
-
const info =
|
|
154950
|
+
const info = getInfo13(sourceFile, context.span.start, context.errorCode);
|
|
154714
154951
|
if (!info) {
|
|
154715
154952
|
return void 0;
|
|
154716
154953
|
}
|
|
154717
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154954
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, info));
|
|
154718
154955
|
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)];
|
|
154719
154956
|
},
|
|
154720
154957
|
fixIds: [fixId31],
|
|
154721
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
154722
|
-
const info =
|
|
154958
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes38, (changes, diag2) => {
|
|
154959
|
+
const info = getInfo13(diag2.file, diag2.start, diag2.code);
|
|
154723
154960
|
if (info)
|
|
154724
|
-
|
|
154961
|
+
doChange25(changes, context.sourceFile, info);
|
|
154725
154962
|
})
|
|
154726
154963
|
});
|
|
154727
|
-
function
|
|
154964
|
+
function getInfo13(sourceFile, pos, diagCode) {
|
|
154728
154965
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
154729
154966
|
if (isIdentifier(node) || isPrivateIdentifier(node)) {
|
|
154730
154967
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
154731
154968
|
}
|
|
154732
154969
|
}
|
|
154733
|
-
function
|
|
154970
|
+
function doChange25(changes, sourceFile, { node, className }) {
|
|
154734
154971
|
suppressLeadingAndTrailingTrivia(node);
|
|
154735
154972
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
154736
154973
|
}
|
|
@@ -154738,16 +154975,16 @@ function doChange24(changes, sourceFile, { node, className }) {
|
|
|
154738
154975
|
// src/services/codefixes/fixInvalidJsxCharacters.ts
|
|
154739
154976
|
var fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
154740
154977
|
var fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
154741
|
-
var
|
|
154978
|
+
var errorCodes39 = [
|
|
154742
154979
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
154743
154980
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
154744
154981
|
];
|
|
154745
154982
|
registerCodeFix({
|
|
154746
|
-
errorCodes:
|
|
154983
|
+
errorCodes: errorCodes39,
|
|
154747
154984
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
154748
154985
|
getCodeActions(context) {
|
|
154749
154986
|
const { sourceFile, preferences, span } = context;
|
|
154750
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154987
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
154751
154988
|
t,
|
|
154752
154989
|
preferences,
|
|
154753
154990
|
sourceFile,
|
|
@@ -154755,7 +154992,7 @@ registerCodeFix({
|
|
|
154755
154992
|
/*useHtmlEntity*/
|
|
154756
154993
|
false
|
|
154757
154994
|
));
|
|
154758
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
154995
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(
|
|
154759
154996
|
t,
|
|
154760
154997
|
preferences,
|
|
154761
154998
|
sourceFile,
|
|
@@ -154769,7 +155006,7 @@ registerCodeFix({
|
|
|
154769
155006
|
];
|
|
154770
155007
|
},
|
|
154771
155008
|
getAllCodeActions(context) {
|
|
154772
|
-
return codeFixAll(context,
|
|
155009
|
+
return codeFixAll(context, errorCodes39, (changes, diagnostic) => doChange26(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
154773
155010
|
}
|
|
154774
155011
|
});
|
|
154775
155012
|
var htmlEntity = {
|
|
@@ -154779,7 +155016,7 @@ var htmlEntity = {
|
|
|
154779
155016
|
function isValidCharacter(character) {
|
|
154780
155017
|
return hasProperty(htmlEntity, character);
|
|
154781
155018
|
}
|
|
154782
|
-
function
|
|
155019
|
+
function doChange26(changes, preferences, sourceFile, start2, useHtmlEntity) {
|
|
154783
155020
|
const character = sourceFile.getText()[start2];
|
|
154784
155021
|
if (!isValidCharacter(character)) {
|
|
154785
155022
|
return;
|
|
@@ -154791,16 +155028,16 @@ function doChange25(changes, preferences, sourceFile, start2, useHtmlEntity) {
|
|
|
154791
155028
|
// src/services/codefixes/fixUnmatchedParameter.ts
|
|
154792
155029
|
var deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
154793
155030
|
var renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
154794
|
-
var
|
|
155031
|
+
var errorCodes40 = [
|
|
154795
155032
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
154796
155033
|
];
|
|
154797
155034
|
registerCodeFix({
|
|
154798
155035
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
154799
|
-
errorCodes:
|
|
155036
|
+
errorCodes: errorCodes40,
|
|
154800
155037
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
154801
155038
|
const { sourceFile, span } = context;
|
|
154802
155039
|
const actions2 = [];
|
|
154803
|
-
const info =
|
|
155040
|
+
const info = getInfo14(sourceFile, span.start);
|
|
154804
155041
|
if (info) {
|
|
154805
155042
|
append(actions2, getDeleteAction(context, info));
|
|
154806
155043
|
append(actions2, getRenameAction(context, info));
|
|
@@ -154811,8 +155048,8 @@ registerCodeFix({
|
|
|
154811
155048
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
154812
155049
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
154813
155050
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
154814
|
-
eachDiagnostic(context,
|
|
154815
|
-
const info =
|
|
155051
|
+
eachDiagnostic(context, errorCodes40, ({ file, start: start2 }) => {
|
|
155052
|
+
const info = getInfo14(file, start2);
|
|
154816
155053
|
if (info) {
|
|
154817
155054
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
154818
155055
|
}
|
|
@@ -154862,7 +155099,7 @@ function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTa
|
|
|
154862
155099
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
|
|
154863
155100
|
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
|
|
154864
155101
|
}
|
|
154865
|
-
function
|
|
155102
|
+
function getInfo14(sourceFile, pos) {
|
|
154866
155103
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
154867
155104
|
if (token.parent && isJSDocParameterTag(token.parent) && isIdentifier(token.parent.name)) {
|
|
154868
155105
|
const jsDocParameterTag = token.parent;
|
|
@@ -154877,9 +155114,9 @@ function getInfo13(sourceFile, pos) {
|
|
|
154877
155114
|
|
|
154878
155115
|
// src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts
|
|
154879
155116
|
var fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
154880
|
-
var
|
|
155117
|
+
var 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];
|
|
154881
155118
|
registerCodeFix({
|
|
154882
|
-
errorCodes:
|
|
155119
|
+
errorCodes: errorCodes41,
|
|
154883
155120
|
getCodeActions: (context) => {
|
|
154884
155121
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
154885
155122
|
if (!importDeclaration)
|
|
@@ -154934,7 +155171,7 @@ var fixIdPrefix = "unusedIdentifier_prefix";
|
|
|
154934
155171
|
var fixIdDelete = "unusedIdentifier_delete";
|
|
154935
155172
|
var fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
154936
155173
|
var fixIdInfer = "unusedIdentifier_infer";
|
|
154937
|
-
var
|
|
155174
|
+
var errorCodes42 = [
|
|
154938
155175
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
154939
155176
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
154940
155177
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -154944,7 +155181,7 @@ var errorCodes41 = [
|
|
|
154944
155181
|
Diagnostics.All_type_parameters_are_unused.code
|
|
154945
155182
|
];
|
|
154946
155183
|
registerCodeFix({
|
|
154947
|
-
errorCodes:
|
|
155184
|
+
errorCodes: errorCodes42,
|
|
154948
155185
|
getCodeActions(context) {
|
|
154949
155186
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
154950
155187
|
const checker = program.getTypeChecker();
|
|
@@ -155030,7 +155267,7 @@ registerCodeFix({
|
|
|
155030
155267
|
const { sourceFile, program, cancellationToken } = context;
|
|
155031
155268
|
const checker = program.getTypeChecker();
|
|
155032
155269
|
const sourceFiles = program.getSourceFiles();
|
|
155033
|
-
return codeFixAll(context,
|
|
155270
|
+
return codeFixAll(context, errorCodes42, (changes, diag2) => {
|
|
155034
155271
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
155035
155272
|
switch (context.fixId) {
|
|
155036
155273
|
case fixIdPrefix:
|
|
@@ -155266,20 +155503,20 @@ function mayDeleteExpression(node) {
|
|
|
155266
155503
|
|
|
155267
155504
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
155268
155505
|
var fixId33 = "fixUnreachableCode";
|
|
155269
|
-
var
|
|
155506
|
+
var errorCodes43 = [Diagnostics.Unreachable_code_detected.code];
|
|
155270
155507
|
registerCodeFix({
|
|
155271
|
-
errorCodes:
|
|
155508
|
+
errorCodes: errorCodes43,
|
|
155272
155509
|
getCodeActions(context) {
|
|
155273
155510
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
155274
155511
|
if (syntacticDiagnostics.length)
|
|
155275
155512
|
return;
|
|
155276
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155513
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
155277
155514
|
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
155278
155515
|
},
|
|
155279
155516
|
fixIds: [fixId33],
|
|
155280
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155517
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange27(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
155281
155518
|
});
|
|
155282
|
-
function
|
|
155519
|
+
function doChange27(changes, sourceFile, start2, length2, errorCode) {
|
|
155283
155520
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
155284
155521
|
const statement = findAncestor(token, isStatement);
|
|
155285
155522
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -155330,17 +155567,17 @@ function lastWhere(a, pred) {
|
|
|
155330
155567
|
|
|
155331
155568
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
155332
155569
|
var fixId34 = "fixUnusedLabel";
|
|
155333
|
-
var
|
|
155570
|
+
var errorCodes44 = [Diagnostics.Unused_label.code];
|
|
155334
155571
|
registerCodeFix({
|
|
155335
|
-
errorCodes:
|
|
155572
|
+
errorCodes: errorCodes44,
|
|
155336
155573
|
getCodeActions(context) {
|
|
155337
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155574
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, context.sourceFile, context.span.start));
|
|
155338
155575
|
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
155339
155576
|
},
|
|
155340
155577
|
fixIds: [fixId34],
|
|
155341
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155578
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => doChange28(changes, diag2.file, diag2.start))
|
|
155342
155579
|
});
|
|
155343
|
-
function
|
|
155580
|
+
function doChange28(changes, sourceFile, start2) {
|
|
155344
155581
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
155345
155582
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
155346
155583
|
const pos = token.getStart(sourceFile);
|
|
@@ -155357,17 +155594,17 @@ function doChange27(changes, sourceFile, start2) {
|
|
|
155357
155594
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
155358
155595
|
var fixIdPlain = "fixJSDocTypes_plain";
|
|
155359
155596
|
var fixIdNullable = "fixJSDocTypes_nullable";
|
|
155360
|
-
var
|
|
155597
|
+
var errorCodes45 = [
|
|
155361
155598
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
155362
155599
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
155363
155600
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
155364
155601
|
];
|
|
155365
155602
|
registerCodeFix({
|
|
155366
|
-
errorCodes:
|
|
155603
|
+
errorCodes: errorCodes45,
|
|
155367
155604
|
getCodeActions(context) {
|
|
155368
155605
|
const { sourceFile } = context;
|
|
155369
155606
|
const checker = context.program.getTypeChecker();
|
|
155370
|
-
const info =
|
|
155607
|
+
const info = getInfo15(sourceFile, context.span.start, checker);
|
|
155371
155608
|
if (!info)
|
|
155372
155609
|
return void 0;
|
|
155373
155610
|
const { typeNode, type } = info;
|
|
@@ -155378,7 +155615,7 @@ registerCodeFix({
|
|
|
155378
155615
|
}
|
|
155379
155616
|
return actions2;
|
|
155380
155617
|
function fix(type2, fixId52, fixAllDescription) {
|
|
155381
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155618
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
|
|
155382
155619
|
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
155383
155620
|
}
|
|
155384
155621
|
},
|
|
@@ -155386,17 +155623,17 @@ registerCodeFix({
|
|
|
155386
155623
|
getAllCodeActions(context) {
|
|
155387
155624
|
const { fixId: fixId52, program, sourceFile } = context;
|
|
155388
155625
|
const checker = program.getTypeChecker();
|
|
155389
|
-
return codeFixAll(context,
|
|
155390
|
-
const info =
|
|
155626
|
+
return codeFixAll(context, errorCodes45, (changes, err) => {
|
|
155627
|
+
const info = getInfo15(err.file, err.start, checker);
|
|
155391
155628
|
if (!info)
|
|
155392
155629
|
return;
|
|
155393
155630
|
const { typeNode, type } = info;
|
|
155394
155631
|
const fixedType = typeNode.kind === 321 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
155395
|
-
|
|
155632
|
+
doChange29(changes, sourceFile, typeNode, fixedType, checker);
|
|
155396
155633
|
});
|
|
155397
155634
|
}
|
|
155398
155635
|
});
|
|
155399
|
-
function
|
|
155636
|
+
function doChange29(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
155400
155637
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
155401
155638
|
newType,
|
|
155402
155639
|
/*enclosingDeclaration*/
|
|
@@ -155405,7 +155642,7 @@ function doChange28(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
|
155405
155642
|
void 0
|
|
155406
155643
|
));
|
|
155407
155644
|
}
|
|
155408
|
-
function
|
|
155645
|
+
function getInfo15(sourceFile, pos, checker) {
|
|
155409
155646
|
const decl = findAncestor(getTokenAtPosition(sourceFile, pos), isTypeContainer);
|
|
155410
155647
|
const typeNode = decl && decl.type;
|
|
155411
155648
|
return typeNode && { typeNode, type: getType(checker, typeNode) };
|
|
@@ -155448,27 +155685,27 @@ function getType(checker, node) {
|
|
|
155448
155685
|
|
|
155449
155686
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
155450
155687
|
var fixId35 = "fixMissingCallParentheses";
|
|
155451
|
-
var
|
|
155688
|
+
var errorCodes46 = [
|
|
155452
155689
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
155453
155690
|
];
|
|
155454
155691
|
registerCodeFix({
|
|
155455
|
-
errorCodes:
|
|
155692
|
+
errorCodes: errorCodes46,
|
|
155456
155693
|
fixIds: [fixId35],
|
|
155457
155694
|
getCodeActions(context) {
|
|
155458
155695
|
const { sourceFile, span } = context;
|
|
155459
155696
|
const callName = getCallName(sourceFile, span.start);
|
|
155460
155697
|
if (!callName)
|
|
155461
155698
|
return;
|
|
155462
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155699
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, context.sourceFile, callName));
|
|
155463
155700
|
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
155464
155701
|
},
|
|
155465
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155702
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
155466
155703
|
const callName = getCallName(diag2.file, diag2.start);
|
|
155467
155704
|
if (callName)
|
|
155468
|
-
|
|
155705
|
+
doChange30(changes, diag2.file, callName);
|
|
155469
155706
|
})
|
|
155470
155707
|
});
|
|
155471
|
-
function
|
|
155708
|
+
function doChange30(changes, sourceFile, name) {
|
|
155472
155709
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
155473
155710
|
}
|
|
155474
155711
|
function getCallName(sourceFile, start2) {
|
|
@@ -155488,30 +155725,30 @@ function getCallName(sourceFile, start2) {
|
|
|
155488
155725
|
|
|
155489
155726
|
// src/services/codefixes/fixAwaitInSyncFunction.ts
|
|
155490
155727
|
var fixId36 = "fixAwaitInSyncFunction";
|
|
155491
|
-
var
|
|
155728
|
+
var errorCodes47 = [
|
|
155492
155729
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
155493
155730
|
Diagnostics.await_using_statements_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
155494
155731
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
155495
155732
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
155496
155733
|
];
|
|
155497
155734
|
registerCodeFix({
|
|
155498
|
-
errorCodes:
|
|
155735
|
+
errorCodes: errorCodes47,
|
|
155499
155736
|
getCodeActions(context) {
|
|
155500
155737
|
const { sourceFile, span } = context;
|
|
155501
155738
|
const nodes = getNodes3(sourceFile, span.start);
|
|
155502
155739
|
if (!nodes)
|
|
155503
155740
|
return void 0;
|
|
155504
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
155741
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, nodes));
|
|
155505
155742
|
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
155506
155743
|
},
|
|
155507
155744
|
fixIds: [fixId36],
|
|
155508
155745
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
155509
155746
|
const seen = /* @__PURE__ */ new Map();
|
|
155510
|
-
return codeFixAll(context,
|
|
155747
|
+
return codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
155511
155748
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
155512
155749
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
155513
155750
|
return;
|
|
155514
|
-
|
|
155751
|
+
doChange31(changes, context.sourceFile, nodes);
|
|
155515
155752
|
});
|
|
155516
155753
|
}
|
|
155517
155754
|
});
|
|
@@ -155550,7 +155787,7 @@ function getNodes3(sourceFile, start2) {
|
|
|
155550
155787
|
returnType: getReturnType(containingFunction)
|
|
155551
155788
|
};
|
|
155552
155789
|
}
|
|
155553
|
-
function
|
|
155790
|
+
function doChange31(changes, sourceFile, { insertBefore, returnType }) {
|
|
155554
155791
|
if (returnType) {
|
|
155555
155792
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
155556
155793
|
if (!entityName || entityName.kind !== 80 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -155561,22 +155798,22 @@ function doChange30(changes, sourceFile, { insertBefore, returnType }) {
|
|
|
155561
155798
|
}
|
|
155562
155799
|
|
|
155563
155800
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
155564
|
-
var
|
|
155801
|
+
var errorCodes48 = [
|
|
155565
155802
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
155566
155803
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
155567
155804
|
];
|
|
155568
155805
|
var fixId37 = "fixPropertyOverrideAccessor";
|
|
155569
155806
|
registerCodeFix({
|
|
155570
|
-
errorCodes:
|
|
155807
|
+
errorCodes: errorCodes48,
|
|
155571
155808
|
getCodeActions(context) {
|
|
155572
|
-
const edits =
|
|
155809
|
+
const edits = doChange32(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
155573
155810
|
if (edits) {
|
|
155574
155811
|
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
155575
155812
|
}
|
|
155576
155813
|
},
|
|
155577
155814
|
fixIds: [fixId37],
|
|
155578
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
155579
|
-
const edits =
|
|
155815
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
155816
|
+
const edits = doChange32(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
155580
155817
|
if (edits) {
|
|
155581
155818
|
for (const edit of edits) {
|
|
155582
155819
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -155584,7 +155821,7 @@ registerCodeFix({
|
|
|
155584
155821
|
}
|
|
155585
155822
|
})
|
|
155586
155823
|
});
|
|
155587
|
-
function
|
|
155824
|
+
function doChange32(file, start2, length2, code, context) {
|
|
155588
155825
|
let startPosition;
|
|
155589
155826
|
let endPosition;
|
|
155590
155827
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -155614,7 +155851,7 @@ function doChange31(file, start2, length2, code, context) {
|
|
|
155614
155851
|
|
|
155615
155852
|
// src/services/codefixes/inferFromUsage.ts
|
|
155616
155853
|
var fixId38 = "inferFromUsage";
|
|
155617
|
-
var
|
|
155854
|
+
var errorCodes49 = [
|
|
155618
155855
|
// Variable declarations
|
|
155619
155856
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
155620
155857
|
// Variable uses
|
|
@@ -155648,13 +155885,13 @@ var errorCodes48 = [
|
|
|
155648
155885
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
155649
155886
|
];
|
|
155650
155887
|
registerCodeFix({
|
|
155651
|
-
errorCodes:
|
|
155888
|
+
errorCodes: errorCodes49,
|
|
155652
155889
|
getCodeActions(context) {
|
|
155653
155890
|
const { sourceFile, program, span: { start: start2 }, errorCode, cancellationToken, host, preferences } = context;
|
|
155654
155891
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
155655
155892
|
let declaration;
|
|
155656
155893
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
155657
|
-
declaration =
|
|
155894
|
+
declaration = doChange33(
|
|
155658
155895
|
changes2,
|
|
155659
155896
|
sourceFile,
|
|
155660
155897
|
token,
|
|
@@ -155674,8 +155911,8 @@ registerCodeFix({
|
|
|
155674
155911
|
getAllCodeActions(context) {
|
|
155675
155912
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
155676
155913
|
const markSeen = nodeSeenTracker();
|
|
155677
|
-
return codeFixAll(context,
|
|
155678
|
-
|
|
155914
|
+
return codeFixAll(context, errorCodes49, (changes, err) => {
|
|
155915
|
+
doChange33(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
155679
155916
|
});
|
|
155680
155917
|
}
|
|
155681
155918
|
});
|
|
@@ -155714,7 +155951,7 @@ function mapSuggestionDiagnostic(errorCode) {
|
|
|
155714
155951
|
}
|
|
155715
155952
|
return errorCode;
|
|
155716
155953
|
}
|
|
155717
|
-
function
|
|
155954
|
+
function doChange33(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
155718
155955
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 80 /* Identifier */ && token.kind !== 26 /* DotDotDotToken */ && token.kind !== 110 /* ThisKeyword */) {
|
|
155719
155956
|
return void 0;
|
|
155720
155957
|
}
|
|
@@ -156614,21 +156851,21 @@ function inferTypeFromReferences(program, references, cancellationToken) {
|
|
|
156614
156851
|
|
|
156615
156852
|
// src/services/codefixes/fixReturnTypeInAsyncFunction.ts
|
|
156616
156853
|
var fixId39 = "fixReturnTypeInAsyncFunction";
|
|
156617
|
-
var
|
|
156854
|
+
var errorCodes50 = [
|
|
156618
156855
|
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
|
|
156619
156856
|
];
|
|
156620
156857
|
registerCodeFix({
|
|
156621
|
-
errorCodes:
|
|
156858
|
+
errorCodes: errorCodes50,
|
|
156622
156859
|
fixIds: [fixId39],
|
|
156623
156860
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
156624
156861
|
const { sourceFile, program, span } = context;
|
|
156625
156862
|
const checker = program.getTypeChecker();
|
|
156626
|
-
const info =
|
|
156863
|
+
const info = getInfo16(sourceFile, program.getTypeChecker(), span.start);
|
|
156627
156864
|
if (!info) {
|
|
156628
156865
|
return void 0;
|
|
156629
156866
|
}
|
|
156630
156867
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
156631
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156868
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
156632
156869
|
return [createCodeFixAction(
|
|
156633
156870
|
fixId39,
|
|
156634
156871
|
changes,
|
|
@@ -156637,14 +156874,14 @@ registerCodeFix({
|
|
|
156637
156874
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
156638
156875
|
)];
|
|
156639
156876
|
},
|
|
156640
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
156641
|
-
const info =
|
|
156877
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
156878
|
+
const info = getInfo16(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
156642
156879
|
if (info) {
|
|
156643
|
-
|
|
156880
|
+
doChange34(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
156644
156881
|
}
|
|
156645
156882
|
})
|
|
156646
156883
|
});
|
|
156647
|
-
function
|
|
156884
|
+
function getInfo16(sourceFile, checker, pos) {
|
|
156648
156885
|
if (isInJSFile(sourceFile)) {
|
|
156649
156886
|
return void 0;
|
|
156650
156887
|
}
|
|
@@ -156667,19 +156904,19 @@ function getInfo15(sourceFile, checker, pos) {
|
|
|
156667
156904
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
156668
156905
|
}
|
|
156669
156906
|
}
|
|
156670
|
-
function
|
|
156907
|
+
function doChange34(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
156671
156908
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
156672
156909
|
}
|
|
156673
156910
|
|
|
156674
156911
|
// src/services/codefixes/disableJsDiagnostics.ts
|
|
156675
156912
|
var fixName4 = "disableJsDiagnostics";
|
|
156676
156913
|
var fixId40 = "disableJsDiagnostics";
|
|
156677
|
-
var
|
|
156914
|
+
var errorCodes51 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
156678
156915
|
const diag2 = Diagnostics[key];
|
|
156679
156916
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
156680
156917
|
});
|
|
156681
156918
|
registerCodeFix({
|
|
156682
|
-
errorCodes:
|
|
156919
|
+
errorCodes: errorCodes51,
|
|
156683
156920
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
156684
156921
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
156685
156922
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -156707,7 +156944,7 @@ registerCodeFix({
|
|
|
156707
156944
|
fixIds: [fixId40],
|
|
156708
156945
|
getAllCodeActions: (context) => {
|
|
156709
156946
|
const seenLines = /* @__PURE__ */ new Set();
|
|
156710
|
-
return codeFixAll(context,
|
|
156947
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
156711
156948
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
156712
156949
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
156713
156950
|
}
|
|
@@ -157706,11 +157943,11 @@ var fixName6 = "strictClassInitialization";
|
|
|
157706
157943
|
var fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
157707
157944
|
var fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
157708
157945
|
var fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
157709
|
-
var
|
|
157946
|
+
var errorCodes52 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
157710
157947
|
registerCodeFix({
|
|
157711
|
-
errorCodes:
|
|
157948
|
+
errorCodes: errorCodes52,
|
|
157712
157949
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
157713
|
-
const info =
|
|
157950
|
+
const info = getInfo17(context.sourceFile, context.span.start);
|
|
157714
157951
|
if (!info)
|
|
157715
157952
|
return;
|
|
157716
157953
|
const result = [];
|
|
@@ -157721,8 +157958,8 @@ registerCodeFix({
|
|
|
157721
157958
|
},
|
|
157722
157959
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
157723
157960
|
getAllCodeActions: (context) => {
|
|
157724
|
-
return codeFixAll(context,
|
|
157725
|
-
const info =
|
|
157961
|
+
return codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
157962
|
+
const info = getInfo17(diag2.file, diag2.start);
|
|
157726
157963
|
if (!info)
|
|
157727
157964
|
return;
|
|
157728
157965
|
switch (context.fixId) {
|
|
@@ -157745,7 +157982,7 @@ registerCodeFix({
|
|
|
157745
157982
|
});
|
|
157746
157983
|
}
|
|
157747
157984
|
});
|
|
157748
|
-
function
|
|
157985
|
+
function getInfo17(sourceFile, pos) {
|
|
157749
157986
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
157750
157987
|
if (isIdentifier(token) && isPropertyDeclaration(token.parent)) {
|
|
157751
157988
|
const type = getEffectiveTypeAnnotationNode(token.parent);
|
|
@@ -157852,26 +158089,26 @@ function getDefaultValueFromType(checker, type) {
|
|
|
157852
158089
|
|
|
157853
158090
|
// src/services/codefixes/requireInTs.ts
|
|
157854
158091
|
var fixId41 = "requireInTs";
|
|
157855
|
-
var
|
|
158092
|
+
var errorCodes53 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
157856
158093
|
registerCodeFix({
|
|
157857
|
-
errorCodes:
|
|
158094
|
+
errorCodes: errorCodes53,
|
|
157858
158095
|
getCodeActions(context) {
|
|
157859
|
-
const info =
|
|
158096
|
+
const info = getInfo18(context.sourceFile, context.program, context.span.start);
|
|
157860
158097
|
if (!info) {
|
|
157861
158098
|
return void 0;
|
|
157862
158099
|
}
|
|
157863
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158100
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(t, context.sourceFile, info));
|
|
157864
158101
|
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
157865
158102
|
},
|
|
157866
158103
|
fixIds: [fixId41],
|
|
157867
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157868
|
-
const info =
|
|
158104
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
158105
|
+
const info = getInfo18(diag2.file, context.program, diag2.start);
|
|
157869
158106
|
if (info) {
|
|
157870
|
-
|
|
158107
|
+
doChange35(changes, context.sourceFile, info);
|
|
157871
158108
|
}
|
|
157872
158109
|
})
|
|
157873
158110
|
});
|
|
157874
|
-
function
|
|
158111
|
+
function doChange35(changes, sourceFile, info) {
|
|
157875
158112
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
157876
158113
|
changes.replaceNode(
|
|
157877
158114
|
sourceFile,
|
|
@@ -157898,7 +158135,7 @@ function doChange34(changes, sourceFile, info) {
|
|
|
157898
158135
|
)
|
|
157899
158136
|
);
|
|
157900
158137
|
}
|
|
157901
|
-
function
|
|
158138
|
+
function getInfo18(sourceFile, program, pos) {
|
|
157902
158139
|
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
157903
158140
|
if (!isRequireCall(
|
|
157904
158141
|
parent2,
|
|
@@ -157940,25 +158177,25 @@ function tryCreateNamedImportsFromObjectBindingPattern(node) {
|
|
|
157940
158177
|
|
|
157941
158178
|
// src/services/codefixes/useDefaultImport.ts
|
|
157942
158179
|
var fixId42 = "useDefaultImport";
|
|
157943
|
-
var
|
|
158180
|
+
var errorCodes54 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
157944
158181
|
registerCodeFix({
|
|
157945
|
-
errorCodes:
|
|
158182
|
+
errorCodes: errorCodes54,
|
|
157946
158183
|
getCodeActions(context) {
|
|
157947
158184
|
const { sourceFile, span: { start: start2 } } = context;
|
|
157948
|
-
const info =
|
|
158185
|
+
const info = getInfo19(sourceFile, start2);
|
|
157949
158186
|
if (!info)
|
|
157950
158187
|
return void 0;
|
|
157951
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158188
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(t, sourceFile, info, context.preferences));
|
|
157952
158189
|
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
157953
158190
|
},
|
|
157954
158191
|
fixIds: [fixId42],
|
|
157955
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
157956
|
-
const info =
|
|
158192
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => {
|
|
158193
|
+
const info = getInfo19(diag2.file, diag2.start);
|
|
157957
158194
|
if (info)
|
|
157958
|
-
|
|
158195
|
+
doChange36(changes, diag2.file, info, context.preferences);
|
|
157959
158196
|
})
|
|
157960
158197
|
});
|
|
157961
|
-
function
|
|
158198
|
+
function getInfo19(sourceFile, pos) {
|
|
157962
158199
|
const name = getTokenAtPosition(sourceFile, pos);
|
|
157963
158200
|
if (!isIdentifier(name))
|
|
157964
158201
|
return void 0;
|
|
@@ -157970,7 +158207,7 @@ function getInfo18(sourceFile, pos) {
|
|
|
157970
158207
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
157971
158208
|
}
|
|
157972
158209
|
}
|
|
157973
|
-
function
|
|
158210
|
+
function doChange36(changes, sourceFile, info, preferences) {
|
|
157974
158211
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
157975
158212
|
info.name,
|
|
157976
158213
|
/*namedImports*/
|
|
@@ -157982,11 +158219,11 @@ function doChange35(changes, sourceFile, info, preferences) {
|
|
|
157982
158219
|
|
|
157983
158220
|
// src/services/codefixes/useBigintLiteral.ts
|
|
157984
158221
|
var fixId43 = "useBigintLiteral";
|
|
157985
|
-
var
|
|
158222
|
+
var errorCodes55 = [
|
|
157986
158223
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
157987
158224
|
];
|
|
157988
158225
|
registerCodeFix({
|
|
157989
|
-
errorCodes:
|
|
158226
|
+
errorCodes: errorCodes55,
|
|
157990
158227
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
157991
158228
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
157992
158229
|
if (changes.length > 0) {
|
|
@@ -157995,7 +158232,7 @@ registerCodeFix({
|
|
|
157995
158232
|
},
|
|
157996
158233
|
fixIds: [fixId43],
|
|
157997
158234
|
getAllCodeActions: (context) => {
|
|
157998
|
-
return codeFixAll(context,
|
|
158235
|
+
return codeFixAll(context, errorCodes55, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
157999
158236
|
}
|
|
158000
158237
|
});
|
|
158001
158238
|
function makeChange9(changeTracker, sourceFile, span) {
|
|
@@ -158010,17 +158247,17 @@ function makeChange9(changeTracker, sourceFile, span) {
|
|
|
158010
158247
|
// src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts
|
|
158011
158248
|
var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
158012
158249
|
var fixId44 = fixIdAddMissingTypeof;
|
|
158013
|
-
var
|
|
158250
|
+
var errorCodes56 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
158014
158251
|
registerCodeFix({
|
|
158015
|
-
errorCodes:
|
|
158252
|
+
errorCodes: errorCodes56,
|
|
158016
158253
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
158017
158254
|
const { sourceFile, span } = context;
|
|
158018
158255
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
158019
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158256
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(t, sourceFile, importType));
|
|
158020
158257
|
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
158021
158258
|
},
|
|
158022
158259
|
fixIds: [fixId44],
|
|
158023
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158260
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => doChange37(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
158024
158261
|
});
|
|
158025
158262
|
function getImportTypeNode(sourceFile, pos) {
|
|
158026
158263
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -158028,7 +158265,7 @@ function getImportTypeNode(sourceFile, pos) {
|
|
|
158028
158265
|
Debug.assert(token.parent.kind === 205 /* ImportType */, "Token parent should be an ImportType");
|
|
158029
158266
|
return token.parent;
|
|
158030
158267
|
}
|
|
158031
|
-
function
|
|
158268
|
+
function doChange37(changes, sourceFile, importType) {
|
|
158032
158269
|
const newTypeNode = factory.updateImportTypeNode(
|
|
158033
158270
|
importType,
|
|
158034
158271
|
importType.argument,
|
|
@@ -158043,23 +158280,23 @@ function doChange36(changes, sourceFile, importType) {
|
|
|
158043
158280
|
|
|
158044
158281
|
// src/services/codefixes/wrapJsxInFragment.ts
|
|
158045
158282
|
var fixID2 = "wrapJsxInFragment";
|
|
158046
|
-
var
|
|
158283
|
+
var errorCodes57 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
158047
158284
|
registerCodeFix({
|
|
158048
|
-
errorCodes:
|
|
158285
|
+
errorCodes: errorCodes57,
|
|
158049
158286
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
158050
158287
|
const { sourceFile, span } = context;
|
|
158051
158288
|
const node = findNodeToFix(sourceFile, span.start);
|
|
158052
158289
|
if (!node)
|
|
158053
158290
|
return void 0;
|
|
158054
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158291
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(t, sourceFile, node));
|
|
158055
158292
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
158056
158293
|
},
|
|
158057
158294
|
fixIds: [fixID2],
|
|
158058
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158295
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
158059
158296
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
158060
158297
|
if (!node)
|
|
158061
158298
|
return void 0;
|
|
158062
|
-
|
|
158299
|
+
doChange38(changes, context.sourceFile, node);
|
|
158063
158300
|
})
|
|
158064
158301
|
});
|
|
158065
158302
|
function findNodeToFix(sourceFile, pos) {
|
|
@@ -158075,7 +158312,7 @@ function findNodeToFix(sourceFile, pos) {
|
|
|
158075
158312
|
return void 0;
|
|
158076
158313
|
return binaryExpr;
|
|
158077
158314
|
}
|
|
158078
|
-
function
|
|
158315
|
+
function doChange38(changeTracker, sf, node) {
|
|
158079
158316
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
158080
158317
|
if (jsx)
|
|
158081
158318
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -158101,26 +158338,26 @@ function flattenInvalidBinaryExpr(node) {
|
|
|
158101
158338
|
|
|
158102
158339
|
// src/services/codefixes/convertToMappedObjectType.ts
|
|
158103
158340
|
var fixId45 = "fixConvertToMappedObjectType";
|
|
158104
|
-
var
|
|
158341
|
+
var errorCodes58 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
158105
158342
|
registerCodeFix({
|
|
158106
|
-
errorCodes:
|
|
158343
|
+
errorCodes: errorCodes58,
|
|
158107
158344
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
158108
158345
|
const { sourceFile, span } = context;
|
|
158109
|
-
const info =
|
|
158346
|
+
const info = getInfo20(sourceFile, span.start);
|
|
158110
158347
|
if (!info)
|
|
158111
158348
|
return void 0;
|
|
158112
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158349
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(t, sourceFile, info));
|
|
158113
158350
|
const name = idText(info.container.name);
|
|
158114
158351
|
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
158115
158352
|
},
|
|
158116
158353
|
fixIds: [fixId45],
|
|
158117
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158118
|
-
const info =
|
|
158354
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes58, (changes, diag2) => {
|
|
158355
|
+
const info = getInfo20(diag2.file, diag2.start);
|
|
158119
158356
|
if (info)
|
|
158120
|
-
|
|
158357
|
+
doChange39(changes, diag2.file, info);
|
|
158121
158358
|
})
|
|
158122
158359
|
});
|
|
158123
|
-
function
|
|
158360
|
+
function getInfo20(sourceFile, pos) {
|
|
158124
158361
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
158125
158362
|
const indexSignature = tryCast(token.parent.parent, isIndexSignatureDeclaration);
|
|
158126
158363
|
if (!indexSignature)
|
|
@@ -158133,7 +158370,7 @@ function getInfo19(sourceFile, pos) {
|
|
|
158133
158370
|
function createTypeAliasFromInterface(declaration, type) {
|
|
158134
158371
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
158135
158372
|
}
|
|
158136
|
-
function
|
|
158373
|
+
function doChange39(changes, sourceFile, { indexSignature, container }) {
|
|
158137
158374
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
158138
158375
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
158139
158376
|
const parameter = first(indexSignature.parameters);
|
|
@@ -158163,11 +158400,11 @@ function doChange38(changes, sourceFile, { indexSignature, container }) {
|
|
|
158163
158400
|
|
|
158164
158401
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
158165
158402
|
var fixId46 = "removeAccidentalCallParentheses";
|
|
158166
|
-
var
|
|
158403
|
+
var errorCodes59 = [
|
|
158167
158404
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
158168
158405
|
];
|
|
158169
158406
|
registerCodeFix({
|
|
158170
|
-
errorCodes:
|
|
158407
|
+
errorCodes: errorCodes59,
|
|
158171
158408
|
getCodeActions(context) {
|
|
158172
158409
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
158173
158410
|
if (!callExpression) {
|
|
@@ -158183,11 +158420,11 @@ registerCodeFix({
|
|
|
158183
158420
|
|
|
158184
158421
|
// src/services/codefixes/removeUnnecessaryAwait.ts
|
|
158185
158422
|
var fixId47 = "removeUnnecessaryAwait";
|
|
158186
|
-
var
|
|
158423
|
+
var errorCodes60 = [
|
|
158187
158424
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
158188
158425
|
];
|
|
158189
158426
|
registerCodeFix({
|
|
158190
|
-
errorCodes:
|
|
158427
|
+
errorCodes: errorCodes60,
|
|
158191
158428
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
158192
158429
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
158193
158430
|
if (changes.length > 0) {
|
|
@@ -158196,7 +158433,7 @@ registerCodeFix({
|
|
|
158196
158433
|
},
|
|
158197
158434
|
fixIds: [fixId47],
|
|
158198
158435
|
getAllCodeActions: (context) => {
|
|
158199
|
-
return codeFixAll(context,
|
|
158436
|
+
return codeFixAll(context, errorCodes60, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
158200
158437
|
}
|
|
158201
158438
|
});
|
|
158202
158439
|
function makeChange10(changeTracker, sourceFile, span) {
|
|
@@ -158224,10 +158461,10 @@ function makeChange10(changeTracker, sourceFile, span) {
|
|
|
158224
158461
|
}
|
|
158225
158462
|
|
|
158226
158463
|
// src/services/codefixes/splitTypeOnlyImport.ts
|
|
158227
|
-
var
|
|
158464
|
+
var errorCodes61 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
158228
158465
|
var fixId48 = "splitTypeOnlyImport";
|
|
158229
158466
|
registerCodeFix({
|
|
158230
|
-
errorCodes:
|
|
158467
|
+
errorCodes: errorCodes61,
|
|
158231
158468
|
fixIds: [fixId48],
|
|
158232
158469
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
158233
158470
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
@@ -158237,7 +158474,7 @@ registerCodeFix({
|
|
|
158237
158474
|
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
158238
158475
|
}
|
|
158239
158476
|
},
|
|
158240
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158477
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, error2) => {
|
|
158241
158478
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error2), context);
|
|
158242
158479
|
})
|
|
158243
158480
|
});
|
|
@@ -158287,26 +158524,26 @@ function splitTypeOnlyImport(changes, importDeclaration, context) {
|
|
|
158287
158524
|
|
|
158288
158525
|
// src/services/codefixes/convertConstToLet.ts
|
|
158289
158526
|
var fixId49 = "fixConvertConstToLet";
|
|
158290
|
-
var
|
|
158527
|
+
var errorCodes62 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
158291
158528
|
registerCodeFix({
|
|
158292
|
-
errorCodes:
|
|
158529
|
+
errorCodes: errorCodes62,
|
|
158293
158530
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
158294
158531
|
const { sourceFile, span, program } = context;
|
|
158295
|
-
const info =
|
|
158532
|
+
const info = getInfo21(sourceFile, span.start, program);
|
|
158296
158533
|
if (info === void 0)
|
|
158297
158534
|
return;
|
|
158298
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158535
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange40(t, sourceFile, info.token));
|
|
158299
158536
|
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
158300
158537
|
},
|
|
158301
158538
|
getAllCodeActions: (context) => {
|
|
158302
158539
|
const { program } = context;
|
|
158303
158540
|
const seen = /* @__PURE__ */ new Map();
|
|
158304
158541
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
158305
|
-
eachDiagnostic(context,
|
|
158306
|
-
const info =
|
|
158542
|
+
eachDiagnostic(context, errorCodes62, (diag2) => {
|
|
158543
|
+
const info = getInfo21(diag2.file, diag2.start, program);
|
|
158307
158544
|
if (info) {
|
|
158308
158545
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
158309
|
-
return
|
|
158546
|
+
return doChange40(changes, diag2.file, info.token);
|
|
158310
158547
|
}
|
|
158311
158548
|
}
|
|
158312
158549
|
return void 0;
|
|
@@ -158315,7 +158552,7 @@ registerCodeFix({
|
|
|
158315
158552
|
},
|
|
158316
158553
|
fixIds: [fixId49]
|
|
158317
158554
|
});
|
|
158318
|
-
function
|
|
158555
|
+
function getInfo21(sourceFile, pos, program) {
|
|
158319
158556
|
var _a;
|
|
158320
158557
|
const checker = program.getTypeChecker();
|
|
158321
158558
|
const symbol = checker.getSymbolAtLocation(getTokenAtPosition(sourceFile, pos));
|
|
@@ -158329,22 +158566,22 @@ function getInfo20(sourceFile, pos, program) {
|
|
|
158329
158566
|
return;
|
|
158330
158567
|
return { symbol, token: constToken };
|
|
158331
158568
|
}
|
|
158332
|
-
function
|
|
158569
|
+
function doChange40(changes, sourceFile, token) {
|
|
158333
158570
|
changes.replaceNode(sourceFile, token, factory.createToken(121 /* LetKeyword */));
|
|
158334
158571
|
}
|
|
158335
158572
|
|
|
158336
158573
|
// src/services/codefixes/fixExpectedComma.ts
|
|
158337
158574
|
var fixId50 = "fixExpectedComma";
|
|
158338
158575
|
var expectedErrorCode = Diagnostics._0_expected.code;
|
|
158339
|
-
var
|
|
158576
|
+
var errorCodes63 = [expectedErrorCode];
|
|
158340
158577
|
registerCodeFix({
|
|
158341
|
-
errorCodes:
|
|
158578
|
+
errorCodes: errorCodes63,
|
|
158342
158579
|
getCodeActions(context) {
|
|
158343
158580
|
const { sourceFile } = context;
|
|
158344
|
-
const info =
|
|
158581
|
+
const info = getInfo22(sourceFile, context.span.start, context.errorCode);
|
|
158345
158582
|
if (!info)
|
|
158346
158583
|
return void 0;
|
|
158347
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158584
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange41(t, sourceFile, info));
|
|
158348
158585
|
return [createCodeFixAction(
|
|
158349
158586
|
fixId50,
|
|
158350
158587
|
changes,
|
|
@@ -158354,17 +158591,17 @@ registerCodeFix({
|
|
|
158354
158591
|
)];
|
|
158355
158592
|
},
|
|
158356
158593
|
fixIds: [fixId50],
|
|
158357
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
158358
|
-
const info =
|
|
158594
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes63, (changes, diag2) => {
|
|
158595
|
+
const info = getInfo22(diag2.file, diag2.start, diag2.code);
|
|
158359
158596
|
if (info)
|
|
158360
|
-
|
|
158597
|
+
doChange41(changes, context.sourceFile, info);
|
|
158361
158598
|
})
|
|
158362
158599
|
});
|
|
158363
|
-
function
|
|
158600
|
+
function getInfo22(sourceFile, pos, _) {
|
|
158364
158601
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
158365
158602
|
return node.kind === 27 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
158366
158603
|
}
|
|
158367
|
-
function
|
|
158604
|
+
function doChange41(changes, sourceFile, { node }) {
|
|
158368
158605
|
const newNode = factory.createToken(28 /* CommaToken */);
|
|
158369
158606
|
changes.replaceNode(sourceFile, node, newNode);
|
|
158370
158607
|
}
|
|
@@ -158372,12 +158609,12 @@ function doChange40(changes, sourceFile, { node }) {
|
|
|
158372
158609
|
// src/services/codefixes/fixAddVoidToPromise.ts
|
|
158373
158610
|
var fixName7 = "addVoidToPromise";
|
|
158374
158611
|
var fixId51 = "addVoidToPromise";
|
|
158375
|
-
var
|
|
158612
|
+
var errorCodes64 = [
|
|
158376
158613
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
158377
158614
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
158378
158615
|
];
|
|
158379
158616
|
registerCodeFix({
|
|
158380
|
-
errorCodes:
|
|
158617
|
+
errorCodes: errorCodes64,
|
|
158381
158618
|
fixIds: [fixId51],
|
|
158382
158619
|
getCodeActions(context) {
|
|
158383
158620
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
@@ -158386,7 +158623,7 @@ registerCodeFix({
|
|
|
158386
158623
|
}
|
|
158387
158624
|
},
|
|
158388
158625
|
getAllCodeActions(context) {
|
|
158389
|
-
return codeFixAll(context,
|
|
158626
|
+
return codeFixAll(context, errorCodes64, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
158390
158627
|
}
|
|
158391
158628
|
});
|
|
158392
158629
|
function makeChange11(changes, sourceFile, span, program, seen) {
|
|
@@ -160188,7 +160425,7 @@ function getCompletionEntryDetails(program, log, sourceFile, position, entryId,
|
|
|
160188
160425
|
const { name, source, data } = entryId;
|
|
160189
160426
|
const { previousToken, contextToken } = getRelevantTokens(position, sourceFile);
|
|
160190
160427
|
if (isInString(sourceFile, position, previousToken)) {
|
|
160191
|
-
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken,
|
|
160428
|
+
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, previousToken, program, host, cancellationToken, preferences);
|
|
160192
160429
|
}
|
|
160193
160430
|
const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
|
|
160194
160431
|
switch (symbolCompletion.type) {
|
|
@@ -160419,7 +160656,7 @@ function getFirstSymbolInChain(symbol, enclosingDeclaration, checker) {
|
|
|
160419
160656
|
symbol,
|
|
160420
160657
|
enclosingDeclaration,
|
|
160421
160658
|
/*meaning*/
|
|
160422
|
-
|
|
160659
|
+
-1 /* All */,
|
|
160423
160660
|
/*useOnlyExternalAliasing*/
|
|
160424
160661
|
false
|
|
160425
160662
|
);
|
|
@@ -162378,7 +162615,7 @@ function getStringLiteralCompletions(sourceFile, position, contextToken, options
|
|
|
162378
162615
|
if (isInString(sourceFile, position, contextToken)) {
|
|
162379
162616
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
162380
162617
|
return void 0;
|
|
162381
|
-
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program
|
|
162618
|
+
const entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences);
|
|
162382
162619
|
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences, position, includeSymbol);
|
|
162383
162620
|
}
|
|
162384
162621
|
}
|
|
@@ -162448,11 +162685,11 @@ function convertStringLiteralCompletions(completion, contextToken, sourceFile, h
|
|
|
162448
162685
|
return Debug.assertNever(completion);
|
|
162449
162686
|
}
|
|
162450
162687
|
}
|
|
162451
|
-
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken,
|
|
162688
|
+
function getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, program, host, cancellationToken, preferences) {
|
|
162452
162689
|
if (!contextToken || !isStringLiteralLike(contextToken))
|
|
162453
162690
|
return void 0;
|
|
162454
|
-
const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
162455
|
-
return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile,
|
|
162691
|
+
const completions = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program, host, preferences);
|
|
162692
|
+
return completions && stringLiteralCompletionDetails(name, contextToken, completions, sourceFile, program.getTypeChecker(), cancellationToken);
|
|
162456
162693
|
}
|
|
162457
162694
|
function stringLiteralCompletionDetails(name, location, completion, sourceFile, checker, cancellationToken) {
|
|
162458
162695
|
switch (completion.kind) {
|
|
@@ -162510,13 +162747,14 @@ function kindModifiersFromExtension(extension) {
|
|
|
162510
162747
|
return Debug.assertNever(extension);
|
|
162511
162748
|
}
|
|
162512
162749
|
}
|
|
162513
|
-
function getStringLiteralCompletionEntries(sourceFile, node, position,
|
|
162750
|
+
function getStringLiteralCompletionEntries(sourceFile, node, position, program, host, preferences) {
|
|
162751
|
+
const typeChecker = program.getTypeChecker();
|
|
162514
162752
|
const parent2 = walkUpParentheses(node.parent);
|
|
162515
162753
|
switch (parent2.kind) {
|
|
162516
162754
|
case 201 /* LiteralType */: {
|
|
162517
162755
|
const grandParent = walkUpParentheses(parent2.parent);
|
|
162518
162756
|
if (grandParent.kind === 205 /* ImportType */) {
|
|
162519
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162757
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
162520
162758
|
}
|
|
162521
162759
|
return fromUnionableLiteralType(grandParent);
|
|
162522
162760
|
}
|
|
@@ -162542,7 +162780,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
|
|
|
162542
162780
|
case 272 /* ImportDeclaration */:
|
|
162543
162781
|
case 278 /* ExportDeclaration */:
|
|
162544
162782
|
case 283 /* ExternalModuleReference */:
|
|
162545
|
-
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162783
|
+
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) };
|
|
162546
162784
|
case 296 /* CaseClause */:
|
|
162547
162785
|
const tracker = newCaseClauseTracker(typeChecker, parent2.parent.clauses);
|
|
162548
162786
|
const contextualTypes = fromContextualType();
|
|
@@ -162672,14 +162910,16 @@ function addReplacementSpans(text, textStart, names) {
|
|
|
162672
162910
|
const wholeSpan = text.length === 0 ? void 0 : createTextSpan(textStart, text.length);
|
|
162673
162911
|
return names.map(({ name, kind, extension }) => name.includes(directorySeparator) || name.includes(altDirectorySeparator) ? { name, kind, extension, span: wholeSpan } : { name, kind, extension, span });
|
|
162674
162912
|
}
|
|
162675
|
-
function getStringLiteralCompletionsFromModuleNames(sourceFile, node,
|
|
162676
|
-
return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node,
|
|
162913
|
+
function getStringLiteralCompletionsFromModuleNames(sourceFile, node, program, host, preferences) {
|
|
162914
|
+
return addReplacementSpans(node.text, node.getStart(sourceFile) + 1, getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences));
|
|
162677
162915
|
}
|
|
162678
|
-
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node,
|
|
162916
|
+
function getStringLiteralCompletionsFromModuleNamesWorker(sourceFile, node, program, host, preferences) {
|
|
162679
162917
|
const literalValue = normalizeSlashes(node.text);
|
|
162680
|
-
const mode = isStringLiteralLike(node) ? getModeForUsageLocation(sourceFile, node) : void 0;
|
|
162918
|
+
const mode = isStringLiteralLike(node) ? program.getModeForUsageLocation(sourceFile, node) : void 0;
|
|
162681
162919
|
const scriptPath = sourceFile.path;
|
|
162682
162920
|
const scriptDirectory = getDirectoryPath(scriptPath);
|
|
162921
|
+
const compilerOptions = program.getCompilerOptions();
|
|
162922
|
+
const typeChecker = program.getTypeChecker();
|
|
162683
162923
|
const extensionOptions = getExtensionOptions(compilerOptions, 1 /* ModuleSpecifier */, sourceFile, typeChecker, preferences, mode);
|
|
162684
162924
|
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);
|
|
162685
162925
|
}
|
|
@@ -163159,8 +163399,6 @@ function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDire
|
|
|
163159
163399
|
}
|
|
163160
163400
|
}
|
|
163161
163401
|
function enumerateNodeModulesVisibleToScript(host, scriptPath) {
|
|
163162
|
-
if (!host.readFile || !host.fileExists)
|
|
163163
|
-
return emptyArray;
|
|
163164
163402
|
const result = [];
|
|
163165
163403
|
for (const packageJson of findPackageJsons(scriptPath, host)) {
|
|
163166
163404
|
const contents = readJson(packageJson, host);
|
|
@@ -164286,7 +164524,7 @@ var Core;
|
|
|
164286
164524
|
if (!options.implementations && isStringLiteralLike(node)) {
|
|
164287
164525
|
if (isModuleSpecifierLike(node)) {
|
|
164288
164526
|
const fileIncludeReasons = program.getFileIncludeReasons();
|
|
164289
|
-
const referencedFileName = (_b = (_a = program.
|
|
164527
|
+
const referencedFileName = (_b = (_a = program.getResolvedModuleFromModuleSpecifier(node)) == null ? void 0 : _a.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
164290
164528
|
const referencedFile = referencedFileName ? program.getSourceFile(referencedFileName) : void 0;
|
|
164291
164529
|
if (referencedFile) {
|
|
164292
164530
|
return [{ definition: { type: 4 /* String */, node }, references: getReferencesForNonModule(referencedFile, fileIncludeReasons, program) || emptyArray }];
|
|
@@ -165791,7 +166029,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
165791
166029
|
}
|
|
165792
166030
|
}
|
|
165793
166031
|
if (!symbol && isModuleSpecifierLike(fallbackNode)) {
|
|
165794
|
-
const ref = (_a = program.
|
|
166032
|
+
const ref = (_a = program.getResolvedModuleFromModuleSpecifier(fallbackNode)) == null ? void 0 : _a.resolvedModule;
|
|
165795
166033
|
if (ref) {
|
|
165796
166034
|
return [{
|
|
165797
166035
|
name: fallbackNode.text,
|
|
@@ -165906,7 +166144,7 @@ function getReferenceAtPosition(sourceFile, position, program) {
|
|
|
165906
166144
|
if (sourceFile.imports.length || sourceFile.moduleAugmentations.length) {
|
|
165907
166145
|
const node = getTouchingToken(sourceFile, position);
|
|
165908
166146
|
let resolution;
|
|
165909
|
-
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.
|
|
166147
|
+
if (isModuleSpecifierLike(node) && isExternalModuleNameRelative(node.text) && (resolution = program.getResolvedModuleFromModuleSpecifier(node))) {
|
|
165910
166148
|
const verifiedFileName = (_b = resolution.resolvedModule) == null ? void 0 : _b.resolvedFileName;
|
|
165911
166149
|
const fileName = verifiedFileName || resolvePath(getDirectoryPath(sourceFile.fileName), node.text);
|
|
165912
166150
|
return {
|
|
@@ -175092,6 +175330,7 @@ __export(ts_exports2, {
|
|
|
175092
175330
|
getStaticPropertiesAndClassStaticBlock: () => getStaticPropertiesAndClassStaticBlock,
|
|
175093
175331
|
getStrictOptionValue: () => getStrictOptionValue,
|
|
175094
175332
|
getStringComparer: () => getStringComparer,
|
|
175333
|
+
getSubPatternFromSpec: () => getSubPatternFromSpec,
|
|
175095
175334
|
getSuperCallFromStatement: () => getSuperCallFromStatement,
|
|
175096
175335
|
getSuperContainer: () => getSuperContainer,
|
|
175097
175336
|
getSupportedCodeFixes: () => getSupportedCodeFixes,
|
|
@@ -176178,7 +176417,6 @@ __export(ts_exports2, {
|
|
|
176178
176417
|
setValueDeclaration: () => setValueDeclaration,
|
|
176179
176418
|
shouldAllowImportingTsExtension: () => shouldAllowImportingTsExtension,
|
|
176180
176419
|
shouldPreserveConstEnums: () => shouldPreserveConstEnums,
|
|
176181
|
-
shouldResolveJsRequire: () => shouldResolveJsRequire,
|
|
176182
176420
|
shouldUseUriStyleNodeCoreModules: () => shouldUseUriStyleNodeCoreModules,
|
|
176183
176421
|
showModuleSpecifier: () => showModuleSpecifier,
|
|
176184
176422
|
signatureHasLiteralTypes: () => signatureHasLiteralTypes,
|
|
@@ -176341,7 +176579,6 @@ __export(ts_exports2, {
|
|
|
176341
176579
|
typeDirectiveIsEqualTo: () => typeDirectiveIsEqualTo,
|
|
176342
176580
|
typeKeywords: () => typeKeywords,
|
|
176343
176581
|
typeParameterNamePart: () => typeParameterNamePart,
|
|
176344
|
-
typeReferenceResolutionNameAndModeGetter: () => typeReferenceResolutionNameAndModeGetter,
|
|
176345
176582
|
typeToDisplayParts: () => typeToDisplayParts,
|
|
176346
176583
|
unchangedPollThresholds: () => unchangedPollThresholds,
|
|
176347
176584
|
unchangedTextChangeRange: () => unchangedTextChangeRange,
|
|
@@ -177414,11 +177651,18 @@ var ModuleKind2 = /* @__PURE__ */ ((ModuleKind3) => {
|
|
|
177414
177651
|
ModuleKind3["ES6"] = "ES6";
|
|
177415
177652
|
ModuleKind3["ES2015"] = "ES2015";
|
|
177416
177653
|
ModuleKind3["ESNext"] = "ESNext";
|
|
177654
|
+
ModuleKind3["Node16"] = "Node16";
|
|
177655
|
+
ModuleKind3["NodeNext"] = "NodeNext";
|
|
177656
|
+
ModuleKind3["Preserve"] = "Preserve";
|
|
177417
177657
|
return ModuleKind3;
|
|
177418
177658
|
})(ModuleKind2 || {});
|
|
177419
177659
|
var ModuleResolutionKind2 = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
177420
177660
|
ModuleResolutionKind3["Classic"] = "Classic";
|
|
177421
177661
|
ModuleResolutionKind3["Node"] = "Node";
|
|
177662
|
+
ModuleResolutionKind3["Node10"] = "Node10";
|
|
177663
|
+
ModuleResolutionKind3["Node16"] = "Node16";
|
|
177664
|
+
ModuleResolutionKind3["NodeNext"] = "NodeNext";
|
|
177665
|
+
ModuleResolutionKind3["Bundler"] = "Bundler";
|
|
177422
177666
|
return ModuleResolutionKind3;
|
|
177423
177667
|
})(ModuleResolutionKind2 || {});
|
|
177424
177668
|
var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
|
|
@@ -189893,6 +190137,7 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
189893
190137
|
getStaticPropertiesAndClassStaticBlock,
|
|
189894
190138
|
getStrictOptionValue,
|
|
189895
190139
|
getStringComparer,
|
|
190140
|
+
getSubPatternFromSpec,
|
|
189896
190141
|
getSuperCallFromStatement,
|
|
189897
190142
|
getSuperContainer,
|
|
189898
190143
|
getSupportedCodeFixes,
|
|
@@ -190979,7 +191224,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
190979
191224
|
setValueDeclaration,
|
|
190980
191225
|
shouldAllowImportingTsExtension,
|
|
190981
191226
|
shouldPreserveConstEnums,
|
|
190982
|
-
shouldResolveJsRequire,
|
|
190983
191227
|
shouldUseUriStyleNodeCoreModules,
|
|
190984
191228
|
showModuleSpecifier,
|
|
190985
191229
|
signatureHasLiteralTypes,
|
|
@@ -191142,7 +191386,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
191142
191386
|
typeDirectiveIsEqualTo,
|
|
191143
191387
|
typeKeywords,
|
|
191144
191388
|
typeParameterNamePart,
|
|
191145
|
-
typeReferenceResolutionNameAndModeGetter,
|
|
191146
191389
|
typeToDisplayParts,
|
|
191147
191390
|
unchangedPollThresholds,
|
|
191148
191391
|
unchangedTextChangeRange,
|