typescript 5.1.0-dev.20230301 → 5.1.0-dev.20230302
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +127 -65
- package/lib/tsserver.js +867 -603
- package/lib/tsserverlibrary.d.ts +2 -37
- package/lib/tsserverlibrary.js +926 -652
- package/lib/typescript.d.ts +0 -3
- package/lib/typescript.js +804 -542
- package/lib/typingsInstaller.js +50 -14
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230302`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -1622,7 +1622,7 @@ var ts = (() => {
|
|
|
1622
1622
|
function isNodeLikeSystem() {
|
|
1623
1623
|
return typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object";
|
|
1624
1624
|
}
|
|
1625
|
-
var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty,
|
|
1625
|
+
var emptyArray, emptyMap, emptySet, SortKind, elementAt, hasOwnProperty, fileNameLowerCaseRegExp, AssertionLevel, createUIStringComparer, uiComparerCaseSensitive, uiLocale, trimString, trimStringEnd, trimStringStart;
|
|
1626
1626
|
var init_core = __esm({
|
|
1627
1627
|
"src/compiler/core.ts"() {
|
|
1628
1628
|
"use strict";
|
|
@@ -1647,10 +1647,6 @@ var ts = (() => {
|
|
|
1647
1647
|
return void 0;
|
|
1648
1648
|
};
|
|
1649
1649
|
hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
1650
|
-
noopPush = {
|
|
1651
|
-
push: noop,
|
|
1652
|
-
length: 0
|
|
1653
|
-
};
|
|
1654
1650
|
fileNameLowerCaseRegExp = /[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g;
|
|
1655
1651
|
AssertionLevel = /* @__PURE__ */ ((AssertionLevel2) => {
|
|
1656
1652
|
AssertionLevel2[AssertionLevel2["None"] = 0] = "None";
|
|
@@ -8458,6 +8454,7 @@ ${lanes.join("\n")}
|
|
|
8458
8454
|
File_name_0_has_a_1_extension_looking_up_2_instead: diag(6262, 3 /* Message */, "File_name_0_has_a_1_extension_looking_up_2_instead_6262", "File name '{0}' has a '{1}' extension - looking up '{2}' instead."),
|
|
8459
8455
|
Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set: diag(6263, 1 /* Error */, "Module_0_was_resolved_to_1_but_allowArbitraryExtensions_is_not_set_6263", "Module '{0}' was resolved to '{1}', but '--allowArbitraryExtensions' is not set."),
|
|
8460
8456
|
Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present: diag(6264, 3 /* Message */, "Enable_importing_files_with_any_extension_provided_a_declaration_file_is_present_6264", "Enable importing files with any extension, provided a declaration file is present."),
|
|
8457
|
+
Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder: diag(6265, 3 /* Message */, "Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_no_6265", "Resolving type reference directive for program that specifies custom typeRoots, skipping lookup in 'node_modules' folder."),
|
|
8461
8458
|
Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve: diag(6270, 3 /* Message */, "Directory_0_has_no_containing_package_json_scope_Imports_will_not_resolve_6270", "Directory '{0}' has no containing package.json scope. Imports will not resolve."),
|
|
8462
8459
|
Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1: diag(6271, 3 /* Message */, "Import_specifier_0_does_not_exist_in_package_json_scope_at_path_1_6271", "Import specifier '{0}' does not exist in package.json scope at path '{1}'."),
|
|
8463
8460
|
Invalid_import_specifier_0_has_no_possible_resolutions: diag(6272, 3 /* Message */, "Invalid_import_specifier_0_has_no_possible_resolutions_6272", "Invalid import specifier '{0}' has no possible resolutions."),
|
|
@@ -8853,6 +8850,8 @@ ${lanes.join("\n")}
|
|
|
8853
8850
|
This_may_be_converted_to_an_async_function: diag(80006, 2 /* Suggestion */, "This_may_be_converted_to_an_async_function_80006", "This may be converted to an async function."),
|
|
8854
8851
|
await_has_no_effect_on_the_type_of_this_expression: diag(80007, 2 /* Suggestion */, "await_has_no_effect_on_the_type_of_this_expression_80007", "'await' has no effect on the type of this expression."),
|
|
8855
8852
|
Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers: diag(80008, 2 /* Suggestion */, "Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accur_80008", "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers."),
|
|
8853
|
+
JSDoc_typedef_may_be_converted_to_TypeScript_type: diag(80009, 2 /* Suggestion */, "JSDoc_typedef_may_be_converted_to_TypeScript_type_80009", "JSDoc typedef may be converted to TypeScript type."),
|
|
8854
|
+
JSDoc_typedefs_may_be_converted_to_TypeScript_types: diag(80010, 2 /* Suggestion */, "JSDoc_typedefs_may_be_converted_to_TypeScript_types_80010", "JSDoc typedefs may be converted to TypeScript types."),
|
|
8856
8855
|
Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
|
|
8857
8856
|
Make_super_call_the_first_statement_in_the_constructor: diag(90002, 3 /* Message */, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor"),
|
|
8858
8857
|
Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
|
|
@@ -9067,6 +9066,8 @@ ${lanes.join("\n")}
|
|
|
9067
9066
|
Rename_param_tag_name_0_to_1: diag(95173, 3 /* Message */, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"),
|
|
9068
9067
|
Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
|
|
9069
9068
|
Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
|
|
9069
|
+
Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
|
|
9070
|
+
Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
|
|
9070
9071
|
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."),
|
|
9071
9072
|
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'."),
|
|
9072
9073
|
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?"),
|
|
@@ -38853,20 +38854,14 @@ ${lanes.join("\n")}
|
|
|
38853
38854
|
currentDirectory = host.getCurrentDirectory();
|
|
38854
38855
|
}
|
|
38855
38856
|
if (currentDirectory !== void 0) {
|
|
38856
|
-
return getDefaultTypeRoots(currentDirectory
|
|
38857
|
+
return getDefaultTypeRoots(currentDirectory);
|
|
38857
38858
|
}
|
|
38858
38859
|
}
|
|
38859
|
-
function getDefaultTypeRoots(currentDirectory
|
|
38860
|
-
if (!host.directoryExists) {
|
|
38861
|
-
return [combinePaths(currentDirectory, nodeModulesAtTypes)];
|
|
38862
|
-
}
|
|
38860
|
+
function getDefaultTypeRoots(currentDirectory) {
|
|
38863
38861
|
let typeRoots;
|
|
38864
38862
|
forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
|
|
38865
38863
|
const atTypes = combinePaths(directory, nodeModulesAtTypes);
|
|
38866
|
-
|
|
38867
|
-
(typeRoots || (typeRoots = [])).push(atTypes);
|
|
38868
|
-
}
|
|
38869
|
-
return void 0;
|
|
38864
|
+
(typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
|
|
38870
38865
|
});
|
|
38871
38866
|
return typeRoots;
|
|
38872
38867
|
}
|
|
@@ -39002,10 +38997,22 @@ ${lanes.join("\n")}
|
|
|
39002
38997
|
}
|
|
39003
38998
|
return firstDefined(typeRoots, (typeRoot) => {
|
|
39004
38999
|
const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
|
|
39005
|
-
const
|
|
39006
|
-
const directoryExists = directoryProbablyExists(candidateDirectory, host);
|
|
39000
|
+
const directoryExists = directoryProbablyExists(typeRoot, host);
|
|
39007
39001
|
if (!directoryExists && traceEnabled) {
|
|
39008
|
-
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it,
|
|
39002
|
+
trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
39003
|
+
}
|
|
39004
|
+
if (options.typeRoots) {
|
|
39005
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState);
|
|
39006
|
+
if (resolvedFromFile) {
|
|
39007
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
39008
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
39009
|
+
packageDirectory,
|
|
39010
|
+
/*onlyRecordFailures*/
|
|
39011
|
+
false,
|
|
39012
|
+
moduleResolutionState
|
|
39013
|
+
) : void 0;
|
|
39014
|
+
return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
|
|
39015
|
+
}
|
|
39009
39016
|
}
|
|
39010
39017
|
return resolvedTypeScriptOnly(
|
|
39011
39018
|
loadNodeModuleFromDirectory(
|
|
@@ -39025,33 +39032,37 @@ ${lanes.join("\n")}
|
|
|
39025
39032
|
function secondaryLookup() {
|
|
39026
39033
|
const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
|
|
39027
39034
|
if (initialLocationForSecondaryLookup !== void 0) {
|
|
39028
|
-
if (traceEnabled) {
|
|
39029
|
-
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39030
|
-
}
|
|
39031
39035
|
let result2;
|
|
39032
|
-
if (!
|
|
39033
|
-
|
|
39034
|
-
|
|
39035
|
-
|
|
39036
|
-
|
|
39037
|
-
|
|
39038
|
-
|
|
39039
|
-
|
|
39040
|
-
|
|
39041
|
-
|
|
39042
|
-
|
|
39043
|
-
|
|
39044
|
-
|
|
39045
|
-
|
|
39046
|
-
|
|
39047
|
-
|
|
39048
|
-
|
|
39049
|
-
|
|
39050
|
-
|
|
39051
|
-
|
|
39052
|
-
|
|
39053
|
-
|
|
39054
|
-
|
|
39036
|
+
if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) {
|
|
39037
|
+
if (traceEnabled) {
|
|
39038
|
+
trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
|
|
39039
|
+
}
|
|
39040
|
+
if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
|
|
39041
|
+
const searchResult = loadModuleFromNearestNodeModulesDirectory(
|
|
39042
|
+
4 /* Declaration */,
|
|
39043
|
+
typeReferenceDirectiveName,
|
|
39044
|
+
initialLocationForSecondaryLookup,
|
|
39045
|
+
moduleResolutionState,
|
|
39046
|
+
/*cache*/
|
|
39047
|
+
void 0,
|
|
39048
|
+
/*redirectedReference*/
|
|
39049
|
+
void 0
|
|
39050
|
+
);
|
|
39051
|
+
result2 = searchResult && searchResult.value;
|
|
39052
|
+
} else {
|
|
39053
|
+
const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
|
|
39054
|
+
result2 = nodeLoadModuleByRelativeName(
|
|
39055
|
+
4 /* Declaration */,
|
|
39056
|
+
candidate,
|
|
39057
|
+
/*onlyRecordFailures*/
|
|
39058
|
+
false,
|
|
39059
|
+
moduleResolutionState,
|
|
39060
|
+
/*considerPackageJson*/
|
|
39061
|
+
true
|
|
39062
|
+
);
|
|
39063
|
+
}
|
|
39064
|
+
} else if (traceEnabled) {
|
|
39065
|
+
trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder);
|
|
39055
39066
|
}
|
|
39056
39067
|
return resolvedTypeScriptOnly(result2);
|
|
39057
39068
|
} else {
|
|
@@ -39870,6 +39881,9 @@ ${lanes.join("\n")}
|
|
|
39870
39881
|
}
|
|
39871
39882
|
resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
|
|
39872
39883
|
}
|
|
39884
|
+
if (extensions2 & 4 /* Declaration */) {
|
|
39885
|
+
resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
|
|
39886
|
+
}
|
|
39873
39887
|
return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
|
|
39874
39888
|
} else {
|
|
39875
39889
|
const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
|
|
@@ -40049,6 +40063,7 @@ ${lanes.join("\n")}
|
|
|
40049
40063
|
return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
|
|
40050
40064
|
}
|
|
40051
40065
|
function tryFileLookup(fileName, onlyRecordFailures, state) {
|
|
40066
|
+
var _a2;
|
|
40052
40067
|
if (!onlyRecordFailures) {
|
|
40053
40068
|
if (state.host.fileExists(fileName)) {
|
|
40054
40069
|
if (state.traceEnabled) {
|
|
@@ -40061,7 +40076,7 @@ ${lanes.join("\n")}
|
|
|
40061
40076
|
}
|
|
40062
40077
|
}
|
|
40063
40078
|
}
|
|
40064
|
-
state.failedLookupLocations.push(fileName);
|
|
40079
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
|
|
40065
40080
|
return void 0;
|
|
40066
40081
|
}
|
|
40067
40082
|
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
|
|
@@ -40176,8 +40191,8 @@ ${lanes.join("\n")}
|
|
|
40176
40191
|
host,
|
|
40177
40192
|
compilerOptions: options,
|
|
40178
40193
|
traceEnabled: isTraceEnabled(options, host),
|
|
40179
|
-
failedLookupLocations:
|
|
40180
|
-
affectingLocations:
|
|
40194
|
+
failedLookupLocations: void 0,
|
|
40195
|
+
affectingLocations: void 0,
|
|
40181
40196
|
packageJsonInfoCache,
|
|
40182
40197
|
features: 0 /* None */,
|
|
40183
40198
|
conditions: emptyArray,
|
|
@@ -40211,24 +40226,24 @@ ${lanes.join("\n")}
|
|
|
40211
40226
|
return packageJsonInfo.contents.versionPaths || void 0;
|
|
40212
40227
|
}
|
|
40213
40228
|
function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
|
|
40214
|
-
var _a2, _b, _c;
|
|
40229
|
+
var _a2, _b, _c, _d, _e, _f, _g, _h;
|
|
40215
40230
|
const { host, traceEnabled } = state;
|
|
40216
40231
|
const packageJsonPath = combinePaths(packageDirectory, "package.json");
|
|
40217
40232
|
if (onlyRecordFailures) {
|
|
40218
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40233
|
+
(_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
|
|
40219
40234
|
return void 0;
|
|
40220
40235
|
}
|
|
40221
|
-
const existing = (
|
|
40236
|
+
const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
|
|
40222
40237
|
if (existing !== void 0) {
|
|
40223
40238
|
if (typeof existing !== "boolean") {
|
|
40224
40239
|
if (traceEnabled)
|
|
40225
40240
|
trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40226
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40241
|
+
(_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
|
|
40227
40242
|
return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
|
|
40228
40243
|
} else {
|
|
40229
40244
|
if (existing && traceEnabled)
|
|
40230
40245
|
trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
|
|
40231
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40246
|
+
(_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
|
|
40232
40247
|
return void 0;
|
|
40233
40248
|
}
|
|
40234
40249
|
}
|
|
@@ -40239,15 +40254,15 @@ ${lanes.join("\n")}
|
|
|
40239
40254
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
40240
40255
|
}
|
|
40241
40256
|
const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
|
|
40242
|
-
(
|
|
40243
|
-
state.affectingLocations.push(packageJsonPath);
|
|
40257
|
+
(_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
|
|
40258
|
+
(_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
|
|
40244
40259
|
return result;
|
|
40245
40260
|
} else {
|
|
40246
40261
|
if (directoryExists && traceEnabled) {
|
|
40247
40262
|
trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
|
|
40248
40263
|
}
|
|
40249
|
-
(
|
|
40250
|
-
state.failedLookupLocations.push(packageJsonPath);
|
|
40264
|
+
(_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
|
|
40265
|
+
(_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
|
|
40251
40266
|
}
|
|
40252
40267
|
}
|
|
40253
40268
|
function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
|
|
@@ -41067,11 +41082,13 @@ ${lanes.join("\n")}
|
|
|
41067
41082
|
state
|
|
41068
41083
|
));
|
|
41069
41084
|
});
|
|
41070
|
-
if (resolved2)
|
|
41085
|
+
if (resolved2)
|
|
41071
41086
|
return resolved2;
|
|
41072
|
-
}
|
|
41073
41087
|
if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
|
|
41074
|
-
|
|
41088
|
+
let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
|
|
41089
|
+
if (extensions & 4 /* Declaration */)
|
|
41090
|
+
resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
|
|
41091
|
+
return resolved3;
|
|
41075
41092
|
}
|
|
41076
41093
|
} else {
|
|
41077
41094
|
const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
|
|
@@ -41085,6 +41102,31 @@ ${lanes.join("\n")}
|
|
|
41085
41102
|
}
|
|
41086
41103
|
}
|
|
41087
41104
|
}
|
|
41105
|
+
function resolveFromTypeRoot(moduleName, state) {
|
|
41106
|
+
if (!state.compilerOptions.typeRoots)
|
|
41107
|
+
return;
|
|
41108
|
+
for (const typeRoot of state.compilerOptions.typeRoots) {
|
|
41109
|
+
const candidate = combinePaths(typeRoot, moduleName);
|
|
41110
|
+
const directoryExists = directoryProbablyExists(typeRoot, state.host);
|
|
41111
|
+
if (!directoryExists && state.traceEnabled) {
|
|
41112
|
+
trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
|
|
41113
|
+
}
|
|
41114
|
+
const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41115
|
+
if (resolvedFromFile) {
|
|
41116
|
+
const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
|
|
41117
|
+
const packageInfo = packageDirectory ? getPackageJsonInfo(
|
|
41118
|
+
packageDirectory,
|
|
41119
|
+
/*onlyRecordFailures*/
|
|
41120
|
+
false,
|
|
41121
|
+
state
|
|
41122
|
+
) : void 0;
|
|
41123
|
+
return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
|
|
41124
|
+
}
|
|
41125
|
+
const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
|
|
41126
|
+
if (resolved)
|
|
41127
|
+
return toSearchResult(resolved);
|
|
41128
|
+
}
|
|
41129
|
+
}
|
|
41088
41130
|
function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
|
|
41089
41131
|
return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
|
|
41090
41132
|
}
|
|
@@ -54007,7 +54049,11 @@ ${lanes.join("\n")}
|
|
|
54007
54049
|
const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
|
|
54008
54050
|
return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
|
|
54009
54051
|
} else {
|
|
54010
|
-
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54052
|
+
return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
|
|
54053
|
+
type,
|
|
54054
|
+
/*isProperty*/
|
|
54055
|
+
true
|
|
54056
|
+
) : type;
|
|
54011
54057
|
}
|
|
54012
54058
|
}
|
|
54013
54059
|
function getTypeOfEnumMember(symbol) {
|
|
@@ -62708,6 +62754,7 @@ ${lanes.join("\n")}
|
|
|
62708
62754
|
} else if (targetFlags & 8388608 /* IndexedAccess */) {
|
|
62709
62755
|
if (sourceFlags & 8388608 /* IndexedAccess */) {
|
|
62710
62756
|
if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
|
|
62757
|
+
instantiateType(source2.objectType, reportUnreliableMapper);
|
|
62711
62758
|
result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
|
|
62712
62759
|
}
|
|
62713
62760
|
if (result2) {
|
|
@@ -65853,7 +65900,7 @@ ${lanes.join("\n")}
|
|
|
65853
65900
|
);
|
|
65854
65901
|
}
|
|
65855
65902
|
function isInAmbientOrTypeNode(node) {
|
|
65856
|
-
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
|
|
65903
|
+
return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
|
|
65857
65904
|
}
|
|
65858
65905
|
function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
|
|
65859
65906
|
switch (node.kind) {
|
|
@@ -69001,6 +69048,16 @@ ${lanes.join("\n")}
|
|
|
69001
69048
|
const symbol = getSymbolOfDeclaration(element);
|
|
69002
69049
|
return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
|
|
69003
69050
|
}
|
|
69051
|
+
if (hasDynamicName(element)) {
|
|
69052
|
+
const name = getNameOfDeclaration(element);
|
|
69053
|
+
if (name && isComputedPropertyName(name)) {
|
|
69054
|
+
const exprType = checkExpression(name.expression);
|
|
69055
|
+
const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
|
|
69056
|
+
if (propType) {
|
|
69057
|
+
return propType;
|
|
69058
|
+
}
|
|
69059
|
+
}
|
|
69060
|
+
}
|
|
69004
69061
|
if (element.name) {
|
|
69005
69062
|
const nameType = getLiteralTypeFromPropertyName(element.name);
|
|
69006
69063
|
return mapType(
|
|
@@ -73774,7 +73831,7 @@ ${lanes.join("\n")}
|
|
|
73774
73831
|
}
|
|
73775
73832
|
function getNonArrayRestType(signature) {
|
|
73776
73833
|
const restType = getEffectiveRestType(signature);
|
|
73777
|
-
return restType && !isArrayType(restType) && !isTypeAny(restType)
|
|
73834
|
+
return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
|
|
73778
73835
|
}
|
|
73779
73836
|
function getTypeOfFirstParameterOfSignature(signature) {
|
|
73780
73837
|
return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
|
|
@@ -78588,6 +78645,9 @@ ${lanes.join("\n")}
|
|
|
78588
78645
|
return;
|
|
78589
78646
|
}
|
|
78590
78647
|
if (isBindingPattern(node.name)) {
|
|
78648
|
+
if (isInAmbientOrTypeNode(node)) {
|
|
78649
|
+
return;
|
|
78650
|
+
}
|
|
78591
78651
|
const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
|
|
78592
78652
|
const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
|
|
78593
78653
|
if (needCheckInitializer || needCheckWidenedType) {
|
|
@@ -121573,7 +121633,7 @@ ${lanes.join("\n")}
|
|
|
121573
121633
|
return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
|
|
121574
121634
|
}
|
|
121575
121635
|
function createTypeRootsWatch(typeRootPath, typeRoot) {
|
|
121576
|
-
return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121636
|
+
return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
|
|
121577
121637
|
const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
|
|
121578
121638
|
if (cachedDirectoryStructureHost) {
|
|
121579
121639
|
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
|
|
@@ -121584,7 +121644,7 @@ ${lanes.join("\n")}
|
|
|
121584
121644
|
if (dirPath) {
|
|
121585
121645
|
scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
|
|
121586
121646
|
}
|
|
121587
|
-
}, 1 /* Recursive */);
|
|
121647
|
+
}, 1 /* Recursive */) : noopFileWatcher;
|
|
121588
121648
|
}
|
|
121589
121649
|
function updateTypeRootsWatch() {
|
|
121590
121650
|
const options = resolutionHost.getCompilationSettings();
|
|
@@ -121592,7 +121652,7 @@ ${lanes.join("\n")}
|
|
|
121592
121652
|
closeTypeRootsWatch();
|
|
121593
121653
|
return;
|
|
121594
121654
|
}
|
|
121595
|
-
const typeRoots = getEffectiveTypeRoots(options, {
|
|
121655
|
+
const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
|
|
121596
121656
|
if (typeRoots) {
|
|
121597
121657
|
mutateMap(
|
|
121598
121658
|
typeRootsWatches,
|
|
@@ -121606,7 +121666,9 @@ ${lanes.join("\n")}
|
|
|
121606
121666
|
closeTypeRootsWatch();
|
|
121607
121667
|
}
|
|
121608
121668
|
}
|
|
121609
|
-
function
|
|
121669
|
+
function canWatchTypeRootPath(nodeTypesDirectory) {
|
|
121670
|
+
if (resolutionHost.getCompilationSettings().typeRoots)
|
|
121671
|
+
return true;
|
|
121610
121672
|
const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
|
|
121611
121673
|
const dirPath = resolutionHost.toPath(dir);
|
|
121612
121674
|
return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
|
|
@@ -131649,6 +131711,10 @@ ${lanes.join("\n")}
|
|
|
131649
131711
|
diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
|
|
131650
131712
|
}
|
|
131651
131713
|
}
|
|
131714
|
+
const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
|
|
131715
|
+
if (jsdocTypedefNode) {
|
|
131716
|
+
diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
|
|
131717
|
+
}
|
|
131652
131718
|
if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
|
|
131653
131719
|
diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));
|
|
131654
131720
|
}
|
|
@@ -133464,18 +133530,6 @@ ${lanes.join("\n")}
|
|
|
133464
133530
|
synchronizeHostData();
|
|
133465
133531
|
return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position);
|
|
133466
133532
|
}
|
|
133467
|
-
function getOccurrencesAtPosition(fileName, position) {
|
|
133468
|
-
return flatMap(
|
|
133469
|
-
getDocumentHighlights(fileName, position, [fileName]),
|
|
133470
|
-
(entry) => entry.highlightSpans.map((highlightSpan) => ({
|
|
133471
|
-
fileName: entry.fileName,
|
|
133472
|
-
textSpan: highlightSpan.textSpan,
|
|
133473
|
-
isWriteAccess: highlightSpan.kind === "writtenReference" /* writtenReference */,
|
|
133474
|
-
...highlightSpan.isInString && { isInString: true },
|
|
133475
|
-
...highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan }
|
|
133476
|
-
}))
|
|
133477
|
-
);
|
|
133478
|
-
}
|
|
133479
133533
|
function getDocumentHighlights(fileName, position, filesToSearch) {
|
|
133480
133534
|
const normalizedFileName = normalizePath(fileName);
|
|
133481
133535
|
Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName));
|
|
@@ -133668,22 +133722,22 @@ ${lanes.join("\n")}
|
|
|
133668
133722
|
}
|
|
133669
133723
|
return [];
|
|
133670
133724
|
}
|
|
133671
|
-
function getCodeFixesAtPosition(fileName, start, end,
|
|
133725
|
+
function getCodeFixesAtPosition(fileName, start, end, errorCodes64, formatOptions, preferences = emptyOptions) {
|
|
133672
133726
|
synchronizeHostData();
|
|
133673
133727
|
const sourceFile = getValidSourceFile(fileName);
|
|
133674
133728
|
const span = createTextSpanFromBounds(start, end);
|
|
133675
133729
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133676
|
-
return flatMap(deduplicate(
|
|
133730
|
+
return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => {
|
|
133677
133731
|
cancellationToken.throwIfCancellationRequested();
|
|
133678
133732
|
return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
|
|
133679
133733
|
});
|
|
133680
133734
|
}
|
|
133681
|
-
function getCombinedCodeFix(scope,
|
|
133735
|
+
function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
|
|
133682
133736
|
synchronizeHostData();
|
|
133683
133737
|
Debug.assert(scope.type === "file");
|
|
133684
133738
|
const sourceFile = getValidSourceFile(scope.fileName);
|
|
133685
133739
|
const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
|
|
133686
|
-
return ts_codefix_exports.getAllFixes({ fixId:
|
|
133740
|
+
return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
|
|
133687
133741
|
}
|
|
133688
133742
|
function organizeImports2(args, formatOptions, preferences = emptyOptions) {
|
|
133689
133743
|
var _a3;
|
|
@@ -134105,7 +134159,6 @@ ${lanes.join("\n")}
|
|
|
134105
134159
|
getReferencesAtPosition,
|
|
134106
134160
|
findReferences,
|
|
134107
134161
|
getFileReferences,
|
|
134108
|
-
getOccurrencesAtPosition,
|
|
134109
134162
|
getDocumentHighlights,
|
|
134110
134163
|
getNameOrDottedNameSpan,
|
|
134111
134164
|
getBreakpointStatementAtPosition,
|
|
@@ -134931,7 +134984,6 @@ ${lanes.join("\n")}
|
|
|
134931
134984
|
"getTypeDefinitionAtPosition",
|
|
134932
134985
|
"getReferencesAtPosition",
|
|
134933
134986
|
"findReferences",
|
|
134934
|
-
"getOccurrencesAtPosition",
|
|
134935
134987
|
"getDocumentHighlights",
|
|
134936
134988
|
"getNavigateToItems",
|
|
134937
134989
|
"getRenameInfo",
|
|
@@ -135515,12 +135567,6 @@ ${lanes.join("\n")}
|
|
|
135515
135567
|
() => this.languageService.getFileReferences(fileName)
|
|
135516
135568
|
);
|
|
135517
135569
|
}
|
|
135518
|
-
getOccurrencesAtPosition(fileName, position) {
|
|
135519
|
-
return this.forwardJSONCall(
|
|
135520
|
-
`getOccurrencesAtPosition('${fileName}', ${position})`,
|
|
135521
|
-
() => this.languageService.getOccurrencesAtPosition(fileName, position)
|
|
135522
|
-
);
|
|
135523
|
-
}
|
|
135524
135570
|
getDocumentHighlights(fileName, position, filesToSearch) {
|
|
135525
135571
|
return this.forwardJSONCall(
|
|
135526
135572
|
`getDocumentHighlights('${fileName}', ${position})`,
|
|
@@ -137154,23 +137200,23 @@ ${lanes.join("\n")}
|
|
|
137154
137200
|
void 0
|
|
137155
137201
|
);
|
|
137156
137202
|
}
|
|
137157
|
-
function createCodeFixAction(fixName8, changes, description2,
|
|
137158
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137203
|
+
function createCodeFixAction(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137204
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, diagnosticToString(fixAllDescription), command);
|
|
137159
137205
|
}
|
|
137160
|
-
function createCodeFixActionMaybeFixAll(fixName8, changes, description2,
|
|
137161
|
-
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes,
|
|
137206
|
+
function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId52, fixAllDescription, command) {
|
|
137207
|
+
return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
137162
137208
|
}
|
|
137163
|
-
function createCodeFixActionWorker(fixName8, description2, changes,
|
|
137164
|
-
return { fixName: fixName8, description: description2, changes, fixId:
|
|
137209
|
+
function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fixAllDescription, command) {
|
|
137210
|
+
return { fixName: fixName8, description: description2, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
|
|
137165
137211
|
}
|
|
137166
137212
|
function registerCodeFix(reg) {
|
|
137167
137213
|
for (const error of reg.errorCodes) {
|
|
137168
137214
|
errorCodeToFixes.add(String(error), reg);
|
|
137169
137215
|
}
|
|
137170
137216
|
if (reg.fixIds) {
|
|
137171
|
-
for (const
|
|
137172
|
-
Debug.assert(!fixIdToRegistration.has(
|
|
137173
|
-
fixIdToRegistration.set(
|
|
137217
|
+
for (const fixId52 of reg.fixIds) {
|
|
137218
|
+
Debug.assert(!fixIdToRegistration.has(fixId52));
|
|
137219
|
+
fixIdToRegistration.set(fixId52, reg);
|
|
137174
137220
|
}
|
|
137175
137221
|
}
|
|
137176
137222
|
}
|
|
@@ -137178,17 +137224,17 @@ ${lanes.join("\n")}
|
|
|
137178
137224
|
return arrayFrom(errorCodeToFixes.keys());
|
|
137179
137225
|
}
|
|
137180
137226
|
function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
|
|
137181
|
-
const { errorCodes:
|
|
137227
|
+
const { errorCodes: errorCodes64 } = registration;
|
|
137182
137228
|
let maybeFixableDiagnostics = 0;
|
|
137183
137229
|
for (const diag2 of diagnostics) {
|
|
137184
|
-
if (contains(
|
|
137230
|
+
if (contains(errorCodes64, diag2.code))
|
|
137185
137231
|
maybeFixableDiagnostics++;
|
|
137186
137232
|
if (maybeFixableDiagnostics > 1)
|
|
137187
137233
|
break;
|
|
137188
137234
|
}
|
|
137189
137235
|
const fixAllUnavailable = maybeFixableDiagnostics < 2;
|
|
137190
|
-
return ({ fixId:
|
|
137191
|
-
return fixAllUnavailable ? action : { ...action, fixId:
|
|
137236
|
+
return ({ fixId: fixId52, fixAllDescription, ...action }) => {
|
|
137237
|
+
return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
|
|
137192
137238
|
};
|
|
137193
137239
|
}
|
|
137194
137240
|
function getFixes(context) {
|
|
@@ -137205,14 +137251,14 @@ ${lanes.join("\n")}
|
|
|
137205
137251
|
function createFileTextChanges(fileName, textChanges2) {
|
|
137206
137252
|
return { fileName, textChanges: textChanges2 };
|
|
137207
137253
|
}
|
|
137208
|
-
function codeFixAll(context,
|
|
137254
|
+
function codeFixAll(context, errorCodes64, use) {
|
|
137209
137255
|
const commands = [];
|
|
137210
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context,
|
|
137256
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands)));
|
|
137211
137257
|
return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
|
|
137212
137258
|
}
|
|
137213
|
-
function eachDiagnostic(context,
|
|
137259
|
+
function eachDiagnostic(context, errorCodes64, cb) {
|
|
137214
137260
|
for (const diag2 of getDiagnostics(context)) {
|
|
137215
|
-
if (contains(
|
|
137261
|
+
if (contains(errorCodes64, diag2.code)) {
|
|
137216
137262
|
cb(diag2);
|
|
137217
137263
|
}
|
|
137218
137264
|
}
|
|
@@ -139794,32 +139840,96 @@ ${lanes.join("\n")}
|
|
|
139794
139840
|
});
|
|
139795
139841
|
|
|
139796
139842
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
139797
|
-
function
|
|
139798
|
-
|
|
139843
|
+
function getDeclaration2(sourceFile, pos) {
|
|
139844
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
139845
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
139799
139846
|
}
|
|
139800
|
-
function
|
|
139801
|
-
if (
|
|
139802
|
-
|
|
139803
|
-
|
|
139804
|
-
|
|
139805
|
-
|
|
139806
|
-
|
|
139807
|
-
|
|
139808
|
-
changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration(
|
|
139809
|
-
importDeclaration,
|
|
139810
|
-
/*modifiers*/
|
|
139811
|
-
void 0,
|
|
139812
|
-
factory.createImportClause(
|
|
139813
|
-
/*isTypeOnly*/
|
|
139814
|
-
true,
|
|
139815
|
-
importClause.name,
|
|
139816
|
-
/*namedBindings*/
|
|
139817
|
-
void 0
|
|
139818
|
-
),
|
|
139819
|
-
importDeclaration.moduleSpecifier,
|
|
139820
|
-
/*assertClause*/
|
|
139821
|
-
void 0
|
|
139847
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
139848
|
+
if (isImportSpecifier(declaration)) {
|
|
139849
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
139850
|
+
declaration,
|
|
139851
|
+
/*isTypeOnly*/
|
|
139852
|
+
true,
|
|
139853
|
+
declaration.propertyName,
|
|
139854
|
+
declaration.name
|
|
139822
139855
|
));
|
|
139856
|
+
} else {
|
|
139857
|
+
const importClause = declaration.importClause;
|
|
139858
|
+
if (importClause.name && importClause.namedBindings) {
|
|
139859
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
139860
|
+
factory.createImportDeclaration(
|
|
139861
|
+
getSynthesizedDeepClones(
|
|
139862
|
+
declaration.modifiers,
|
|
139863
|
+
/*includeTrivia*/
|
|
139864
|
+
true
|
|
139865
|
+
),
|
|
139866
|
+
factory.createImportClause(
|
|
139867
|
+
/*isTypeOnly*/
|
|
139868
|
+
true,
|
|
139869
|
+
getSynthesizedDeepClone(
|
|
139870
|
+
importClause.name,
|
|
139871
|
+
/*includeTrivia*/
|
|
139872
|
+
true
|
|
139873
|
+
),
|
|
139874
|
+
/*namedBindings*/
|
|
139875
|
+
void 0
|
|
139876
|
+
),
|
|
139877
|
+
getSynthesizedDeepClone(
|
|
139878
|
+
declaration.moduleSpecifier,
|
|
139879
|
+
/*includeTrivia*/
|
|
139880
|
+
true
|
|
139881
|
+
),
|
|
139882
|
+
getSynthesizedDeepClone(
|
|
139883
|
+
declaration.assertClause,
|
|
139884
|
+
/*includeTrivia*/
|
|
139885
|
+
true
|
|
139886
|
+
)
|
|
139887
|
+
),
|
|
139888
|
+
factory.createImportDeclaration(
|
|
139889
|
+
getSynthesizedDeepClones(
|
|
139890
|
+
declaration.modifiers,
|
|
139891
|
+
/*includeTrivia*/
|
|
139892
|
+
true
|
|
139893
|
+
),
|
|
139894
|
+
factory.createImportClause(
|
|
139895
|
+
/*isTypeOnly*/
|
|
139896
|
+
true,
|
|
139897
|
+
/*name*/
|
|
139898
|
+
void 0,
|
|
139899
|
+
getSynthesizedDeepClone(
|
|
139900
|
+
importClause.namedBindings,
|
|
139901
|
+
/*includeTrivia*/
|
|
139902
|
+
true
|
|
139903
|
+
)
|
|
139904
|
+
),
|
|
139905
|
+
getSynthesizedDeepClone(
|
|
139906
|
+
declaration.moduleSpecifier,
|
|
139907
|
+
/*includeTrivia*/
|
|
139908
|
+
true
|
|
139909
|
+
),
|
|
139910
|
+
getSynthesizedDeepClone(
|
|
139911
|
+
declaration.assertClause,
|
|
139912
|
+
/*includeTrivia*/
|
|
139913
|
+
true
|
|
139914
|
+
)
|
|
139915
|
+
)
|
|
139916
|
+
]);
|
|
139917
|
+
} else {
|
|
139918
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
139919
|
+
declaration,
|
|
139920
|
+
declaration.modifiers,
|
|
139921
|
+
factory.updateImportClause(
|
|
139922
|
+
importClause,
|
|
139923
|
+
/*isTypeOnly*/
|
|
139924
|
+
true,
|
|
139925
|
+
importClause.name,
|
|
139926
|
+
importClause.namedBindings
|
|
139927
|
+
),
|
|
139928
|
+
declaration.moduleSpecifier,
|
|
139929
|
+
declaration.assertClause
|
|
139930
|
+
);
|
|
139931
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
139932
|
+
}
|
|
139823
139933
|
}
|
|
139824
139934
|
}
|
|
139825
139935
|
var errorCodes14, fixId13;
|
|
@@ -139828,30 +139938,181 @@ ${lanes.join("\n")}
|
|
|
139828
139938
|
"use strict";
|
|
139829
139939
|
init_ts4();
|
|
139830
139940
|
init_ts_codefix();
|
|
139831
|
-
errorCodes14 = [
|
|
139941
|
+
errorCodes14 = [
|
|
139942
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
139943
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
139944
|
+
];
|
|
139832
139945
|
fixId13 = "convertToTypeOnlyImport";
|
|
139833
139946
|
registerCodeFix({
|
|
139834
139947
|
errorCodes: errorCodes14,
|
|
139835
139948
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139836
|
-
const
|
|
139837
|
-
|
|
139838
|
-
|
|
139839
|
-
});
|
|
139840
|
-
if (changes.length) {
|
|
139949
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
139950
|
+
if (declaration) {
|
|
139951
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
139841
139952
|
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
139842
139953
|
}
|
|
139954
|
+
return void 0;
|
|
139843
139955
|
},
|
|
139844
139956
|
fixIds: [fixId13],
|
|
139845
139957
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
139846
139958
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
139847
|
-
const
|
|
139848
|
-
|
|
139959
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
139960
|
+
if (declaration) {
|
|
139961
|
+
doChange4(changes, diag2.file, declaration);
|
|
139962
|
+
}
|
|
139849
139963
|
});
|
|
139850
139964
|
}
|
|
139851
139965
|
});
|
|
139852
139966
|
}
|
|
139853
139967
|
});
|
|
139854
139968
|
|
|
139969
|
+
// src/services/codefixes/convertTypedefToType.ts
|
|
139970
|
+
function doChange5(changes, node, sourceFile) {
|
|
139971
|
+
if (isJSDocTypedefTag(node)) {
|
|
139972
|
+
fixSingleTypeDef(changes, node, sourceFile);
|
|
139973
|
+
}
|
|
139974
|
+
}
|
|
139975
|
+
function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
|
|
139976
|
+
if (!typeDefNode)
|
|
139977
|
+
return;
|
|
139978
|
+
const declaration = createDeclaration(typeDefNode);
|
|
139979
|
+
if (!declaration)
|
|
139980
|
+
return;
|
|
139981
|
+
const comment = typeDefNode.parent;
|
|
139982
|
+
changes.replaceNode(
|
|
139983
|
+
sourceFile,
|
|
139984
|
+
comment,
|
|
139985
|
+
declaration
|
|
139986
|
+
);
|
|
139987
|
+
}
|
|
139988
|
+
function createDeclaration(tag) {
|
|
139989
|
+
var _a2;
|
|
139990
|
+
const { typeExpression } = tag;
|
|
139991
|
+
if (!typeExpression)
|
|
139992
|
+
return;
|
|
139993
|
+
const typeName = (_a2 = tag.name) == null ? void 0 : _a2.getText();
|
|
139994
|
+
if (!typeName)
|
|
139995
|
+
return;
|
|
139996
|
+
if (typeExpression.kind === 325 /* JSDocTypeLiteral */) {
|
|
139997
|
+
return createInterfaceForTypeLiteral(typeName, typeExpression);
|
|
139998
|
+
}
|
|
139999
|
+
if (typeExpression.kind === 312 /* JSDocTypeExpression */) {
|
|
140000
|
+
return createTypeAliasForTypeExpression(typeName, typeExpression);
|
|
140001
|
+
}
|
|
140002
|
+
}
|
|
140003
|
+
function createInterfaceForTypeLiteral(typeName, typeLiteral) {
|
|
140004
|
+
const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
|
|
140005
|
+
if (!some(propertySignatures))
|
|
140006
|
+
return;
|
|
140007
|
+
const interfaceDeclaration = factory.createInterfaceDeclaration(
|
|
140008
|
+
/*modifiers*/
|
|
140009
|
+
void 0,
|
|
140010
|
+
typeName,
|
|
140011
|
+
/*typeParameters*/
|
|
140012
|
+
void 0,
|
|
140013
|
+
/*heritageClauses*/
|
|
140014
|
+
void 0,
|
|
140015
|
+
propertySignatures
|
|
140016
|
+
);
|
|
140017
|
+
return interfaceDeclaration;
|
|
140018
|
+
}
|
|
140019
|
+
function createTypeAliasForTypeExpression(typeName, typeExpression) {
|
|
140020
|
+
const typeReference = getSynthesizedDeepClone(typeExpression.type);
|
|
140021
|
+
if (!typeReference)
|
|
140022
|
+
return;
|
|
140023
|
+
const declaration = factory.createTypeAliasDeclaration(
|
|
140024
|
+
/*modifiers*/
|
|
140025
|
+
void 0,
|
|
140026
|
+
factory.createIdentifier(typeName),
|
|
140027
|
+
/*typeParameters*/
|
|
140028
|
+
void 0,
|
|
140029
|
+
typeReference
|
|
140030
|
+
);
|
|
140031
|
+
return declaration;
|
|
140032
|
+
}
|
|
140033
|
+
function createSignatureFromTypeLiteral(typeLiteral) {
|
|
140034
|
+
const propertyTags = typeLiteral.jsDocPropertyTags;
|
|
140035
|
+
if (!some(propertyTags))
|
|
140036
|
+
return;
|
|
140037
|
+
const getSignature = (tag) => {
|
|
140038
|
+
var _a2;
|
|
140039
|
+
const name = getPropertyName(tag);
|
|
140040
|
+
const type = (_a2 = tag.typeExpression) == null ? void 0 : _a2.type;
|
|
140041
|
+
const isOptional = tag.isBracketed;
|
|
140042
|
+
let typeReference;
|
|
140043
|
+
if (type && isJSDocTypeLiteral(type)) {
|
|
140044
|
+
const signatures = createSignatureFromTypeLiteral(type);
|
|
140045
|
+
typeReference = factory.createTypeLiteralNode(signatures);
|
|
140046
|
+
} else if (type) {
|
|
140047
|
+
typeReference = getSynthesizedDeepClone(type);
|
|
140048
|
+
}
|
|
140049
|
+
if (typeReference && name) {
|
|
140050
|
+
const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0;
|
|
140051
|
+
const prop = factory.createPropertySignature(
|
|
140052
|
+
/*modifiers*/
|
|
140053
|
+
void 0,
|
|
140054
|
+
name,
|
|
140055
|
+
questionToken,
|
|
140056
|
+
typeReference
|
|
140057
|
+
);
|
|
140058
|
+
return prop;
|
|
140059
|
+
}
|
|
140060
|
+
};
|
|
140061
|
+
const props = mapDefined(propertyTags, getSignature);
|
|
140062
|
+
return props;
|
|
140063
|
+
}
|
|
140064
|
+
function getPropertyName(tag) {
|
|
140065
|
+
return tag.name.kind === 79 /* Identifier */ ? tag.name.text : tag.name.right.text;
|
|
140066
|
+
}
|
|
140067
|
+
function getJSDocTypedefNode(node) {
|
|
140068
|
+
if (hasJSDocNodes(node)) {
|
|
140069
|
+
return forEach(node.jsDoc, (node2) => {
|
|
140070
|
+
var _a2;
|
|
140071
|
+
return (_a2 = node2.tags) == null ? void 0 : _a2.find(isJSDocTypedefTag);
|
|
140072
|
+
});
|
|
140073
|
+
}
|
|
140074
|
+
return void 0;
|
|
140075
|
+
}
|
|
140076
|
+
var fixId14, errorCodes15;
|
|
140077
|
+
var init_convertTypedefToType = __esm({
|
|
140078
|
+
"src/services/codefixes/convertTypedefToType.ts"() {
|
|
140079
|
+
"use strict";
|
|
140080
|
+
init_ts4();
|
|
140081
|
+
init_ts_codefix();
|
|
140082
|
+
fixId14 = "convertTypedefToType";
|
|
140083
|
+
errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
|
|
140084
|
+
registerCodeFix({
|
|
140085
|
+
fixIds: [fixId14],
|
|
140086
|
+
errorCodes: errorCodes15,
|
|
140087
|
+
getCodeActions(context) {
|
|
140088
|
+
const node = getTokenAtPosition(
|
|
140089
|
+
context.sourceFile,
|
|
140090
|
+
context.span.start
|
|
140091
|
+
);
|
|
140092
|
+
if (!node)
|
|
140093
|
+
return;
|
|
140094
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, node, context.sourceFile));
|
|
140095
|
+
if (changes.length > 0) {
|
|
140096
|
+
return [
|
|
140097
|
+
createCodeFixAction(
|
|
140098
|
+
fixId14,
|
|
140099
|
+
changes,
|
|
140100
|
+
Diagnostics.Convert_typedef_to_TypeScript_type,
|
|
140101
|
+
fixId14,
|
|
140102
|
+
Diagnostics.Convert_all_typedef_to_TypeScript_types
|
|
140103
|
+
)
|
|
140104
|
+
];
|
|
140105
|
+
}
|
|
140106
|
+
},
|
|
140107
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
140108
|
+
const node = getTokenAtPosition(diag2.file, diag2.start);
|
|
140109
|
+
if (node)
|
|
140110
|
+
doChange5(changes, node, diag2.file);
|
|
140111
|
+
})
|
|
140112
|
+
});
|
|
140113
|
+
}
|
|
140114
|
+
});
|
|
140115
|
+
|
|
139855
140116
|
// src/services/codefixes/convertLiteralTypeToMappedType.ts
|
|
139856
140117
|
function getInfo2(sourceFile, pos) {
|
|
139857
140118
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -139867,7 +140128,7 @@ ${lanes.join("\n")}
|
|
|
139867
140128
|
}
|
|
139868
140129
|
return void 0;
|
|
139869
140130
|
}
|
|
139870
|
-
function
|
|
140131
|
+
function doChange6(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
139871
140132
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
139872
140133
|
/*readonlyToken*/
|
|
139873
140134
|
void 0,
|
|
@@ -139886,16 +140147,16 @@ ${lanes.join("\n")}
|
|
|
139886
140147
|
void 0
|
|
139887
140148
|
));
|
|
139888
140149
|
}
|
|
139889
|
-
var
|
|
140150
|
+
var fixId15, errorCodes16;
|
|
139890
140151
|
var init_convertLiteralTypeToMappedType = __esm({
|
|
139891
140152
|
"src/services/codefixes/convertLiteralTypeToMappedType.ts"() {
|
|
139892
140153
|
"use strict";
|
|
139893
140154
|
init_ts4();
|
|
139894
140155
|
init_ts_codefix();
|
|
139895
|
-
|
|
139896
|
-
|
|
140156
|
+
fixId15 = "convertLiteralTypeToMappedType";
|
|
140157
|
+
errorCodes16 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
|
|
139897
140158
|
registerCodeFix({
|
|
139898
|
-
errorCodes:
|
|
140159
|
+
errorCodes: errorCodes16,
|
|
139899
140160
|
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
139900
140161
|
const { sourceFile, span } = context;
|
|
139901
140162
|
const info = getInfo2(sourceFile, span.start);
|
|
@@ -139903,14 +140164,14 @@ ${lanes.join("\n")}
|
|
|
139903
140164
|
return void 0;
|
|
139904
140165
|
}
|
|
139905
140166
|
const { name, constraint } = info;
|
|
139906
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
139907
|
-
return [createCodeFixAction(
|
|
140167
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, sourceFile, info));
|
|
140168
|
+
return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
139908
140169
|
},
|
|
139909
|
-
fixIds: [
|
|
139910
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
140170
|
+
fixIds: [fixId15],
|
|
140171
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => {
|
|
139911
140172
|
const info = getInfo2(diag2.file, diag2.start);
|
|
139912
140173
|
if (info) {
|
|
139913
|
-
|
|
140174
|
+
doChange6(changes, diag2.file, info);
|
|
139914
140175
|
}
|
|
139915
140176
|
})
|
|
139916
140177
|
});
|
|
@@ -139969,31 +140230,31 @@ ${lanes.join("\n")}
|
|
|
139969
140230
|
const heritageClauseTypeSymbols = checker.getPropertiesOfType(heritageClauseType);
|
|
139970
140231
|
return createSymbolTable(heritageClauseTypeSymbols.filter(symbolPointsToNonPrivateMember));
|
|
139971
140232
|
}
|
|
139972
|
-
var
|
|
140233
|
+
var errorCodes17, fixId16;
|
|
139973
140234
|
var init_fixClassIncorrectlyImplementsInterface = __esm({
|
|
139974
140235
|
"src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts"() {
|
|
139975
140236
|
"use strict";
|
|
139976
140237
|
init_ts4();
|
|
139977
140238
|
init_ts_codefix();
|
|
139978
|
-
|
|
140239
|
+
errorCodes17 = [
|
|
139979
140240
|
Diagnostics.Class_0_incorrectly_implements_interface_1.code,
|
|
139980
140241
|
Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
|
|
139981
140242
|
];
|
|
139982
|
-
|
|
140243
|
+
fixId16 = "fixClassIncorrectlyImplementsInterface";
|
|
139983
140244
|
registerCodeFix({
|
|
139984
|
-
errorCodes:
|
|
140245
|
+
errorCodes: errorCodes17,
|
|
139985
140246
|
getCodeActions(context) {
|
|
139986
140247
|
const { sourceFile, span } = context;
|
|
139987
140248
|
const classDeclaration = getClass(sourceFile, span.start);
|
|
139988
140249
|
return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
|
|
139989
140250
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
|
|
139990
|
-
return changes.length === 0 ? void 0 : createCodeFixAction(
|
|
140251
|
+
return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces);
|
|
139991
140252
|
});
|
|
139992
140253
|
},
|
|
139993
|
-
fixIds: [
|
|
140254
|
+
fixIds: [fixId16],
|
|
139994
140255
|
getAllCodeActions(context) {
|
|
139995
140256
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
139996
|
-
return codeFixAll(context,
|
|
140257
|
+
return codeFixAll(context, errorCodes17, (changes, diag2) => {
|
|
139997
140258
|
const classDeclaration = getClass(diag2.file, diag2.start);
|
|
139998
140259
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
139999
140260
|
for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
|
|
@@ -141167,7 +141428,7 @@ ${lanes.join("\n")}
|
|
|
141167
141428
|
}
|
|
141168
141429
|
return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
|
|
141169
141430
|
}
|
|
141170
|
-
var importFixName, importFixId,
|
|
141431
|
+
var importFixName, importFixId, errorCodes18;
|
|
141171
141432
|
var init_importFixes = __esm({
|
|
141172
141433
|
"src/services/codefixes/importFixes.ts"() {
|
|
141173
141434
|
"use strict";
|
|
@@ -141175,7 +141436,7 @@ ${lanes.join("\n")}
|
|
|
141175
141436
|
init_ts_codefix();
|
|
141176
141437
|
importFixName = "import";
|
|
141177
141438
|
importFixId = "fixMissingImport";
|
|
141178
|
-
|
|
141439
|
+
errorCodes18 = [
|
|
141179
141440
|
Diagnostics.Cannot_find_name_0.code,
|
|
141180
141441
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
141181
141442
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
@@ -141187,7 +141448,7 @@ ${lanes.join("\n")}
|
|
|
141187
141448
|
Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
|
|
141188
141449
|
];
|
|
141189
141450
|
registerCodeFix({
|
|
141190
|
-
errorCodes:
|
|
141451
|
+
errorCodes: errorCodes18,
|
|
141191
141452
|
getCodeActions(context) {
|
|
141192
141453
|
const { errorCode, preferences, sourceFile, span, program } = context;
|
|
141193
141454
|
const info = getFixInfos(
|
|
@@ -141222,7 +141483,7 @@ ${lanes.join("\n")}
|
|
|
141222
141483
|
host,
|
|
141223
141484
|
cancellationToken
|
|
141224
141485
|
);
|
|
141225
|
-
eachDiagnostic(context,
|
|
141486
|
+
eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
|
|
141226
141487
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
|
|
141227
141488
|
}
|
|
141228
141489
|
});
|
|
@@ -141297,14 +141558,14 @@ ${lanes.join("\n")}
|
|
|
141297
141558
|
const contextualType = isExpression(node) ? checker.getContextualType(node) : void 0;
|
|
141298
141559
|
return contextualType || checker.getTypeAtLocation(node);
|
|
141299
141560
|
}
|
|
141300
|
-
var
|
|
141561
|
+
var fixId17, errorCodes19;
|
|
141301
141562
|
var init_fixAddMissingConstraint = __esm({
|
|
141302
141563
|
"src/services/codefixes/fixAddMissingConstraint.ts"() {
|
|
141303
141564
|
"use strict";
|
|
141304
141565
|
init_ts4();
|
|
141305
141566
|
init_ts_codefix();
|
|
141306
|
-
|
|
141307
|
-
|
|
141567
|
+
fixId17 = "addMissingConstraint";
|
|
141568
|
+
errorCodes19 = [
|
|
141308
141569
|
// We want errors this could be attached to:
|
|
141309
141570
|
// Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
|
|
141310
141571
|
Diagnostics.Type_0_is_not_comparable_to_type_1.code,
|
|
@@ -141317,21 +141578,21 @@ ${lanes.join("\n")}
|
|
|
141317
141578
|
Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
|
|
141318
141579
|
];
|
|
141319
141580
|
registerCodeFix({
|
|
141320
|
-
errorCodes:
|
|
141581
|
+
errorCodes: errorCodes19,
|
|
141321
141582
|
getCodeActions(context) {
|
|
141322
141583
|
const { sourceFile, span, program, preferences, host } = context;
|
|
141323
141584
|
const info = getInfo3(program, sourceFile, span);
|
|
141324
141585
|
if (info === void 0)
|
|
141325
141586
|
return;
|
|
141326
141587
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
|
|
141327
|
-
return [createCodeFixAction(
|
|
141588
|
+
return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
|
|
141328
141589
|
},
|
|
141329
|
-
fixIds: [
|
|
141590
|
+
fixIds: [fixId17],
|
|
141330
141591
|
getAllCodeActions: (context) => {
|
|
141331
141592
|
const { program, preferences, host } = context;
|
|
141332
141593
|
const seen = /* @__PURE__ */ new Map();
|
|
141333
141594
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141334
|
-
eachDiagnostic(context,
|
|
141595
|
+
eachDiagnostic(context, errorCodes19, (diag2) => {
|
|
141335
141596
|
const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
141336
141597
|
if (info) {
|
|
141337
141598
|
if (addToSeen(seen, getNodeId(info.declaration))) {
|
|
@@ -141413,7 +141674,7 @@ ${lanes.join("\n")}
|
|
|
141413
141674
|
Debug.assert(classElement && isClassElementLikeHasJSDoc(classElement));
|
|
141414
141675
|
return classElement;
|
|
141415
141676
|
}
|
|
141416
|
-
var fixName, fixAddOverrideId, fixRemoveOverrideId,
|
|
141677
|
+
var fixName, fixAddOverrideId, fixRemoveOverrideId, errorCodes20, errorCodeFixIdMap;
|
|
141417
141678
|
var init_fixOverrideModifier = __esm({
|
|
141418
141679
|
"src/services/codefixes/fixOverrideModifier.ts"() {
|
|
141419
141680
|
"use strict";
|
|
@@ -141422,7 +141683,7 @@ ${lanes.join("\n")}
|
|
|
141422
141683
|
fixName = "fixOverrideModifier";
|
|
141423
141684
|
fixAddOverrideId = "fixAddOverrideModifier";
|
|
141424
141685
|
fixRemoveOverrideId = "fixRemoveOverrideModifier";
|
|
141425
|
-
|
|
141686
|
+
errorCodes20 = [
|
|
141426
141687
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
|
|
141427
141688
|
Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
141428
141689
|
Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
|
|
@@ -141486,20 +141747,20 @@ ${lanes.join("\n")}
|
|
|
141486
141747
|
}
|
|
141487
141748
|
};
|
|
141488
141749
|
registerCodeFix({
|
|
141489
|
-
errorCodes:
|
|
141750
|
+
errorCodes: errorCodes20,
|
|
141490
141751
|
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
141491
141752
|
const { errorCode, span } = context;
|
|
141492
141753
|
const info = errorCodeFixIdMap[errorCode];
|
|
141493
141754
|
if (!info)
|
|
141494
141755
|
return emptyArray;
|
|
141495
|
-
const { descriptions, fixId:
|
|
141756
|
+
const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
|
|
141496
141757
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
|
|
141497
141758
|
return [
|
|
141498
|
-
createCodeFixActionMaybeFixAll(fixName, changes, descriptions,
|
|
141759
|
+
createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
|
|
141499
141760
|
];
|
|
141500
141761
|
},
|
|
141501
141762
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
141502
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141763
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => {
|
|
141503
141764
|
const { code, start } = diag2;
|
|
141504
141765
|
const info = errorCodeFixIdMap[code];
|
|
141505
141766
|
if (!info || info.fixId !== context.fixId) {
|
|
@@ -141512,7 +141773,7 @@ ${lanes.join("\n")}
|
|
|
141512
141773
|
});
|
|
141513
141774
|
|
|
141514
141775
|
// src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
|
|
141515
|
-
function
|
|
141776
|
+
function doChange7(changes, sourceFile, node, preferences) {
|
|
141516
141777
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
141517
141778
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
141518
141779
|
changes.replaceNode(
|
|
@@ -141524,32 +141785,32 @@ ${lanes.join("\n")}
|
|
|
141524
141785
|
function getPropertyAccessExpression(sourceFile, pos) {
|
|
141525
141786
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isPropertyAccessExpression);
|
|
141526
141787
|
}
|
|
141527
|
-
var
|
|
141788
|
+
var fixId18, errorCodes21;
|
|
141528
141789
|
var init_fixNoPropertyAccessFromIndexSignature = __esm({
|
|
141529
141790
|
"src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts"() {
|
|
141530
141791
|
"use strict";
|
|
141531
141792
|
init_ts4();
|
|
141532
141793
|
init_ts_codefix();
|
|
141533
|
-
|
|
141534
|
-
|
|
141794
|
+
fixId18 = "fixNoPropertyAccessFromIndexSignature";
|
|
141795
|
+
errorCodes21 = [
|
|
141535
141796
|
Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
|
|
141536
141797
|
];
|
|
141537
141798
|
registerCodeFix({
|
|
141538
|
-
errorCodes:
|
|
141539
|
-
fixIds: [
|
|
141799
|
+
errorCodes: errorCodes21,
|
|
141800
|
+
fixIds: [fixId18],
|
|
141540
141801
|
getCodeActions(context) {
|
|
141541
141802
|
const { sourceFile, span, preferences } = context;
|
|
141542
141803
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
141543
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141544
|
-
return [createCodeFixAction(
|
|
141804
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, context.sourceFile, property, preferences));
|
|
141805
|
+
return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
141545
141806
|
},
|
|
141546
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141807
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange7(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
141547
141808
|
});
|
|
141548
141809
|
}
|
|
141549
141810
|
});
|
|
141550
141811
|
|
|
141551
141812
|
// src/services/codefixes/fixImplicitThis.ts
|
|
141552
|
-
function
|
|
141813
|
+
function doChange8(changes, sourceFile, pos, checker) {
|
|
141553
141814
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141554
141815
|
if (!isThis(token))
|
|
141555
141816
|
return void 0;
|
|
@@ -141590,27 +141851,27 @@ ${lanes.join("\n")}
|
|
|
141590
141851
|
}
|
|
141591
141852
|
}
|
|
141592
141853
|
}
|
|
141593
|
-
var
|
|
141854
|
+
var fixId19, errorCodes22;
|
|
141594
141855
|
var init_fixImplicitThis = __esm({
|
|
141595
141856
|
"src/services/codefixes/fixImplicitThis.ts"() {
|
|
141596
141857
|
"use strict";
|
|
141597
141858
|
init_ts4();
|
|
141598
141859
|
init_ts_codefix();
|
|
141599
|
-
|
|
141600
|
-
|
|
141860
|
+
fixId19 = "fixImplicitThis";
|
|
141861
|
+
errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
|
|
141601
141862
|
registerCodeFix({
|
|
141602
|
-
errorCodes:
|
|
141863
|
+
errorCodes: errorCodes22,
|
|
141603
141864
|
getCodeActions: function getCodeActionsToFixImplicitThis(context) {
|
|
141604
141865
|
const { sourceFile, program, span } = context;
|
|
141605
141866
|
let diagnostic;
|
|
141606
141867
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
141607
|
-
diagnostic =
|
|
141868
|
+
diagnostic = doChange8(t, sourceFile, span.start, program.getTypeChecker());
|
|
141608
141869
|
});
|
|
141609
|
-
return diagnostic ? [createCodeFixAction(
|
|
141870
|
+
return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
141610
141871
|
},
|
|
141611
|
-
fixIds: [
|
|
141612
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
141613
|
-
|
|
141872
|
+
fixIds: [fixId19],
|
|
141873
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => {
|
|
141874
|
+
doChange8(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
141614
141875
|
})
|
|
141615
141876
|
});
|
|
141616
141877
|
}
|
|
@@ -141653,7 +141914,7 @@ ${lanes.join("\n")}
|
|
|
141653
141914
|
}
|
|
141654
141915
|
return void 0;
|
|
141655
141916
|
}
|
|
141656
|
-
function
|
|
141917
|
+
function doChange9(changes, program, { exportName, node, moduleSourceFile }) {
|
|
141657
141918
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
141658
141919
|
if (exportDeclaration) {
|
|
141659
141920
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -141735,32 +141996,32 @@ ${lanes.join("\n")}
|
|
|
141735
141996
|
const variableStatement = isVariableDeclaration(declaration) ? tryCast(declaration.parent.parent, isVariableStatement) : void 0;
|
|
141736
141997
|
return variableStatement && length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration;
|
|
141737
141998
|
}
|
|
141738
|
-
var
|
|
141999
|
+
var fixId20, errorCodes23;
|
|
141739
142000
|
var init_fixImportNonExportedMember = __esm({
|
|
141740
142001
|
"src/services/codefixes/fixImportNonExportedMember.ts"() {
|
|
141741
142002
|
"use strict";
|
|
141742
142003
|
init_ts4();
|
|
141743
142004
|
init_ts_codefix();
|
|
141744
|
-
|
|
141745
|
-
|
|
142005
|
+
fixId20 = "fixImportNonExportedMember";
|
|
142006
|
+
errorCodes23 = [
|
|
141746
142007
|
Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
|
|
141747
142008
|
];
|
|
141748
142009
|
registerCodeFix({
|
|
141749
|
-
errorCodes:
|
|
141750
|
-
fixIds: [
|
|
142010
|
+
errorCodes: errorCodes23,
|
|
142011
|
+
fixIds: [fixId20],
|
|
141751
142012
|
getCodeActions(context) {
|
|
141752
142013
|
const { sourceFile, span, program } = context;
|
|
141753
142014
|
const info = getInfo4(sourceFile, span.start, program);
|
|
141754
142015
|
if (info === void 0)
|
|
141755
142016
|
return void 0;
|
|
141756
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141757
|
-
return [createCodeFixAction(
|
|
142017
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, program, info));
|
|
142018
|
+
return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)];
|
|
141758
142019
|
},
|
|
141759
142020
|
getAllCodeActions(context) {
|
|
141760
142021
|
const { program } = context;
|
|
141761
142022
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
141762
142023
|
const exports = /* @__PURE__ */ new Map();
|
|
141763
|
-
eachDiagnostic(context,
|
|
142024
|
+
eachDiagnostic(context, errorCodes23, (diag2) => {
|
|
141764
142025
|
const info = getInfo4(diag2.file, diag2.start, program);
|
|
141765
142026
|
if (info === void 0)
|
|
141766
142027
|
return void 0;
|
|
@@ -141805,7 +142066,7 @@ ${lanes.join("\n")}
|
|
|
141805
142066
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
141806
142067
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
141807
142068
|
}
|
|
141808
|
-
function
|
|
142069
|
+
function doChange10(changes, sourceFile, namedTupleMember) {
|
|
141809
142070
|
if (!namedTupleMember) {
|
|
141810
142071
|
return;
|
|
141811
142072
|
}
|
|
@@ -141832,26 +142093,26 @@ ${lanes.join("\n")}
|
|
|
141832
142093
|
}
|
|
141833
142094
|
changes.replaceNode(sourceFile, namedTupleMember, updated);
|
|
141834
142095
|
}
|
|
141835
|
-
var
|
|
142096
|
+
var fixId21, errorCodes24;
|
|
141836
142097
|
var init_fixIncorrectNamedTupleSyntax = __esm({
|
|
141837
142098
|
"src/services/codefixes/fixIncorrectNamedTupleSyntax.ts"() {
|
|
141838
142099
|
"use strict";
|
|
141839
142100
|
init_ts4();
|
|
141840
142101
|
init_ts_codefix();
|
|
141841
|
-
|
|
141842
|
-
|
|
142102
|
+
fixId21 = "fixIncorrectNamedTupleSyntax";
|
|
142103
|
+
errorCodes24 = [
|
|
141843
142104
|
Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type.code,
|
|
141844
142105
|
Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
|
|
141845
142106
|
];
|
|
141846
142107
|
registerCodeFix({
|
|
141847
|
-
errorCodes:
|
|
142108
|
+
errorCodes: errorCodes24,
|
|
141848
142109
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
141849
142110
|
const { sourceFile, span } = context;
|
|
141850
142111
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
141851
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141852
|
-
return [createCodeFixAction(
|
|
142112
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, namedTupleMember));
|
|
142113
|
+
return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
141853
142114
|
},
|
|
141854
|
-
fixIds: [
|
|
142115
|
+
fixIds: [fixId21]
|
|
141855
142116
|
});
|
|
141856
142117
|
}
|
|
141857
142118
|
});
|
|
@@ -141906,7 +142167,7 @@ ${lanes.join("\n")}
|
|
|
141906
142167
|
}
|
|
141907
142168
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
141908
142169
|
}
|
|
141909
|
-
function
|
|
142170
|
+
function doChange11(changes, sourceFile, node, suggestedSymbol, target) {
|
|
141910
142171
|
const suggestion = symbolName(suggestedSymbol);
|
|
141911
142172
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
141912
142173
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -141940,14 +142201,14 @@ ${lanes.join("\n")}
|
|
|
141940
142201
|
return void 0;
|
|
141941
142202
|
return context.program.getSourceFile(resolvedModule.resolvedFileName);
|
|
141942
142203
|
}
|
|
141943
|
-
var
|
|
142204
|
+
var fixId22, errorCodes25;
|
|
141944
142205
|
var init_fixSpelling = __esm({
|
|
141945
142206
|
"src/services/codefixes/fixSpelling.ts"() {
|
|
141946
142207
|
"use strict";
|
|
141947
142208
|
init_ts4();
|
|
141948
142209
|
init_ts_codefix();
|
|
141949
|
-
|
|
141950
|
-
|
|
142210
|
+
fixId22 = "fixSpelling";
|
|
142211
|
+
errorCodes25 = [
|
|
141951
142212
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141952
142213
|
Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
|
|
141953
142214
|
Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
|
|
@@ -141964,7 +142225,7 @@ ${lanes.join("\n")}
|
|
|
141964
142225
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code
|
|
141965
142226
|
];
|
|
141966
142227
|
registerCodeFix({
|
|
141967
|
-
errorCodes:
|
|
142228
|
+
errorCodes: errorCodes25,
|
|
141968
142229
|
getCodeActions(context) {
|
|
141969
142230
|
const { sourceFile, errorCode } = context;
|
|
141970
142231
|
const info = getInfo5(sourceFile, context.span.start, context, errorCode);
|
|
@@ -141972,15 +142233,15 @@ ${lanes.join("\n")}
|
|
|
141972
142233
|
return void 0;
|
|
141973
142234
|
const { node, suggestedSymbol } = info;
|
|
141974
142235
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141975
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141976
|
-
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)],
|
|
142236
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, node, suggestedSymbol, target));
|
|
142237
|
+
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
141977
142238
|
},
|
|
141978
|
-
fixIds: [
|
|
141979
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142239
|
+
fixIds: [fixId22],
|
|
142240
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
|
|
141980
142241
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
141981
142242
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
141982
142243
|
if (info)
|
|
141983
|
-
|
|
142244
|
+
doChange11(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
141984
142245
|
})
|
|
141985
142246
|
});
|
|
141986
142247
|
}
|
|
@@ -142164,7 +142425,7 @@ ${lanes.join("\n")}
|
|
|
142164
142425
|
}
|
|
142165
142426
|
function getActionForfixAddReturnStatement(context, expression, statement) {
|
|
142166
142427
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
|
|
142167
|
-
return createCodeFixAction(
|
|
142428
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
|
|
142168
142429
|
}
|
|
142169
142430
|
function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
|
|
142170
142431
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
|
|
@@ -142176,29 +142437,29 @@ ${lanes.join("\n")}
|
|
|
142176
142437
|
/* withParen */
|
|
142177
142438
|
false
|
|
142178
142439
|
));
|
|
142179
|
-
return createCodeFixAction(
|
|
142440
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
|
|
142180
142441
|
}
|
|
142181
142442
|
function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
|
|
142182
142443
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
|
|
142183
|
-
return createCodeFixAction(
|
|
142444
|
+
return createCodeFixAction(fixId23, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses);
|
|
142184
142445
|
}
|
|
142185
|
-
var
|
|
142446
|
+
var fixId23, fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen, errorCodes26;
|
|
142186
142447
|
var init_returnValueCorrect = __esm({
|
|
142187
142448
|
"src/services/codefixes/returnValueCorrect.ts"() {
|
|
142188
142449
|
"use strict";
|
|
142189
142450
|
init_ts4();
|
|
142190
142451
|
init_ts_codefix();
|
|
142191
|
-
|
|
142452
|
+
fixId23 = "returnValueCorrect";
|
|
142192
142453
|
fixIdAddReturnStatement = "fixAddReturnStatement";
|
|
142193
142454
|
fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
|
|
142194
142455
|
fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
|
|
142195
|
-
|
|
142456
|
+
errorCodes26 = [
|
|
142196
142457
|
Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
|
|
142197
142458
|
Diagnostics.Type_0_is_not_assignable_to_type_1.code,
|
|
142198
142459
|
Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
|
|
142199
142460
|
];
|
|
142200
142461
|
registerCodeFix({
|
|
142201
|
-
errorCodes:
|
|
142462
|
+
errorCodes: errorCodes26,
|
|
142202
142463
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
142203
142464
|
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
142204
142465
|
const { program, sourceFile, span: { start }, errorCode } = context;
|
|
@@ -142214,7 +142475,7 @@ ${lanes.join("\n")}
|
|
|
142214
142475
|
return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
|
|
142215
142476
|
}
|
|
142216
142477
|
},
|
|
142217
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
142478
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
|
|
142218
142479
|
const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
|
|
142219
142480
|
if (!info)
|
|
142220
142481
|
return void 0;
|
|
@@ -142780,7 +143041,7 @@ ${lanes.join("\n")}
|
|
|
142780
143041
|
}
|
|
142781
143042
|
return getSourceFileOfNode(node);
|
|
142782
143043
|
}
|
|
142783
|
-
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration,
|
|
143044
|
+
var fixMissingMember, fixMissingProperties, fixMissingAttributes, fixMissingFunctionDeclaration, errorCodes27;
|
|
142784
143045
|
var init_fixAddMissingMember = __esm({
|
|
142785
143046
|
"src/services/codefixes/fixAddMissingMember.ts"() {
|
|
142786
143047
|
"use strict";
|
|
@@ -142790,7 +143051,7 @@ ${lanes.join("\n")}
|
|
|
142790
143051
|
fixMissingProperties = "fixMissingProperties";
|
|
142791
143052
|
fixMissingAttributes = "fixMissingAttributes";
|
|
142792
143053
|
fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
|
|
142793
|
-
|
|
143054
|
+
errorCodes27 = [
|
|
142794
143055
|
Diagnostics.Property_0_does_not_exist_on_type_1.code,
|
|
142795
143056
|
Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
|
|
142796
143057
|
Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
|
|
@@ -142800,7 +143061,7 @@ ${lanes.join("\n")}
|
|
|
142800
143061
|
Diagnostics.Cannot_find_name_0.code
|
|
142801
143062
|
];
|
|
142802
143063
|
registerCodeFix({
|
|
142803
|
-
errorCodes:
|
|
143064
|
+
errorCodes: errorCodes27,
|
|
142804
143065
|
getCodeActions(context) {
|
|
142805
143066
|
const typeChecker = context.program.getTypeChecker();
|
|
142806
143067
|
const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
|
|
@@ -142827,21 +143088,21 @@ ${lanes.join("\n")}
|
|
|
142827
143088
|
},
|
|
142828
143089
|
fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
|
|
142829
143090
|
getAllCodeActions: (context) => {
|
|
142830
|
-
const { program, fixId:
|
|
143091
|
+
const { program, fixId: fixId52 } = context;
|
|
142831
143092
|
const checker = program.getTypeChecker();
|
|
142832
143093
|
const seen = /* @__PURE__ */ new Map();
|
|
142833
143094
|
const typeDeclToMembers = /* @__PURE__ */ new Map();
|
|
142834
143095
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
142835
|
-
eachDiagnostic(context,
|
|
143096
|
+
eachDiagnostic(context, errorCodes27, (diag2) => {
|
|
142836
143097
|
const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program);
|
|
142837
143098
|
if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
|
|
142838
143099
|
return;
|
|
142839
143100
|
}
|
|
142840
|
-
if (
|
|
143101
|
+
if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
|
|
142841
143102
|
addFunctionDeclaration(changes, context, info);
|
|
142842
|
-
} else if (
|
|
143103
|
+
} else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
|
|
142843
143104
|
addObjectLiteralProperties(changes, context, info);
|
|
142844
|
-
} else if (
|
|
143105
|
+
} else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
|
|
142845
143106
|
addJsxAttributes(changes, context, info);
|
|
142846
143107
|
} else {
|
|
142847
143108
|
if (info.kind === 1 /* Enum */) {
|
|
@@ -142897,23 +143158,23 @@ ${lanes.join("\n")}
|
|
|
142897
143158
|
}
|
|
142898
143159
|
return token;
|
|
142899
143160
|
}
|
|
142900
|
-
var
|
|
143161
|
+
var fixId24, errorCodes28;
|
|
142901
143162
|
var init_fixAddMissingNewOperator = __esm({
|
|
142902
143163
|
"src/services/codefixes/fixAddMissingNewOperator.ts"() {
|
|
142903
143164
|
"use strict";
|
|
142904
143165
|
init_ts4();
|
|
142905
143166
|
init_ts_codefix();
|
|
142906
|
-
|
|
142907
|
-
|
|
143167
|
+
fixId24 = "addMissingNewOperator";
|
|
143168
|
+
errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
|
|
142908
143169
|
registerCodeFix({
|
|
142909
|
-
errorCodes:
|
|
143170
|
+
errorCodes: errorCodes28,
|
|
142910
143171
|
getCodeActions(context) {
|
|
142911
143172
|
const { sourceFile, span } = context;
|
|
142912
143173
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
|
|
142913
|
-
return [createCodeFixAction(
|
|
143174
|
+
return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)];
|
|
142914
143175
|
},
|
|
142915
|
-
fixIds: [
|
|
142916
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143176
|
+
fixIds: [fixId24],
|
|
143177
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
|
|
142917
143178
|
});
|
|
142918
143179
|
}
|
|
142919
143180
|
});
|
|
@@ -142934,7 +143195,7 @@ ${lanes.join("\n")}
|
|
|
142934
143195
|
var _a2;
|
|
142935
143196
|
return diagCode === errorCodeCannotFindModule ? ts_JsTyping_exports.nodeCoreModules.has(packageName) ? "@types/node" : void 0 : ((_a2 = host.isKnownTypesPackageName) == null ? void 0 : _a2.call(host, packageName)) ? getTypesPackageName(packageName) : void 0;
|
|
142936
143197
|
}
|
|
142937
|
-
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule,
|
|
143198
|
+
var fixName2, fixIdInstallTypesPackage, errorCodeCannotFindModule, errorCodes29;
|
|
142938
143199
|
var init_fixCannotFindModule = __esm({
|
|
142939
143200
|
"src/services/codefixes/fixCannotFindModule.ts"() {
|
|
142940
143201
|
"use strict";
|
|
@@ -142943,12 +143204,12 @@ ${lanes.join("\n")}
|
|
|
142943
143204
|
fixName2 = "fixCannotFindModule";
|
|
142944
143205
|
fixIdInstallTypesPackage = "installTypesPackage";
|
|
142945
143206
|
errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
|
|
142946
|
-
|
|
143207
|
+
errorCodes29 = [
|
|
142947
143208
|
errorCodeCannotFindModule,
|
|
142948
143209
|
Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
|
|
142949
143210
|
];
|
|
142950
143211
|
registerCodeFix({
|
|
142951
|
-
errorCodes:
|
|
143212
|
+
errorCodes: errorCodes29,
|
|
142952
143213
|
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
142953
143214
|
const { host, sourceFile, span: { start } } = context;
|
|
142954
143215
|
const packageName = tryGetImportedPackageName(sourceFile, start);
|
|
@@ -142967,7 +143228,7 @@ ${lanes.join("\n")}
|
|
|
142967
143228
|
},
|
|
142968
143229
|
fixIds: [fixIdInstallTypesPackage],
|
|
142969
143230
|
getAllCodeActions: (context) => {
|
|
142970
|
-
return codeFixAll(context,
|
|
143231
|
+
return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => {
|
|
142971
143232
|
const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
|
|
142972
143233
|
if (packageName === void 0)
|
|
142973
143234
|
return void 0;
|
|
@@ -143006,28 +143267,28 @@ ${lanes.join("\n")}
|
|
|
143006
143267
|
const flags = getSyntacticModifierFlags(first(symbol.getDeclarations()));
|
|
143007
143268
|
return !(flags & 8 /* Private */) && !!(flags & 256 /* Abstract */);
|
|
143008
143269
|
}
|
|
143009
|
-
var
|
|
143270
|
+
var errorCodes30, fixId25;
|
|
143010
143271
|
var init_fixClassDoesntImplementInheritedAbstractMember = __esm({
|
|
143011
143272
|
"src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts"() {
|
|
143012
143273
|
"use strict";
|
|
143013
143274
|
init_ts4();
|
|
143014
143275
|
init_ts_codefix();
|
|
143015
|
-
|
|
143276
|
+
errorCodes30 = [
|
|
143016
143277
|
Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
|
|
143017
143278
|
Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code
|
|
143018
143279
|
];
|
|
143019
|
-
|
|
143280
|
+
fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
|
|
143020
143281
|
registerCodeFix({
|
|
143021
|
-
errorCodes:
|
|
143282
|
+
errorCodes: errorCodes30,
|
|
143022
143283
|
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
143023
143284
|
const { sourceFile, span } = context;
|
|
143024
143285
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
|
|
143025
|
-
return changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
143286
|
+
return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
143026
143287
|
},
|
|
143027
|
-
fixIds: [
|
|
143288
|
+
fixIds: [fixId25],
|
|
143028
143289
|
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
143029
143290
|
const seenClassDeclarations = /* @__PURE__ */ new Map();
|
|
143030
|
-
return codeFixAll(context,
|
|
143291
|
+
return codeFixAll(context, errorCodes30, (changes, diag2) => {
|
|
143031
143292
|
const classDeclaration = getClass2(diag2.file, diag2.start);
|
|
143032
143293
|
if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
|
|
143033
143294
|
addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
|
|
@@ -143039,7 +143300,7 @@ ${lanes.join("\n")}
|
|
|
143039
143300
|
});
|
|
143040
143301
|
|
|
143041
143302
|
// src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
|
|
143042
|
-
function
|
|
143303
|
+
function doChange12(changes, sourceFile, constructor, superCall) {
|
|
143043
143304
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
143044
143305
|
changes.delete(sourceFile, superCall);
|
|
143045
143306
|
}
|
|
@@ -143054,36 +143315,36 @@ ${lanes.join("\n")}
|
|
|
143054
143315
|
function findSuperCall(n) {
|
|
143055
143316
|
return isExpressionStatement(n) && isSuperCall(n.expression) ? n : isFunctionLike(n) ? void 0 : forEachChild(n, findSuperCall);
|
|
143056
143317
|
}
|
|
143057
|
-
var
|
|
143318
|
+
var fixId26, errorCodes31;
|
|
143058
143319
|
var init_fixClassSuperMustPrecedeThisAccess = __esm({
|
|
143059
143320
|
"src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts"() {
|
|
143060
143321
|
"use strict";
|
|
143061
143322
|
init_ts4();
|
|
143062
143323
|
init_ts_codefix();
|
|
143063
|
-
|
|
143064
|
-
|
|
143324
|
+
fixId26 = "classSuperMustPrecedeThisAccess";
|
|
143325
|
+
errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
|
|
143065
143326
|
registerCodeFix({
|
|
143066
|
-
errorCodes:
|
|
143327
|
+
errorCodes: errorCodes31,
|
|
143067
143328
|
getCodeActions(context) {
|
|
143068
143329
|
const { sourceFile, span } = context;
|
|
143069
143330
|
const nodes = getNodes(sourceFile, span.start);
|
|
143070
143331
|
if (!nodes)
|
|
143071
143332
|
return void 0;
|
|
143072
143333
|
const { constructor, superCall } = nodes;
|
|
143073
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143074
|
-
return [createCodeFixAction(
|
|
143334
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, constructor, superCall));
|
|
143335
|
+
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)];
|
|
143075
143336
|
},
|
|
143076
|
-
fixIds: [
|
|
143337
|
+
fixIds: [fixId26],
|
|
143077
143338
|
getAllCodeActions(context) {
|
|
143078
143339
|
const { sourceFile } = context;
|
|
143079
143340
|
const seenClasses = /* @__PURE__ */ new Map();
|
|
143080
|
-
return codeFixAll(context,
|
|
143341
|
+
return codeFixAll(context, errorCodes31, (changes, diag2) => {
|
|
143081
143342
|
const nodes = getNodes(diag2.file, diag2.start);
|
|
143082
143343
|
if (!nodes)
|
|
143083
143344
|
return;
|
|
143084
143345
|
const { constructor, superCall } = nodes;
|
|
143085
143346
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
143086
|
-
|
|
143347
|
+
doChange12(changes, sourceFile, constructor, superCall);
|
|
143087
143348
|
}
|
|
143088
143349
|
});
|
|
143089
143350
|
}
|
|
@@ -143097,7 +143358,7 @@ ${lanes.join("\n")}
|
|
|
143097
143358
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
143098
143359
|
return token.parent;
|
|
143099
143360
|
}
|
|
143100
|
-
function
|
|
143361
|
+
function doChange13(changes, sourceFile, ctr) {
|
|
143101
143362
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
143102
143363
|
factory.createSuper(),
|
|
143103
143364
|
/*typeArguments*/
|
|
@@ -143107,42 +143368,42 @@ ${lanes.join("\n")}
|
|
|
143107
143368
|
));
|
|
143108
143369
|
changes.insertNodeAtConstructorStart(sourceFile, ctr, superCall);
|
|
143109
143370
|
}
|
|
143110
|
-
var
|
|
143371
|
+
var fixId27, errorCodes32;
|
|
143111
143372
|
var init_fixConstructorForDerivedNeedSuperCall = __esm({
|
|
143112
143373
|
"src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts"() {
|
|
143113
143374
|
"use strict";
|
|
143114
143375
|
init_ts4();
|
|
143115
143376
|
init_ts_codefix();
|
|
143116
|
-
|
|
143117
|
-
|
|
143377
|
+
fixId27 = "constructorForDerivedNeedSuperCall";
|
|
143378
|
+
errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
|
|
143118
143379
|
registerCodeFix({
|
|
143119
|
-
errorCodes:
|
|
143380
|
+
errorCodes: errorCodes32,
|
|
143120
143381
|
getCodeActions(context) {
|
|
143121
143382
|
const { sourceFile, span } = context;
|
|
143122
143383
|
const ctr = getNode(sourceFile, span.start);
|
|
143123
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143124
|
-
return [createCodeFixAction(
|
|
143384
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, ctr));
|
|
143385
|
+
return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
|
|
143125
143386
|
},
|
|
143126
|
-
fixIds: [
|
|
143127
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143387
|
+
fixIds: [fixId27],
|
|
143388
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange13(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
143128
143389
|
});
|
|
143129
143390
|
}
|
|
143130
143391
|
});
|
|
143131
143392
|
|
|
143132
143393
|
// src/services/codefixes/fixEnableJsxFlag.ts
|
|
143133
|
-
function
|
|
143394
|
+
function doChange14(changeTracker, configFile) {
|
|
143134
143395
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
143135
143396
|
}
|
|
143136
|
-
var fixID,
|
|
143397
|
+
var fixID, errorCodes33;
|
|
143137
143398
|
var init_fixEnableJsxFlag = __esm({
|
|
143138
143399
|
"src/services/codefixes/fixEnableJsxFlag.ts"() {
|
|
143139
143400
|
"use strict";
|
|
143140
143401
|
init_ts4();
|
|
143141
143402
|
init_ts_codefix();
|
|
143142
143403
|
fixID = "fixEnableJsxFlag";
|
|
143143
|
-
|
|
143404
|
+
errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
143144
143405
|
registerCodeFix({
|
|
143145
|
-
errorCodes:
|
|
143406
|
+
errorCodes: errorCodes33,
|
|
143146
143407
|
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
143147
143408
|
const { configFile } = context.program.getCompilerOptions();
|
|
143148
143409
|
if (configFile === void 0) {
|
|
@@ -143150,19 +143411,19 @@ ${lanes.join("\n")}
|
|
|
143150
143411
|
}
|
|
143151
143412
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
143152
143413
|
context,
|
|
143153
|
-
(changeTracker) =>
|
|
143414
|
+
(changeTracker) => doChange14(changeTracker, configFile)
|
|
143154
143415
|
);
|
|
143155
143416
|
return [
|
|
143156
143417
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
143157
143418
|
];
|
|
143158
143419
|
},
|
|
143159
143420
|
fixIds: [fixID],
|
|
143160
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143421
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => {
|
|
143161
143422
|
const { configFile } = context.program.getCompilerOptions();
|
|
143162
143423
|
if (configFile === void 0) {
|
|
143163
143424
|
return void 0;
|
|
143164
143425
|
}
|
|
143165
|
-
|
|
143426
|
+
doChange14(changes, configFile);
|
|
143166
143427
|
})
|
|
143167
143428
|
});
|
|
143168
143429
|
}
|
|
@@ -143184,7 +143445,7 @@ ${lanes.join("\n")}
|
|
|
143184
143445
|
}
|
|
143185
143446
|
return void 0;
|
|
143186
143447
|
}
|
|
143187
|
-
function
|
|
143448
|
+
function doChange15(changes, sourceFile, arg, expression) {
|
|
143188
143449
|
const callExpression = factory.createCallExpression(
|
|
143189
143450
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
143190
143451
|
/*typeArguments*/
|
|
@@ -143202,33 +143463,33 @@ ${lanes.join("\n")}
|
|
|
143202
143463
|
const [_, suggestion] = flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [];
|
|
143203
143464
|
return suggestion;
|
|
143204
143465
|
}
|
|
143205
|
-
var
|
|
143466
|
+
var fixId28, errorCodes34;
|
|
143206
143467
|
var init_fixNaNEquality = __esm({
|
|
143207
143468
|
"src/services/codefixes/fixNaNEquality.ts"() {
|
|
143208
143469
|
"use strict";
|
|
143209
143470
|
init_ts4();
|
|
143210
143471
|
init_ts_codefix();
|
|
143211
|
-
|
|
143212
|
-
|
|
143472
|
+
fixId28 = "fixNaNEquality";
|
|
143473
|
+
errorCodes34 = [
|
|
143213
143474
|
Diagnostics.This_condition_will_always_return_0.code
|
|
143214
143475
|
];
|
|
143215
143476
|
registerCodeFix({
|
|
143216
|
-
errorCodes:
|
|
143477
|
+
errorCodes: errorCodes34,
|
|
143217
143478
|
getCodeActions(context) {
|
|
143218
143479
|
const { sourceFile, span, program } = context;
|
|
143219
143480
|
const info = getInfo8(program, sourceFile, span);
|
|
143220
143481
|
if (info === void 0)
|
|
143221
143482
|
return;
|
|
143222
143483
|
const { suggestion, expression, arg } = info;
|
|
143223
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143224
|
-
return [createCodeFixAction(
|
|
143484
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, arg, expression));
|
|
143485
|
+
return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
143225
143486
|
},
|
|
143226
|
-
fixIds: [
|
|
143487
|
+
fixIds: [fixId28],
|
|
143227
143488
|
getAllCodeActions: (context) => {
|
|
143228
|
-
return codeFixAll(context,
|
|
143489
|
+
return codeFixAll(context, errorCodes34, (changes, diag2) => {
|
|
143229
143490
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
143230
143491
|
if (info) {
|
|
143231
|
-
|
|
143492
|
+
doChange15(changes, diag2.file, info.arg, info.expression);
|
|
143232
143493
|
}
|
|
143233
143494
|
});
|
|
143234
143495
|
}
|
|
@@ -143284,32 +143545,32 @@ ${lanes.join("\n")}
|
|
|
143284
143545
|
});
|
|
143285
143546
|
|
|
143286
143547
|
// src/services/codefixes/fixPropertyAssignment.ts
|
|
143287
|
-
function
|
|
143548
|
+
function doChange16(changes, sourceFile, node) {
|
|
143288
143549
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
143289
143550
|
}
|
|
143290
143551
|
function getProperty2(sourceFile, pos) {
|
|
143291
143552
|
return cast(getTokenAtPosition(sourceFile, pos).parent, isShorthandPropertyAssignment);
|
|
143292
143553
|
}
|
|
143293
|
-
var
|
|
143554
|
+
var fixId29, errorCodes35;
|
|
143294
143555
|
var init_fixPropertyAssignment = __esm({
|
|
143295
143556
|
"src/services/codefixes/fixPropertyAssignment.ts"() {
|
|
143296
143557
|
"use strict";
|
|
143297
143558
|
init_ts4();
|
|
143298
143559
|
init_ts_codefix();
|
|
143299
|
-
|
|
143300
|
-
|
|
143560
|
+
fixId29 = "fixPropertyAssignment";
|
|
143561
|
+
errorCodes35 = [
|
|
143301
143562
|
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
|
|
143302
143563
|
];
|
|
143303
143564
|
registerCodeFix({
|
|
143304
|
-
errorCodes:
|
|
143305
|
-
fixIds: [
|
|
143565
|
+
errorCodes: errorCodes35,
|
|
143566
|
+
fixIds: [fixId29],
|
|
143306
143567
|
getCodeActions(context) {
|
|
143307
143568
|
const { sourceFile, span } = context;
|
|
143308
143569
|
const property = getProperty2(sourceFile, span.start);
|
|
143309
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143310
|
-
return [createCodeFixAction(
|
|
143570
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, context.sourceFile, property));
|
|
143571
|
+
return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
143311
143572
|
},
|
|
143312
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143573
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange16(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
143313
143574
|
});
|
|
143314
143575
|
}
|
|
143315
143576
|
});
|
|
@@ -143335,16 +143596,16 @@ ${lanes.join("\n")}
|
|
|
143335
143596
|
changes.deleteRange(sourceFile, { pos: implementsToken.getStart(), end });
|
|
143336
143597
|
}
|
|
143337
143598
|
}
|
|
143338
|
-
var
|
|
143599
|
+
var fixId30, errorCodes36;
|
|
143339
143600
|
var init_fixExtendsInterfaceBecomesImplements = __esm({
|
|
143340
143601
|
"src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts"() {
|
|
143341
143602
|
"use strict";
|
|
143342
143603
|
init_ts4();
|
|
143343
143604
|
init_ts_codefix();
|
|
143344
|
-
|
|
143345
|
-
|
|
143605
|
+
fixId30 = "extendsInterfaceBecomesImplements";
|
|
143606
|
+
errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
|
|
143346
143607
|
registerCodeFix({
|
|
143347
|
-
errorCodes:
|
|
143608
|
+
errorCodes: errorCodes36,
|
|
143348
143609
|
getCodeActions(context) {
|
|
143349
143610
|
const { sourceFile } = context;
|
|
143350
143611
|
const nodes = getNodes2(sourceFile, context.span.start);
|
|
@@ -143352,10 +143613,10 @@ ${lanes.join("\n")}
|
|
|
143352
143613
|
return void 0;
|
|
143353
143614
|
const { extendsToken, heritageClauses } = nodes;
|
|
143354
143615
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
|
|
143355
|
-
return [createCodeFixAction(
|
|
143616
|
+
return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
|
|
143356
143617
|
},
|
|
143357
|
-
fixIds: [
|
|
143358
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143618
|
+
fixIds: [fixId30],
|
|
143619
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
143359
143620
|
const nodes = getNodes2(diag2.file, diag2.start);
|
|
143360
143621
|
if (nodes)
|
|
143361
143622
|
doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
|
|
@@ -143371,39 +143632,39 @@ ${lanes.join("\n")}
|
|
|
143371
143632
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
143372
143633
|
}
|
|
143373
143634
|
}
|
|
143374
|
-
function
|
|
143635
|
+
function doChange17(changes, sourceFile, { node, className }) {
|
|
143375
143636
|
suppressLeadingAndTrailingTrivia(node);
|
|
143376
143637
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
143377
143638
|
}
|
|
143378
|
-
var
|
|
143639
|
+
var fixId31, didYouMeanStaticMemberCode, errorCodes37;
|
|
143379
143640
|
var init_fixForgottenThisPropertyAccess = __esm({
|
|
143380
143641
|
"src/services/codefixes/fixForgottenThisPropertyAccess.ts"() {
|
|
143381
143642
|
"use strict";
|
|
143382
143643
|
init_ts4();
|
|
143383
143644
|
init_ts_codefix();
|
|
143384
|
-
|
|
143645
|
+
fixId31 = "forgottenThisPropertyAccess";
|
|
143385
143646
|
didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
|
|
143386
|
-
|
|
143647
|
+
errorCodes37 = [
|
|
143387
143648
|
Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
|
|
143388
143649
|
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,
|
|
143389
143650
|
didYouMeanStaticMemberCode
|
|
143390
143651
|
];
|
|
143391
143652
|
registerCodeFix({
|
|
143392
|
-
errorCodes:
|
|
143653
|
+
errorCodes: errorCodes37,
|
|
143393
143654
|
getCodeActions(context) {
|
|
143394
143655
|
const { sourceFile } = context;
|
|
143395
143656
|
const info = getInfo9(sourceFile, context.span.start, context.errorCode);
|
|
143396
143657
|
if (!info) {
|
|
143397
143658
|
return void 0;
|
|
143398
143659
|
}
|
|
143399
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143400
|
-
return [createCodeFixAction(
|
|
143660
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, info));
|
|
143661
|
+
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)];
|
|
143401
143662
|
},
|
|
143402
|
-
fixIds: [
|
|
143403
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
143663
|
+
fixIds: [fixId31],
|
|
143664
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
|
|
143404
143665
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
143405
143666
|
if (info)
|
|
143406
|
-
|
|
143667
|
+
doChange17(changes, context.sourceFile, info);
|
|
143407
143668
|
})
|
|
143408
143669
|
});
|
|
143409
143670
|
}
|
|
@@ -143413,7 +143674,7 @@ ${lanes.join("\n")}
|
|
|
143413
143674
|
function isValidCharacter(character) {
|
|
143414
143675
|
return hasProperty(htmlEntity, character);
|
|
143415
143676
|
}
|
|
143416
|
-
function
|
|
143677
|
+
function doChange18(changes, preferences, sourceFile, start, useHtmlEntity) {
|
|
143417
143678
|
const character = sourceFile.getText()[start];
|
|
143418
143679
|
if (!isValidCharacter(character)) {
|
|
143419
143680
|
return;
|
|
@@ -143421,7 +143682,7 @@ ${lanes.join("\n")}
|
|
|
143421
143682
|
const replacement = useHtmlEntity ? htmlEntity[character] : `{${quote(sourceFile, preferences, character)}}`;
|
|
143422
143683
|
changes.replaceRangeWithText(sourceFile, { pos: start, end: start + 1 }, replacement);
|
|
143423
143684
|
}
|
|
143424
|
-
var fixIdExpression, fixIdHtmlEntity,
|
|
143685
|
+
var fixIdExpression, fixIdHtmlEntity, errorCodes38, htmlEntity;
|
|
143425
143686
|
var init_fixInvalidJsxCharacters = __esm({
|
|
143426
143687
|
"src/services/codefixes/fixInvalidJsxCharacters.ts"() {
|
|
143427
143688
|
"use strict";
|
|
@@ -143429,16 +143690,16 @@ ${lanes.join("\n")}
|
|
|
143429
143690
|
init_ts_codefix();
|
|
143430
143691
|
fixIdExpression = "fixInvalidJsxCharacters_expression";
|
|
143431
143692
|
fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
|
|
143432
|
-
|
|
143693
|
+
errorCodes38 = [
|
|
143433
143694
|
Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
|
|
143434
143695
|
Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
|
|
143435
143696
|
];
|
|
143436
143697
|
registerCodeFix({
|
|
143437
|
-
errorCodes:
|
|
143698
|
+
errorCodes: errorCodes38,
|
|
143438
143699
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
143439
143700
|
getCodeActions(context) {
|
|
143440
143701
|
const { sourceFile, preferences, span } = context;
|
|
143441
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143702
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143442
143703
|
t,
|
|
143443
143704
|
preferences,
|
|
143444
143705
|
sourceFile,
|
|
@@ -143446,7 +143707,7 @@ ${lanes.join("\n")}
|
|
|
143446
143707
|
/* useHtmlEntity */
|
|
143447
143708
|
false
|
|
143448
143709
|
));
|
|
143449
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143710
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
|
|
143450
143711
|
t,
|
|
143451
143712
|
preferences,
|
|
143452
143713
|
sourceFile,
|
|
@@ -143460,7 +143721,7 @@ ${lanes.join("\n")}
|
|
|
143460
143721
|
];
|
|
143461
143722
|
},
|
|
143462
143723
|
getAllCodeActions(context) {
|
|
143463
|
-
return codeFixAll(context,
|
|
143724
|
+
return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange18(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
143464
143725
|
}
|
|
143465
143726
|
});
|
|
143466
143727
|
htmlEntity = {
|
|
@@ -143519,7 +143780,7 @@ ${lanes.join("\n")}
|
|
|
143519
143780
|
}
|
|
143520
143781
|
return void 0;
|
|
143521
143782
|
}
|
|
143522
|
-
var deleteUnmatchedParameter, renameUnmatchedParameter,
|
|
143783
|
+
var deleteUnmatchedParameter, renameUnmatchedParameter, errorCodes39;
|
|
143523
143784
|
var init_fixUnmatchedParameter = __esm({
|
|
143524
143785
|
"src/services/codefixes/fixUnmatchedParameter.ts"() {
|
|
143525
143786
|
"use strict";
|
|
@@ -143527,12 +143788,12 @@ ${lanes.join("\n")}
|
|
|
143527
143788
|
init_ts_codefix();
|
|
143528
143789
|
deleteUnmatchedParameter = "deleteUnmatchedParameter";
|
|
143529
143790
|
renameUnmatchedParameter = "renameUnmatchedParameter";
|
|
143530
|
-
|
|
143791
|
+
errorCodes39 = [
|
|
143531
143792
|
Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
|
|
143532
143793
|
];
|
|
143533
143794
|
registerCodeFix({
|
|
143534
143795
|
fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
|
|
143535
|
-
errorCodes:
|
|
143796
|
+
errorCodes: errorCodes39,
|
|
143536
143797
|
getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
|
|
143537
143798
|
const { sourceFile, span } = context;
|
|
143538
143799
|
const actions2 = [];
|
|
@@ -143547,7 +143808,7 @@ ${lanes.join("\n")}
|
|
|
143547
143808
|
getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
|
|
143548
143809
|
const tagsToSignature = /* @__PURE__ */ new Map();
|
|
143549
143810
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
143550
|
-
eachDiagnostic(context,
|
|
143811
|
+
eachDiagnostic(context, errorCodes39, ({ file, start }) => {
|
|
143551
143812
|
const info = getInfo10(file, start);
|
|
143552
143813
|
if (info) {
|
|
143553
143814
|
tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
|
|
@@ -143596,16 +143857,16 @@ ${lanes.join("\n")}
|
|
|
143596
143857
|
function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) {
|
|
143597
143858
|
ts_refactor_exports.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent);
|
|
143598
143859
|
}
|
|
143599
|
-
var
|
|
143860
|
+
var fixId32, errorCodes40;
|
|
143600
143861
|
var init_fixUnreferenceableDecoratorMetadata = __esm({
|
|
143601
143862
|
"src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts"() {
|
|
143602
143863
|
"use strict";
|
|
143603
143864
|
init_ts4();
|
|
143604
143865
|
init_ts_codefix();
|
|
143605
|
-
|
|
143606
|
-
|
|
143866
|
+
fixId32 = "fixUnreferenceableDecoratorMetadata";
|
|
143867
|
+
errorCodes40 = [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];
|
|
143607
143868
|
registerCodeFix({
|
|
143608
|
-
errorCodes:
|
|
143869
|
+
errorCodes: errorCodes40,
|
|
143609
143870
|
getCodeActions: (context) => {
|
|
143610
143871
|
const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
|
|
143611
143872
|
if (!importDeclaration)
|
|
@@ -143614,14 +143875,14 @@ ${lanes.join("\n")}
|
|
|
143614
143875
|
const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
|
|
143615
143876
|
let actions2;
|
|
143616
143877
|
if (namespaceChanges.length) {
|
|
143617
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143878
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
|
|
143618
143879
|
}
|
|
143619
143880
|
if (typeOnlyChanges.length) {
|
|
143620
|
-
actions2 = append(actions2, createCodeFixActionWithoutFixAll(
|
|
143881
|
+
actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
|
|
143621
143882
|
}
|
|
143622
143883
|
return actions2;
|
|
143623
143884
|
},
|
|
143624
|
-
fixIds: [
|
|
143885
|
+
fixIds: [fixId32]
|
|
143625
143886
|
});
|
|
143626
143887
|
}
|
|
143627
143888
|
});
|
|
@@ -143774,7 +144035,7 @@ ${lanes.join("\n")}
|
|
|
143774
144035
|
function mayDeleteExpression(node) {
|
|
143775
144036
|
return (isBinaryExpression(node.parent) && node.parent.left === node || (isPostfixUnaryExpression(node.parent) || isPrefixUnaryExpression(node.parent)) && node.parent.operand === node) && isExpressionStatement(node.parent.parent);
|
|
143776
144037
|
}
|
|
143777
|
-
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer,
|
|
144038
|
+
var fixName3, fixIdPrefix, fixIdDelete, fixIdDeleteImports, fixIdInfer, errorCodes41;
|
|
143778
144039
|
var init_fixUnusedIdentifier = __esm({
|
|
143779
144040
|
"src/services/codefixes/fixUnusedIdentifier.ts"() {
|
|
143780
144041
|
"use strict";
|
|
@@ -143785,7 +144046,7 @@ ${lanes.join("\n")}
|
|
|
143785
144046
|
fixIdDelete = "unusedIdentifier_delete";
|
|
143786
144047
|
fixIdDeleteImports = "unusedIdentifier_deleteImports";
|
|
143787
144048
|
fixIdInfer = "unusedIdentifier_infer";
|
|
143788
|
-
|
|
144049
|
+
errorCodes41 = [
|
|
143789
144050
|
Diagnostics._0_is_declared_but_its_value_is_never_read.code,
|
|
143790
144051
|
Diagnostics._0_is_declared_but_never_used.code,
|
|
143791
144052
|
Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
|
|
@@ -143795,7 +144056,7 @@ ${lanes.join("\n")}
|
|
|
143795
144056
|
Diagnostics.All_type_parameters_are_unused.code
|
|
143796
144057
|
];
|
|
143797
144058
|
registerCodeFix({
|
|
143798
|
-
errorCodes:
|
|
144059
|
+
errorCodes: errorCodes41,
|
|
143799
144060
|
getCodeActions(context) {
|
|
143800
144061
|
const { errorCode, sourceFile, program, cancellationToken } = context;
|
|
143801
144062
|
const checker = program.getTypeChecker();
|
|
@@ -143881,7 +144142,7 @@ ${lanes.join("\n")}
|
|
|
143881
144142
|
const { sourceFile, program, cancellationToken } = context;
|
|
143882
144143
|
const checker = program.getTypeChecker();
|
|
143883
144144
|
const sourceFiles = program.getSourceFiles();
|
|
143884
|
-
return codeFixAll(context,
|
|
144145
|
+
return codeFixAll(context, errorCodes41, (changes, diag2) => {
|
|
143885
144146
|
const token = getTokenAtPosition(sourceFile, diag2.start);
|
|
143886
144147
|
switch (context.fixId) {
|
|
143887
144148
|
case fixIdPrefix:
|
|
@@ -143953,7 +144214,7 @@ ${lanes.join("\n")}
|
|
|
143953
144214
|
});
|
|
143954
144215
|
|
|
143955
144216
|
// src/services/codefixes/fixUnreachableCode.ts
|
|
143956
|
-
function
|
|
144217
|
+
function doChange19(changes, sourceFile, start, length2, errorCode) {
|
|
143957
144218
|
const token = getTokenAtPosition(sourceFile, start);
|
|
143958
144219
|
const statement = findAncestor(token, isStatement);
|
|
143959
144220
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -144001,31 +144262,31 @@ ${lanes.join("\n")}
|
|
|
144001
144262
|
}
|
|
144002
144263
|
return last2;
|
|
144003
144264
|
}
|
|
144004
|
-
var
|
|
144265
|
+
var fixId33, errorCodes42;
|
|
144005
144266
|
var init_fixUnreachableCode = __esm({
|
|
144006
144267
|
"src/services/codefixes/fixUnreachableCode.ts"() {
|
|
144007
144268
|
"use strict";
|
|
144008
144269
|
init_ts4();
|
|
144009
144270
|
init_ts_codefix();
|
|
144010
|
-
|
|
144011
|
-
|
|
144271
|
+
fixId33 = "fixUnreachableCode";
|
|
144272
|
+
errorCodes42 = [Diagnostics.Unreachable_code_detected.code];
|
|
144012
144273
|
registerCodeFix({
|
|
144013
|
-
errorCodes:
|
|
144274
|
+
errorCodes: errorCodes42,
|
|
144014
144275
|
getCodeActions(context) {
|
|
144015
144276
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
144016
144277
|
if (syntacticDiagnostics.length)
|
|
144017
144278
|
return;
|
|
144018
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144019
|
-
return [createCodeFixAction(
|
|
144279
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
144280
|
+
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
|
|
144020
144281
|
},
|
|
144021
|
-
fixIds: [
|
|
144022
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144282
|
+
fixIds: [fixId33],
|
|
144283
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
144023
144284
|
});
|
|
144024
144285
|
}
|
|
144025
144286
|
});
|
|
144026
144287
|
|
|
144027
144288
|
// src/services/codefixes/fixUnusedLabel.ts
|
|
144028
|
-
function
|
|
144289
|
+
function doChange20(changes, sourceFile, start) {
|
|
144029
144290
|
const token = getTokenAtPosition(sourceFile, start);
|
|
144030
144291
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
144031
144292
|
const pos = token.getStart(sourceFile);
|
|
@@ -144038,28 +144299,28 @@ ${lanes.join("\n")}
|
|
|
144038
144299
|
);
|
|
144039
144300
|
changes.deleteRange(sourceFile, { pos, end });
|
|
144040
144301
|
}
|
|
144041
|
-
var
|
|
144302
|
+
var fixId34, errorCodes43;
|
|
144042
144303
|
var init_fixUnusedLabel = __esm({
|
|
144043
144304
|
"src/services/codefixes/fixUnusedLabel.ts"() {
|
|
144044
144305
|
"use strict";
|
|
144045
144306
|
init_ts4();
|
|
144046
144307
|
init_ts_codefix();
|
|
144047
|
-
|
|
144048
|
-
|
|
144308
|
+
fixId34 = "fixUnusedLabel";
|
|
144309
|
+
errorCodes43 = [Diagnostics.Unused_label.code];
|
|
144049
144310
|
registerCodeFix({
|
|
144050
|
-
errorCodes:
|
|
144311
|
+
errorCodes: errorCodes43,
|
|
144051
144312
|
getCodeActions(context) {
|
|
144052
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144053
|
-
return [createCodeFixAction(
|
|
144313
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, context.span.start));
|
|
144314
|
+
return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
|
|
144054
144315
|
},
|
|
144055
|
-
fixIds: [
|
|
144056
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144316
|
+
fixIds: [fixId34],
|
|
144317
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange20(changes, diag2.file, diag2.start))
|
|
144057
144318
|
});
|
|
144058
144319
|
}
|
|
144059
144320
|
});
|
|
144060
144321
|
|
|
144061
144322
|
// src/services/codefixes/fixJSDocTypes.ts
|
|
144062
|
-
function
|
|
144323
|
+
function doChange21(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
144063
144324
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
144064
144325
|
newType,
|
|
144065
144326
|
/*enclosingDeclaration*/
|
|
@@ -144108,7 +144369,7 @@ ${lanes.join("\n")}
|
|
|
144108
144369
|
}
|
|
144109
144370
|
return checker.getTypeFromTypeNode(node);
|
|
144110
144371
|
}
|
|
144111
|
-
var fixIdPlain, fixIdNullable,
|
|
144372
|
+
var fixIdPlain, fixIdNullable, errorCodes44;
|
|
144112
144373
|
var init_fixJSDocTypes = __esm({
|
|
144113
144374
|
"src/services/codefixes/fixJSDocTypes.ts"() {
|
|
144114
144375
|
"use strict";
|
|
@@ -144116,13 +144377,13 @@ ${lanes.join("\n")}
|
|
|
144116
144377
|
init_ts_codefix();
|
|
144117
144378
|
fixIdPlain = "fixJSDocTypes_plain";
|
|
144118
144379
|
fixIdNullable = "fixJSDocTypes_nullable";
|
|
144119
|
-
|
|
144380
|
+
errorCodes44 = [
|
|
144120
144381
|
Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
|
|
144121
144382
|
Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
|
|
144122
144383
|
Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
|
|
144123
144384
|
];
|
|
144124
144385
|
registerCodeFix({
|
|
144125
|
-
errorCodes:
|
|
144386
|
+
errorCodes: errorCodes44,
|
|
144126
144387
|
getCodeActions(context) {
|
|
144127
144388
|
const { sourceFile } = context;
|
|
144128
144389
|
const checker = context.program.getTypeChecker();
|
|
@@ -144136,22 +144397,22 @@ ${lanes.join("\n")}
|
|
|
144136
144397
|
actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
|
|
144137
144398
|
}
|
|
144138
144399
|
return actions2;
|
|
144139
|
-
function fix(type2,
|
|
144140
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144141
|
-
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)],
|
|
144400
|
+
function fix(type2, fixId52, fixAllDescription) {
|
|
144401
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, typeNode, type2, checker));
|
|
144402
|
+
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
|
|
144142
144403
|
}
|
|
144143
144404
|
},
|
|
144144
144405
|
fixIds: [fixIdPlain, fixIdNullable],
|
|
144145
144406
|
getAllCodeActions(context) {
|
|
144146
|
-
const { fixId:
|
|
144407
|
+
const { fixId: fixId52, program, sourceFile } = context;
|
|
144147
144408
|
const checker = program.getTypeChecker();
|
|
144148
|
-
return codeFixAll(context,
|
|
144409
|
+
return codeFixAll(context, errorCodes44, (changes, err) => {
|
|
144149
144410
|
const info = getInfo11(err.file, err.start, checker);
|
|
144150
144411
|
if (!info)
|
|
144151
144412
|
return;
|
|
144152
144413
|
const { typeNode, type } = info;
|
|
144153
|
-
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ &&
|
|
144154
|
-
|
|
144414
|
+
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
144415
|
+
doChange21(changes, sourceFile, typeNode, fixedType, checker);
|
|
144155
144416
|
});
|
|
144156
144417
|
}
|
|
144157
144418
|
});
|
|
@@ -144159,7 +144420,7 @@ ${lanes.join("\n")}
|
|
|
144159
144420
|
});
|
|
144160
144421
|
|
|
144161
144422
|
// src/services/codefixes/fixMissingCallParentheses.ts
|
|
144162
|
-
function
|
|
144423
|
+
function doChange22(changes, sourceFile, name) {
|
|
144163
144424
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
144164
144425
|
}
|
|
144165
144426
|
function getCallName(sourceFile, start) {
|
|
@@ -144176,31 +144437,31 @@ ${lanes.join("\n")}
|
|
|
144176
144437
|
}
|
|
144177
144438
|
return void 0;
|
|
144178
144439
|
}
|
|
144179
|
-
var
|
|
144440
|
+
var fixId35, errorCodes45;
|
|
144180
144441
|
var init_fixMissingCallParentheses = __esm({
|
|
144181
144442
|
"src/services/codefixes/fixMissingCallParentheses.ts"() {
|
|
144182
144443
|
"use strict";
|
|
144183
144444
|
init_ts4();
|
|
144184
144445
|
init_ts_codefix();
|
|
144185
|
-
|
|
144186
|
-
|
|
144446
|
+
fixId35 = "fixMissingCallParentheses";
|
|
144447
|
+
errorCodes45 = [
|
|
144187
144448
|
Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
|
|
144188
144449
|
];
|
|
144189
144450
|
registerCodeFix({
|
|
144190
|
-
errorCodes:
|
|
144191
|
-
fixIds: [
|
|
144451
|
+
errorCodes: errorCodes45,
|
|
144452
|
+
fixIds: [fixId35],
|
|
144192
144453
|
getCodeActions(context) {
|
|
144193
144454
|
const { sourceFile, span } = context;
|
|
144194
144455
|
const callName = getCallName(sourceFile, span.start);
|
|
144195
144456
|
if (!callName)
|
|
144196
144457
|
return;
|
|
144197
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144198
|
-
return [createCodeFixAction(
|
|
144458
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, context.sourceFile, callName));
|
|
144459
|
+
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
|
|
144199
144460
|
},
|
|
144200
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144461
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => {
|
|
144201
144462
|
const callName = getCallName(diag2.file, diag2.start);
|
|
144202
144463
|
if (callName)
|
|
144203
|
-
|
|
144464
|
+
doChange22(changes, diag2.file, callName);
|
|
144204
144465
|
})
|
|
144205
144466
|
});
|
|
144206
144467
|
}
|
|
@@ -144242,7 +144503,7 @@ ${lanes.join("\n")}
|
|
|
144242
144503
|
returnType: getReturnType(containingFunction)
|
|
144243
144504
|
};
|
|
144244
144505
|
}
|
|
144245
|
-
function
|
|
144506
|
+
function doChange23(changes, sourceFile, { insertBefore, returnType }) {
|
|
144246
144507
|
if (returnType) {
|
|
144247
144508
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
144248
144509
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -144251,36 +144512,36 @@ ${lanes.join("\n")}
|
|
|
144251
144512
|
}
|
|
144252
144513
|
changes.insertModifierBefore(sourceFile, 132 /* AsyncKeyword */, insertBefore);
|
|
144253
144514
|
}
|
|
144254
|
-
var
|
|
144515
|
+
var fixId36, errorCodes46;
|
|
144255
144516
|
var init_fixAwaitInSyncFunction = __esm({
|
|
144256
144517
|
"src/services/codefixes/fixAwaitInSyncFunction.ts"() {
|
|
144257
144518
|
"use strict";
|
|
144258
144519
|
init_ts4();
|
|
144259
144520
|
init_ts_codefix();
|
|
144260
|
-
|
|
144261
|
-
|
|
144521
|
+
fixId36 = "fixAwaitInSyncFunction";
|
|
144522
|
+
errorCodes46 = [
|
|
144262
144523
|
Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144263
144524
|
Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
|
|
144264
144525
|
Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
|
|
144265
144526
|
];
|
|
144266
144527
|
registerCodeFix({
|
|
144267
|
-
errorCodes:
|
|
144528
|
+
errorCodes: errorCodes46,
|
|
144268
144529
|
getCodeActions(context) {
|
|
144269
144530
|
const { sourceFile, span } = context;
|
|
144270
144531
|
const nodes = getNodes3(sourceFile, span.start);
|
|
144271
144532
|
if (!nodes)
|
|
144272
144533
|
return void 0;
|
|
144273
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144274
|
-
return [createCodeFixAction(
|
|
144534
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, nodes));
|
|
144535
|
+
return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
|
|
144275
144536
|
},
|
|
144276
|
-
fixIds: [
|
|
144537
|
+
fixIds: [fixId36],
|
|
144277
144538
|
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
144278
144539
|
const seen = /* @__PURE__ */ new Map();
|
|
144279
|
-
return codeFixAll(context,
|
|
144540
|
+
return codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
144280
144541
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
144281
144542
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
144282
144543
|
return;
|
|
144283
|
-
|
|
144544
|
+
doChange23(changes, context.sourceFile, nodes);
|
|
144284
144545
|
});
|
|
144285
144546
|
}
|
|
144286
144547
|
});
|
|
@@ -144288,7 +144549,7 @@ ${lanes.join("\n")}
|
|
|
144288
144549
|
});
|
|
144289
144550
|
|
|
144290
144551
|
// src/services/codefixes/fixPropertyOverrideAccessor.ts
|
|
144291
|
-
function
|
|
144552
|
+
function doChange24(file, start, length2, code, context) {
|
|
144292
144553
|
let startPosition;
|
|
144293
144554
|
let endPosition;
|
|
144294
144555
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -144315,28 +144576,28 @@ ${lanes.join("\n")}
|
|
|
144315
144576
|
}
|
|
144316
144577
|
return generateAccessorFromProperty(file, context.program, startPosition, endPosition, context, Diagnostics.Generate_get_and_set_accessors.message);
|
|
144317
144578
|
}
|
|
144318
|
-
var
|
|
144579
|
+
var errorCodes47, fixId37;
|
|
144319
144580
|
var init_fixPropertyOverrideAccessor = __esm({
|
|
144320
144581
|
"src/services/codefixes/fixPropertyOverrideAccessor.ts"() {
|
|
144321
144582
|
"use strict";
|
|
144322
144583
|
init_ts4();
|
|
144323
144584
|
init_ts_codefix();
|
|
144324
|
-
|
|
144585
|
+
errorCodes47 = [
|
|
144325
144586
|
Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
|
|
144326
144587
|
Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
|
|
144327
144588
|
];
|
|
144328
|
-
|
|
144589
|
+
fixId37 = "fixPropertyOverrideAccessor";
|
|
144329
144590
|
registerCodeFix({
|
|
144330
|
-
errorCodes:
|
|
144591
|
+
errorCodes: errorCodes47,
|
|
144331
144592
|
getCodeActions(context) {
|
|
144332
|
-
const edits =
|
|
144593
|
+
const edits = doChange24(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
144333
144594
|
if (edits) {
|
|
144334
|
-
return [createCodeFixAction(
|
|
144595
|
+
return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
144335
144596
|
}
|
|
144336
144597
|
},
|
|
144337
|
-
fixIds: [
|
|
144338
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
144339
|
-
const edits =
|
|
144598
|
+
fixIds: [fixId37],
|
|
144599
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
|
|
144600
|
+
const edits = doChange24(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
144340
144601
|
if (edits) {
|
|
144341
144602
|
for (const edit of edits) {
|
|
144342
144603
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -144383,7 +144644,7 @@ ${lanes.join("\n")}
|
|
|
144383
144644
|
}
|
|
144384
144645
|
return errorCode;
|
|
144385
144646
|
}
|
|
144386
|
-
function
|
|
144647
|
+
function doChange25(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
144387
144648
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
144388
144649
|
return void 0;
|
|
144389
144650
|
}
|
|
@@ -145277,14 +145538,14 @@ ${lanes.join("\n")}
|
|
|
145277
145538
|
}
|
|
145278
145539
|
}
|
|
145279
145540
|
}
|
|
145280
|
-
var
|
|
145541
|
+
var fixId38, errorCodes48;
|
|
145281
145542
|
var init_inferFromUsage = __esm({
|
|
145282
145543
|
"src/services/codefixes/inferFromUsage.ts"() {
|
|
145283
145544
|
"use strict";
|
|
145284
145545
|
init_ts4();
|
|
145285
145546
|
init_ts_codefix();
|
|
145286
|
-
|
|
145287
|
-
|
|
145547
|
+
fixId38 = "inferFromUsage";
|
|
145548
|
+
errorCodes48 = [
|
|
145288
145549
|
// Variable declarations
|
|
145289
145550
|
Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
|
|
145290
145551
|
// Variable uses
|
|
@@ -145318,13 +145579,13 @@ ${lanes.join("\n")}
|
|
|
145318
145579
|
Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
|
|
145319
145580
|
];
|
|
145320
145581
|
registerCodeFix({
|
|
145321
|
-
errorCodes:
|
|
145582
|
+
errorCodes: errorCodes48,
|
|
145322
145583
|
getCodeActions(context) {
|
|
145323
145584
|
const { sourceFile, program, span: { start }, errorCode, cancellationToken, host, preferences } = context;
|
|
145324
145585
|
const token = getTokenAtPosition(sourceFile, start);
|
|
145325
145586
|
let declaration;
|
|
145326
145587
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145327
|
-
declaration =
|
|
145588
|
+
declaration = doChange25(
|
|
145328
145589
|
changes2,
|
|
145329
145590
|
sourceFile,
|
|
145330
145591
|
token,
|
|
@@ -145338,14 +145599,14 @@ ${lanes.join("\n")}
|
|
|
145338
145599
|
);
|
|
145339
145600
|
});
|
|
145340
145601
|
const name = declaration && getNameOfDeclaration(declaration);
|
|
145341
|
-
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(
|
|
145602
|
+
return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)];
|
|
145342
145603
|
},
|
|
145343
|
-
fixIds: [
|
|
145604
|
+
fixIds: [fixId38],
|
|
145344
145605
|
getAllCodeActions(context) {
|
|
145345
145606
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145346
145607
|
const markSeen = nodeSeenTracker();
|
|
145347
|
-
return codeFixAll(context,
|
|
145348
|
-
|
|
145608
|
+
return codeFixAll(context, errorCodes48, (changes, err) => {
|
|
145609
|
+
doChange25(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145349
145610
|
});
|
|
145350
145611
|
}
|
|
145351
145612
|
});
|
|
@@ -145376,22 +145637,22 @@ ${lanes.join("\n")}
|
|
|
145376
145637
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
145377
145638
|
}
|
|
145378
145639
|
}
|
|
145379
|
-
function
|
|
145640
|
+
function doChange26(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
145380
145641
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
145381
145642
|
}
|
|
145382
|
-
var
|
|
145643
|
+
var fixId39, errorCodes49;
|
|
145383
145644
|
var init_fixReturnTypeInAsyncFunction = __esm({
|
|
145384
145645
|
"src/services/codefixes/fixReturnTypeInAsyncFunction.ts"() {
|
|
145385
145646
|
"use strict";
|
|
145386
145647
|
init_ts4();
|
|
145387
145648
|
init_ts_codefix();
|
|
145388
|
-
|
|
145389
|
-
|
|
145649
|
+
fixId39 = "fixReturnTypeInAsyncFunction";
|
|
145650
|
+
errorCodes49 = [
|
|
145390
145651
|
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
|
|
145391
145652
|
];
|
|
145392
145653
|
registerCodeFix({
|
|
145393
|
-
errorCodes:
|
|
145394
|
-
fixIds: [
|
|
145654
|
+
errorCodes: errorCodes49,
|
|
145655
|
+
fixIds: [fixId39],
|
|
145395
145656
|
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
145396
145657
|
const { sourceFile, program, span } = context;
|
|
145397
145658
|
const checker = program.getTypeChecker();
|
|
@@ -145400,23 +145661,23 @@ ${lanes.join("\n")}
|
|
|
145400
145661
|
return void 0;
|
|
145401
145662
|
}
|
|
145402
145663
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
145403
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145664
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
145404
145665
|
return [createCodeFixAction(
|
|
145405
|
-
|
|
145666
|
+
fixId39,
|
|
145406
145667
|
changes,
|
|
145407
145668
|
[
|
|
145408
145669
|
Diagnostics.Replace_0_with_Promise_1,
|
|
145409
145670
|
checker.typeToString(returnType),
|
|
145410
145671
|
checker.typeToString(promisedType)
|
|
145411
145672
|
],
|
|
145412
|
-
|
|
145673
|
+
fixId39,
|
|
145413
145674
|
Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
|
|
145414
145675
|
)];
|
|
145415
145676
|
},
|
|
145416
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
145677
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
|
|
145417
145678
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
145418
145679
|
if (info) {
|
|
145419
|
-
|
|
145680
|
+
doChange26(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
145420
145681
|
}
|
|
145421
145682
|
})
|
|
145422
145683
|
});
|
|
@@ -145430,20 +145691,20 @@ ${lanes.join("\n")}
|
|
|
145430
145691
|
changes.insertCommentBeforeLine(sourceFile, lineNumber, position, " @ts-ignore");
|
|
145431
145692
|
}
|
|
145432
145693
|
}
|
|
145433
|
-
var fixName4,
|
|
145694
|
+
var fixName4, fixId40, errorCodes50;
|
|
145434
145695
|
var init_disableJsDiagnostics = __esm({
|
|
145435
145696
|
"src/services/codefixes/disableJsDiagnostics.ts"() {
|
|
145436
145697
|
"use strict";
|
|
145437
145698
|
init_ts4();
|
|
145438
145699
|
init_ts_codefix();
|
|
145439
145700
|
fixName4 = "disableJsDiagnostics";
|
|
145440
|
-
|
|
145441
|
-
|
|
145701
|
+
fixId40 = "disableJsDiagnostics";
|
|
145702
|
+
errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => {
|
|
145442
145703
|
const diag2 = Diagnostics[key];
|
|
145443
145704
|
return diag2.category === 1 /* Error */ ? diag2.code : void 0;
|
|
145444
145705
|
});
|
|
145445
145706
|
registerCodeFix({
|
|
145446
|
-
errorCodes:
|
|
145707
|
+
errorCodes: errorCodes50,
|
|
145447
145708
|
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
145448
145709
|
const { sourceFile, program, span, host, formatContext } = context;
|
|
145449
145710
|
if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
@@ -145461,14 +145722,14 @@ ${lanes.join("\n")}
|
|
|
145461
145722
|
)
|
|
145462
145723
|
];
|
|
145463
145724
|
if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
|
|
145464
|
-
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message,
|
|
145725
|
+
fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId40, Diagnostics.Add_ts_ignore_to_all_error_messages));
|
|
145465
145726
|
}
|
|
145466
145727
|
return fixes;
|
|
145467
145728
|
},
|
|
145468
|
-
fixIds: [
|
|
145729
|
+
fixIds: [fixId40],
|
|
145469
145730
|
getAllCodeActions: (context) => {
|
|
145470
145731
|
const seenLines = /* @__PURE__ */ new Set();
|
|
145471
|
-
return codeFixAll(context,
|
|
145732
|
+
return codeFixAll(context, errorCodes50, (changes, diag2) => {
|
|
145472
145733
|
if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
|
|
145473
145734
|
makeChange8(changes, diag2.file, diag2.start, seenLines);
|
|
145474
145735
|
}
|
|
@@ -146565,7 +146826,7 @@ ${lanes.join("\n")}
|
|
|
146565
146826
|
}
|
|
146566
146827
|
return void 0;
|
|
146567
146828
|
}
|
|
146568
|
-
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer,
|
|
146829
|
+
var fixName6, fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer, errorCodes51;
|
|
146569
146830
|
var init_fixStrictClassInitialization = __esm({
|
|
146570
146831
|
"src/services/codefixes/fixStrictClassInitialization.ts"() {
|
|
146571
146832
|
"use strict";
|
|
@@ -146575,9 +146836,9 @@ ${lanes.join("\n")}
|
|
|
146575
146836
|
fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
|
|
146576
146837
|
fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
|
|
146577
146838
|
fixIdAddInitializer = "addMissingPropertyInitializer";
|
|
146578
|
-
|
|
146839
|
+
errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
146579
146840
|
registerCodeFix({
|
|
146580
|
-
errorCodes:
|
|
146841
|
+
errorCodes: errorCodes51,
|
|
146581
146842
|
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
146582
146843
|
const info = getInfo13(context.sourceFile, context.span.start);
|
|
146583
146844
|
if (!info)
|
|
@@ -146590,7 +146851,7 @@ ${lanes.join("\n")}
|
|
|
146590
146851
|
},
|
|
146591
146852
|
fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
|
|
146592
146853
|
getAllCodeActions: (context) => {
|
|
146593
|
-
return codeFixAll(context,
|
|
146854
|
+
return codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
146594
146855
|
const info = getInfo13(diag2.file, diag2.start);
|
|
146595
146856
|
if (!info)
|
|
146596
146857
|
return;
|
|
@@ -146618,7 +146879,7 @@ ${lanes.join("\n")}
|
|
|
146618
146879
|
});
|
|
146619
146880
|
|
|
146620
146881
|
// src/services/codefixes/requireInTs.ts
|
|
146621
|
-
function
|
|
146882
|
+
function doChange27(changes, sourceFile, info) {
|
|
146622
146883
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
146623
146884
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
146624
146885
|
/*modifiers*/
|
|
@@ -146680,29 +146941,29 @@ ${lanes.join("\n")}
|
|
|
146680
146941
|
return factory.createNamedImports(importSpecifiers);
|
|
146681
146942
|
}
|
|
146682
146943
|
}
|
|
146683
|
-
var
|
|
146944
|
+
var fixId41, errorCodes52;
|
|
146684
146945
|
var init_requireInTs = __esm({
|
|
146685
146946
|
"src/services/codefixes/requireInTs.ts"() {
|
|
146686
146947
|
"use strict";
|
|
146687
146948
|
init_ts4();
|
|
146688
146949
|
init_ts_codefix();
|
|
146689
|
-
|
|
146690
|
-
|
|
146950
|
+
fixId41 = "requireInTs";
|
|
146951
|
+
errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
|
|
146691
146952
|
registerCodeFix({
|
|
146692
|
-
errorCodes:
|
|
146953
|
+
errorCodes: errorCodes52,
|
|
146693
146954
|
getCodeActions(context) {
|
|
146694
146955
|
const info = getInfo14(context.sourceFile, context.program, context.span.start);
|
|
146695
146956
|
if (!info) {
|
|
146696
146957
|
return void 0;
|
|
146697
146958
|
}
|
|
146698
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146699
|
-
return [createCodeFixAction(
|
|
146959
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, info));
|
|
146960
|
+
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
|
|
146700
146961
|
},
|
|
146701
|
-
fixIds: [
|
|
146702
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
146962
|
+
fixIds: [fixId41],
|
|
146963
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
146703
146964
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
146704
146965
|
if (info) {
|
|
146705
|
-
|
|
146966
|
+
doChange27(changes, context.sourceFile, info);
|
|
146706
146967
|
}
|
|
146707
146968
|
})
|
|
146708
146969
|
});
|
|
@@ -146722,7 +146983,7 @@ ${lanes.join("\n")}
|
|
|
146722
146983
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
146723
146984
|
}
|
|
146724
146985
|
}
|
|
146725
|
-
function
|
|
146986
|
+
function doChange28(changes, sourceFile, info, preferences) {
|
|
146726
146987
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
146727
146988
|
info.name,
|
|
146728
146989
|
/*namedImports*/
|
|
@@ -146731,29 +146992,29 @@ ${lanes.join("\n")}
|
|
|
146731
146992
|
getQuotePreference(sourceFile, preferences)
|
|
146732
146993
|
));
|
|
146733
146994
|
}
|
|
146734
|
-
var
|
|
146995
|
+
var fixId42, errorCodes53;
|
|
146735
146996
|
var init_useDefaultImport = __esm({
|
|
146736
146997
|
"src/services/codefixes/useDefaultImport.ts"() {
|
|
146737
146998
|
"use strict";
|
|
146738
146999
|
init_ts4();
|
|
146739
147000
|
init_ts_codefix();
|
|
146740
|
-
|
|
146741
|
-
|
|
147001
|
+
fixId42 = "useDefaultImport";
|
|
147002
|
+
errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
|
|
146742
147003
|
registerCodeFix({
|
|
146743
|
-
errorCodes:
|
|
147004
|
+
errorCodes: errorCodes53,
|
|
146744
147005
|
getCodeActions(context) {
|
|
146745
147006
|
const { sourceFile, span: { start } } = context;
|
|
146746
147007
|
const info = getInfo15(sourceFile, start);
|
|
146747
147008
|
if (!info)
|
|
146748
147009
|
return void 0;
|
|
146749
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146750
|
-
return [createCodeFixAction(
|
|
147010
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, info, context.preferences));
|
|
147011
|
+
return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
|
|
146751
147012
|
},
|
|
146752
|
-
fixIds: [
|
|
146753
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147013
|
+
fixIds: [fixId42],
|
|
147014
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
|
|
146754
147015
|
const info = getInfo15(diag2.file, diag2.start);
|
|
146755
147016
|
if (info)
|
|
146756
|
-
|
|
147017
|
+
doChange28(changes, diag2.file, info, context.preferences);
|
|
146757
147018
|
})
|
|
146758
147019
|
});
|
|
146759
147020
|
}
|
|
@@ -146768,27 +147029,27 @@ ${lanes.join("\n")}
|
|
|
146768
147029
|
const newText = numericLiteral.getText(sourceFile) + "n";
|
|
146769
147030
|
changeTracker.replaceNode(sourceFile, numericLiteral, factory.createBigIntLiteral(newText));
|
|
146770
147031
|
}
|
|
146771
|
-
var
|
|
147032
|
+
var fixId43, errorCodes54;
|
|
146772
147033
|
var init_useBigintLiteral = __esm({
|
|
146773
147034
|
"src/services/codefixes/useBigintLiteral.ts"() {
|
|
146774
147035
|
"use strict";
|
|
146775
147036
|
init_ts4();
|
|
146776
147037
|
init_ts_codefix();
|
|
146777
|
-
|
|
146778
|
-
|
|
147038
|
+
fixId43 = "useBigintLiteral";
|
|
147039
|
+
errorCodes54 = [
|
|
146779
147040
|
Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
|
|
146780
147041
|
];
|
|
146781
147042
|
registerCodeFix({
|
|
146782
|
-
errorCodes:
|
|
147043
|
+
errorCodes: errorCodes54,
|
|
146783
147044
|
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
146784
147045
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
|
|
146785
147046
|
if (changes.length > 0) {
|
|
146786
|
-
return [createCodeFixAction(
|
|
147047
|
+
return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
146787
147048
|
}
|
|
146788
147049
|
},
|
|
146789
|
-
fixIds: [
|
|
147050
|
+
fixIds: [fixId43],
|
|
146790
147051
|
getAllCodeActions: (context) => {
|
|
146791
|
-
return codeFixAll(context,
|
|
147052
|
+
return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
|
|
146792
147053
|
}
|
|
146793
147054
|
});
|
|
146794
147055
|
}
|
|
@@ -146801,7 +147062,7 @@ ${lanes.join("\n")}
|
|
|
146801
147062
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
146802
147063
|
return token.parent;
|
|
146803
147064
|
}
|
|
146804
|
-
function
|
|
147065
|
+
function doChange29(changes, sourceFile, importType) {
|
|
146805
147066
|
const newTypeNode = factory.updateImportTypeNode(
|
|
146806
147067
|
importType,
|
|
146807
147068
|
importType.argument,
|
|
@@ -146813,25 +147074,25 @@ ${lanes.join("\n")}
|
|
|
146813
147074
|
);
|
|
146814
147075
|
changes.replaceNode(sourceFile, importType, newTypeNode);
|
|
146815
147076
|
}
|
|
146816
|
-
var fixIdAddMissingTypeof,
|
|
147077
|
+
var fixIdAddMissingTypeof, fixId44, errorCodes55;
|
|
146817
147078
|
var init_fixAddModuleReferTypeMissingTypeof = __esm({
|
|
146818
147079
|
"src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts"() {
|
|
146819
147080
|
"use strict";
|
|
146820
147081
|
init_ts4();
|
|
146821
147082
|
init_ts_codefix();
|
|
146822
147083
|
fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
|
|
146823
|
-
|
|
146824
|
-
|
|
147084
|
+
fixId44 = fixIdAddMissingTypeof;
|
|
147085
|
+
errorCodes55 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
146825
147086
|
registerCodeFix({
|
|
146826
|
-
errorCodes:
|
|
147087
|
+
errorCodes: errorCodes55,
|
|
146827
147088
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
146828
147089
|
const { sourceFile, span } = context;
|
|
146829
147090
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
146830
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146831
|
-
return [createCodeFixAction(
|
|
147091
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, importType));
|
|
147092
|
+
return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
|
|
146832
147093
|
},
|
|
146833
|
-
fixIds: [
|
|
146834
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147094
|
+
fixIds: [fixId44],
|
|
147095
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange29(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
146835
147096
|
});
|
|
146836
147097
|
}
|
|
146837
147098
|
});
|
|
@@ -146850,7 +147111,7 @@ ${lanes.join("\n")}
|
|
|
146850
147111
|
return void 0;
|
|
146851
147112
|
return binaryExpr;
|
|
146852
147113
|
}
|
|
146853
|
-
function
|
|
147114
|
+
function doChange30(changeTracker, sf, node) {
|
|
146854
147115
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
146855
147116
|
if (jsx)
|
|
146856
147117
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -146873,30 +147134,30 @@ ${lanes.join("\n")}
|
|
|
146873
147134
|
return void 0;
|
|
146874
147135
|
}
|
|
146875
147136
|
}
|
|
146876
|
-
var fixID2,
|
|
147137
|
+
var fixID2, errorCodes56;
|
|
146877
147138
|
var init_wrapJsxInFragment = __esm({
|
|
146878
147139
|
"src/services/codefixes/wrapJsxInFragment.ts"() {
|
|
146879
147140
|
"use strict";
|
|
146880
147141
|
init_ts4();
|
|
146881
147142
|
init_ts_codefix();
|
|
146882
147143
|
fixID2 = "wrapJsxInFragment";
|
|
146883
|
-
|
|
147144
|
+
errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
146884
147145
|
registerCodeFix({
|
|
146885
|
-
errorCodes:
|
|
147146
|
+
errorCodes: errorCodes56,
|
|
146886
147147
|
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
146887
147148
|
const { sourceFile, span } = context;
|
|
146888
147149
|
const node = findNodeToFix(sourceFile, span.start);
|
|
146889
147150
|
if (!node)
|
|
146890
147151
|
return void 0;
|
|
146891
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147152
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, node));
|
|
146892
147153
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
146893
147154
|
},
|
|
146894
147155
|
fixIds: [fixID2],
|
|
146895
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147156
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
146896
147157
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
146897
147158
|
if (!node)
|
|
146898
147159
|
return void 0;
|
|
146899
|
-
|
|
147160
|
+
doChange30(changes, context.sourceFile, node);
|
|
146900
147161
|
})
|
|
146901
147162
|
});
|
|
146902
147163
|
}
|
|
@@ -146916,7 +147177,7 @@ ${lanes.join("\n")}
|
|
|
146916
147177
|
function createTypeAliasFromInterface(declaration, type) {
|
|
146917
147178
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
146918
147179
|
}
|
|
146919
|
-
function
|
|
147180
|
+
function doChange31(changes, sourceFile, { indexSignature, container }) {
|
|
146920
147181
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
146921
147182
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
146922
147183
|
const parameter = first(indexSignature.parameters);
|
|
@@ -146943,48 +147204,48 @@ ${lanes.join("\n")}
|
|
|
146943
147204
|
]);
|
|
146944
147205
|
changes.replaceNode(sourceFile, container, createTypeAliasFromInterface(container, intersectionType));
|
|
146945
147206
|
}
|
|
146946
|
-
var
|
|
147207
|
+
var fixId45, errorCodes57;
|
|
146947
147208
|
var init_convertToMappedObjectType = __esm({
|
|
146948
147209
|
"src/services/codefixes/convertToMappedObjectType.ts"() {
|
|
146949
147210
|
"use strict";
|
|
146950
147211
|
init_ts4();
|
|
146951
147212
|
init_ts_codefix();
|
|
146952
|
-
|
|
146953
|
-
|
|
147213
|
+
fixId45 = "fixConvertToMappedObjectType";
|
|
147214
|
+
errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
146954
147215
|
registerCodeFix({
|
|
146955
|
-
errorCodes:
|
|
147216
|
+
errorCodes: errorCodes57,
|
|
146956
147217
|
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
146957
147218
|
const { sourceFile, span } = context;
|
|
146958
147219
|
const info = getInfo16(sourceFile, span.start);
|
|
146959
147220
|
if (!info)
|
|
146960
147221
|
return void 0;
|
|
146961
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147222
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
|
|
146962
147223
|
const name = idText(info.container.name);
|
|
146963
|
-
return [createCodeFixAction(
|
|
147224
|
+
return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
146964
147225
|
},
|
|
146965
|
-
fixIds: [
|
|
146966
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147226
|
+
fixIds: [fixId45],
|
|
147227
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
|
|
146967
147228
|
const info = getInfo16(diag2.file, diag2.start);
|
|
146968
147229
|
if (info)
|
|
146969
|
-
|
|
147230
|
+
doChange31(changes, diag2.file, info);
|
|
146970
147231
|
})
|
|
146971
147232
|
});
|
|
146972
147233
|
}
|
|
146973
147234
|
});
|
|
146974
147235
|
|
|
146975
147236
|
// src/services/codefixes/removeAccidentalCallParentheses.ts
|
|
146976
|
-
var
|
|
147237
|
+
var fixId46, errorCodes58;
|
|
146977
147238
|
var init_removeAccidentalCallParentheses = __esm({
|
|
146978
147239
|
"src/services/codefixes/removeAccidentalCallParentheses.ts"() {
|
|
146979
147240
|
"use strict";
|
|
146980
147241
|
init_ts4();
|
|
146981
147242
|
init_ts_codefix();
|
|
146982
|
-
|
|
146983
|
-
|
|
147243
|
+
fixId46 = "removeAccidentalCallParentheses";
|
|
147244
|
+
errorCodes58 = [
|
|
146984
147245
|
Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
|
|
146985
147246
|
];
|
|
146986
147247
|
registerCodeFix({
|
|
146987
|
-
errorCodes:
|
|
147248
|
+
errorCodes: errorCodes58,
|
|
146988
147249
|
getCodeActions(context) {
|
|
146989
147250
|
const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
|
|
146990
147251
|
if (!callExpression) {
|
|
@@ -146993,9 +147254,9 @@ ${lanes.join("\n")}
|
|
|
146993
147254
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
146994
147255
|
t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
|
|
146995
147256
|
});
|
|
146996
|
-
return [createCodeFixActionWithoutFixAll(
|
|
147257
|
+
return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
|
|
146997
147258
|
},
|
|
146998
|
-
fixIds: [
|
|
147259
|
+
fixIds: [fixId46]
|
|
146999
147260
|
});
|
|
147000
147261
|
}
|
|
147001
147262
|
});
|
|
@@ -147024,27 +147285,27 @@ ${lanes.join("\n")}
|
|
|
147024
147285
|
}
|
|
147025
147286
|
changeTracker.replaceNode(sourceFile, expressionToReplace, awaitExpression.expression);
|
|
147026
147287
|
}
|
|
147027
|
-
var
|
|
147288
|
+
var fixId47, errorCodes59;
|
|
147028
147289
|
var init_removeUnnecessaryAwait = __esm({
|
|
147029
147290
|
"src/services/codefixes/removeUnnecessaryAwait.ts"() {
|
|
147030
147291
|
"use strict";
|
|
147031
147292
|
init_ts4();
|
|
147032
147293
|
init_ts_codefix();
|
|
147033
|
-
|
|
147034
|
-
|
|
147294
|
+
fixId47 = "removeUnnecessaryAwait";
|
|
147295
|
+
errorCodes59 = [
|
|
147035
147296
|
Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
|
|
147036
147297
|
];
|
|
147037
147298
|
registerCodeFix({
|
|
147038
|
-
errorCodes:
|
|
147299
|
+
errorCodes: errorCodes59,
|
|
147039
147300
|
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
147040
147301
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
|
|
147041
147302
|
if (changes.length > 0) {
|
|
147042
|
-
return [createCodeFixAction(
|
|
147303
|
+
return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
147043
147304
|
}
|
|
147044
147305
|
},
|
|
147045
|
-
fixIds: [
|
|
147306
|
+
fixIds: [fixId47],
|
|
147046
147307
|
getAllCodeActions: (context) => {
|
|
147047
|
-
return codeFixAll(context,
|
|
147308
|
+
return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
|
|
147048
147309
|
}
|
|
147049
147310
|
});
|
|
147050
147311
|
}
|
|
@@ -147086,26 +147347,26 @@ ${lanes.join("\n")}
|
|
|
147086
147347
|
importDeclaration.assertClause
|
|
147087
147348
|
));
|
|
147088
147349
|
}
|
|
147089
|
-
var
|
|
147350
|
+
var errorCodes60, fixId48;
|
|
147090
147351
|
var init_splitTypeOnlyImport = __esm({
|
|
147091
147352
|
"src/services/codefixes/splitTypeOnlyImport.ts"() {
|
|
147092
147353
|
"use strict";
|
|
147093
147354
|
init_ts4();
|
|
147094
147355
|
init_ts_codefix();
|
|
147095
|
-
|
|
147096
|
-
|
|
147356
|
+
errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
|
|
147357
|
+
fixId48 = "splitTypeOnlyImport";
|
|
147097
147358
|
registerCodeFix({
|
|
147098
|
-
errorCodes:
|
|
147099
|
-
fixIds: [
|
|
147359
|
+
errorCodes: errorCodes60,
|
|
147360
|
+
fixIds: [fixId48],
|
|
147100
147361
|
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
147101
147362
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
147102
147363
|
return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
|
|
147103
147364
|
});
|
|
147104
147365
|
if (changes.length) {
|
|
147105
|
-
return [createCodeFixAction(
|
|
147366
|
+
return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
|
|
147106
147367
|
}
|
|
147107
147368
|
},
|
|
147108
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147369
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => {
|
|
147109
147370
|
splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context);
|
|
147110
147371
|
})
|
|
147111
147372
|
});
|
|
@@ -147127,43 +147388,43 @@ ${lanes.join("\n")}
|
|
|
147127
147388
|
return;
|
|
147128
147389
|
return { symbol, token: constToken };
|
|
147129
147390
|
}
|
|
147130
|
-
function
|
|
147391
|
+
function doChange32(changes, sourceFile, token) {
|
|
147131
147392
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
147132
147393
|
}
|
|
147133
|
-
var
|
|
147394
|
+
var fixId49, errorCodes61;
|
|
147134
147395
|
var init_convertConstToLet = __esm({
|
|
147135
147396
|
"src/services/codefixes/convertConstToLet.ts"() {
|
|
147136
147397
|
"use strict";
|
|
147137
147398
|
init_ts4();
|
|
147138
147399
|
init_ts_codefix();
|
|
147139
|
-
|
|
147140
|
-
|
|
147400
|
+
fixId49 = "fixConvertConstToLet";
|
|
147401
|
+
errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
147141
147402
|
registerCodeFix({
|
|
147142
|
-
errorCodes:
|
|
147403
|
+
errorCodes: errorCodes61,
|
|
147143
147404
|
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
147144
147405
|
const { sourceFile, span, program } = context;
|
|
147145
147406
|
const info = getInfo17(sourceFile, span.start, program);
|
|
147146
147407
|
if (info === void 0)
|
|
147147
147408
|
return;
|
|
147148
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147149
|
-
return [createCodeFixActionMaybeFixAll(
|
|
147409
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info.token));
|
|
147410
|
+
return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
|
|
147150
147411
|
},
|
|
147151
147412
|
getAllCodeActions: (context) => {
|
|
147152
147413
|
const { program } = context;
|
|
147153
147414
|
const seen = /* @__PURE__ */ new Map();
|
|
147154
147415
|
return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
|
|
147155
|
-
eachDiagnostic(context,
|
|
147416
|
+
eachDiagnostic(context, errorCodes61, (diag2) => {
|
|
147156
147417
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
147157
147418
|
if (info) {
|
|
147158
147419
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
147159
|
-
return
|
|
147420
|
+
return doChange32(changes, diag2.file, info.token);
|
|
147160
147421
|
}
|
|
147161
147422
|
}
|
|
147162
147423
|
return void 0;
|
|
147163
147424
|
});
|
|
147164
147425
|
}));
|
|
147165
147426
|
},
|
|
147166
|
-
fixIds: [
|
|
147427
|
+
fixIds: [fixId49]
|
|
147167
147428
|
});
|
|
147168
147429
|
}
|
|
147169
147430
|
});
|
|
@@ -147173,40 +147434,40 @@ ${lanes.join("\n")}
|
|
|
147173
147434
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
147174
147435
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
147175
147436
|
}
|
|
147176
|
-
function
|
|
147437
|
+
function doChange33(changes, sourceFile, { node }) {
|
|
147177
147438
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
147178
147439
|
changes.replaceNode(sourceFile, node, newNode);
|
|
147179
147440
|
}
|
|
147180
|
-
var
|
|
147441
|
+
var fixId50, expectedErrorCode, errorCodes62;
|
|
147181
147442
|
var init_fixExpectedComma = __esm({
|
|
147182
147443
|
"src/services/codefixes/fixExpectedComma.ts"() {
|
|
147183
147444
|
"use strict";
|
|
147184
147445
|
init_ts4();
|
|
147185
147446
|
init_ts_codefix();
|
|
147186
|
-
|
|
147447
|
+
fixId50 = "fixExpectedComma";
|
|
147187
147448
|
expectedErrorCode = Diagnostics._0_expected.code;
|
|
147188
|
-
|
|
147449
|
+
errorCodes62 = [expectedErrorCode];
|
|
147189
147450
|
registerCodeFix({
|
|
147190
|
-
errorCodes:
|
|
147451
|
+
errorCodes: errorCodes62,
|
|
147191
147452
|
getCodeActions(context) {
|
|
147192
147453
|
const { sourceFile } = context;
|
|
147193
147454
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
147194
147455
|
if (!info)
|
|
147195
147456
|
return void 0;
|
|
147196
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147457
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, info));
|
|
147197
147458
|
return [createCodeFixAction(
|
|
147198
|
-
|
|
147459
|
+
fixId50,
|
|
147199
147460
|
changes,
|
|
147200
147461
|
[Diagnostics.Change_0_to_1, ";", ","],
|
|
147201
|
-
|
|
147462
|
+
fixId50,
|
|
147202
147463
|
[Diagnostics.Change_0_to_1, ";", ","]
|
|
147203
147464
|
)];
|
|
147204
147465
|
},
|
|
147205
|
-
fixIds: [
|
|
147206
|
-
getAllCodeActions: (context) => codeFixAll(context,
|
|
147466
|
+
fixIds: [fixId50],
|
|
147467
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => {
|
|
147207
147468
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
147208
147469
|
if (info)
|
|
147209
|
-
|
|
147470
|
+
doChange33(changes, context.sourceFile, info);
|
|
147210
147471
|
})
|
|
147211
147472
|
});
|
|
147212
147473
|
}
|
|
@@ -147262,29 +147523,29 @@ ${lanes.join("\n")}
|
|
|
147262
147523
|
return node.typeArguments;
|
|
147263
147524
|
}
|
|
147264
147525
|
}
|
|
147265
|
-
var fixName7,
|
|
147526
|
+
var fixName7, fixId51, errorCodes63;
|
|
147266
147527
|
var init_fixAddVoidToPromise = __esm({
|
|
147267
147528
|
"src/services/codefixes/fixAddVoidToPromise.ts"() {
|
|
147268
147529
|
"use strict";
|
|
147269
147530
|
init_ts4();
|
|
147270
147531
|
init_ts_codefix();
|
|
147271
147532
|
fixName7 = "addVoidToPromise";
|
|
147272
|
-
|
|
147273
|
-
|
|
147533
|
+
fixId51 = "addVoidToPromise";
|
|
147534
|
+
errorCodes63 = [
|
|
147274
147535
|
Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
|
|
147275
147536
|
Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
|
|
147276
147537
|
];
|
|
147277
147538
|
registerCodeFix({
|
|
147278
|
-
errorCodes:
|
|
147279
|
-
fixIds: [
|
|
147539
|
+
errorCodes: errorCodes63,
|
|
147540
|
+
fixIds: [fixId51],
|
|
147280
147541
|
getCodeActions(context) {
|
|
147281
147542
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
|
|
147282
147543
|
if (changes.length > 0) {
|
|
147283
|
-
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value,
|
|
147544
|
+
return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
|
|
147284
147545
|
}
|
|
147285
147546
|
},
|
|
147286
147547
|
getAllCodeActions(context) {
|
|
147287
|
-
return codeFixAll(context,
|
|
147548
|
+
return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
|
|
147288
147549
|
}
|
|
147289
147550
|
});
|
|
147290
147551
|
}
|
|
@@ -147319,6 +147580,7 @@ ${lanes.join("\n")}
|
|
|
147319
147580
|
getFixes: () => getFixes,
|
|
147320
147581
|
getImportCompletionAction: () => getImportCompletionAction,
|
|
147321
147582
|
getImportKind: () => getImportKind,
|
|
147583
|
+
getJSDocTypedefNode: () => getJSDocTypedefNode,
|
|
147322
147584
|
getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
|
|
147323
147585
|
getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
|
|
147324
147586
|
getSupportedErrorCodes: () => getSupportedErrorCodes,
|
|
@@ -147353,6 +147615,7 @@ ${lanes.join("\n")}
|
|
|
147353
147615
|
init_correctQualifiedNameToIndexedAccessType();
|
|
147354
147616
|
init_convertToTypeOnlyExport();
|
|
147355
147617
|
init_convertToTypeOnlyImport();
|
|
147618
|
+
init_convertTypedefToType();
|
|
147356
147619
|
init_convertLiteralTypeToMappedType();
|
|
147357
147620
|
init_fixClassIncorrectlyImplementsInterface();
|
|
147358
147621
|
init_importFixes();
|
|
@@ -156502,7 +156765,7 @@ ${lanes.join("\n")}
|
|
|
156502
156765
|
return void 0;
|
|
156503
156766
|
}
|
|
156504
156767
|
}
|
|
156505
|
-
function
|
|
156768
|
+
function doChange34(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
156506
156769
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
156507
156770
|
changeImports(program, info, changes, cancellationToken);
|
|
156508
156771
|
}
|
|
@@ -156698,7 +156961,7 @@ ${lanes.join("\n")}
|
|
|
156698
156961
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
156699
156962
|
const info = getInfo19(context);
|
|
156700
156963
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156701
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
156964
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, info, t, context.cancellationToken));
|
|
156702
156965
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156703
156966
|
}
|
|
156704
156967
|
});
|
|
@@ -156733,7 +156996,7 @@ ${lanes.join("\n")}
|
|
|
156733
156996
|
function getShouldUseDefault(program, importClause) {
|
|
156734
156997
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
156735
156998
|
}
|
|
156736
|
-
function
|
|
156999
|
+
function doChange35(sourceFile, program, changes, info) {
|
|
156737
157000
|
const checker = program.getTypeChecker();
|
|
156738
157001
|
if (info.convertTo === 0 /* Named */) {
|
|
156739
157002
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -156925,7 +157188,7 @@ ${lanes.join("\n")}
|
|
|
156925
157188
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
156926
157189
|
const info = getImportConversionInfo(context);
|
|
156927
157190
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
156928
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157191
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, t, info));
|
|
156929
157192
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
156930
157193
|
}
|
|
156931
157194
|
});
|
|
@@ -157267,7 +157530,7 @@ ${lanes.join("\n")}
|
|
|
157267
157530
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
157268
157531
|
};
|
|
157269
157532
|
}
|
|
157270
|
-
function
|
|
157533
|
+
function doChange36(oldFile, program, toMove, changes, host, preferences) {
|
|
157271
157534
|
const checker = program.getTypeChecker();
|
|
157272
157535
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
157273
157536
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -158037,7 +158300,7 @@ ${lanes.join("\n")}
|
|
|
158037
158300
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158038
158301
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158039
158302
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158040
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158303
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158041
158304
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158042
158305
|
}
|
|
158043
158306
|
});
|
|
@@ -158699,12 +158962,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
158699
158962
|
return void 0;
|
|
158700
158963
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
158701
158964
|
if (groupedReferences.valid) {
|
|
158702
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158965
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(file, program, host, t, functionDeclaration, groupedReferences));
|
|
158703
158966
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
158704
158967
|
}
|
|
158705
158968
|
return { edits: [] };
|
|
158706
158969
|
}
|
|
158707
|
-
function
|
|
158970
|
+
function doChange37(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
158708
158971
|
const signature = groupedReferences.signature;
|
|
158709
158972
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
158710
158973
|
if (signature) {
|
|
@@ -159497,7 +159760,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159497
159760
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
159498
159761
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
159499
159762
|
context,
|
|
159500
|
-
(t) =>
|
|
159763
|
+
(t) => doChange38(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
159501
159764
|
);
|
|
159502
159765
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
159503
159766
|
}
|
|
@@ -159653,7 +159916,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
159653
159916
|
}
|
|
159654
159917
|
return toConvert;
|
|
159655
159918
|
}
|
|
159656
|
-
function
|
|
159919
|
+
function doChange38(sourceFile, checker, changes, info, _actionName) {
|
|
159657
159920
|
const { finalExpression, occurrences, expression } = info;
|
|
159658
159921
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
159659
159922
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -161389,7 +161652,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161389
161652
|
function getRefactorEditsToInferReturnType(context) {
|
|
161390
161653
|
const info = getInfo21(context);
|
|
161391
161654
|
if (info && !isRefactorErrorInfo(info)) {
|
|
161392
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
161655
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(context.file, t, info.declaration, info.returnTypeNode));
|
|
161393
161656
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
161394
161657
|
}
|
|
161395
161658
|
return void 0;
|
|
@@ -161414,7 +161677,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
161414
161677
|
}
|
|
161415
161678
|
return emptyArray;
|
|
161416
161679
|
}
|
|
161417
|
-
function
|
|
161680
|
+
function doChange39(sourceFile, changes, declaration, typeNode) {
|
|
161418
161681
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
161419
161682
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
161420
161683
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -169281,7 +169544,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
169281
169544
|
nodeToDisplayParts: () => nodeToDisplayParts,
|
|
169282
169545
|
noop: () => noop,
|
|
169283
169546
|
noopFileWatcher: () => noopFileWatcher,
|
|
169284
|
-
noopPush: () => noopPush,
|
|
169285
169547
|
normalizePath: () => normalizePath,
|
|
169286
169548
|
normalizeSlashes: () => normalizeSlashes,
|
|
169287
169549
|
not: () => not,
|