typescript 5.0.0-dev.20230226 → 5.0.2
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 +140 -142
- package/lib/tsserver.js +345 -284
- package/lib/tsserverlibrary.d.ts +6 -1
- package/lib/tsserverlibrary.js +345 -281
- package/lib/typescript.d.ts +6 -1
- package/lib/typescript.js +345 -279
- package/lib/typingsInstaller.js +7 -20
- package/package.json +16 -16
package/lib/tsserver.js
CHANGED
|
@@ -62,7 +62,6 @@ __export(server_exports, {
|
|
|
62
62
|
ContextFlags: () => ContextFlags,
|
|
63
63
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
64
64
|
Debug: () => Debug,
|
|
65
|
-
DeprecationVersion: () => DeprecationVersion,
|
|
66
65
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
67
66
|
Diagnostics: () => Diagnostics,
|
|
68
67
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -885,7 +884,6 @@ __export(server_exports, {
|
|
|
885
884
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
886
885
|
getNodeId: () => getNodeId,
|
|
887
886
|
getNodeKind: () => getNodeKind,
|
|
888
|
-
getNodeMajorVersion: () => getNodeMajorVersion,
|
|
889
887
|
getNodeModifiers: () => getNodeModifiers,
|
|
890
888
|
getNodeModulePathParts: () => getNodeModulePathParts,
|
|
891
889
|
getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
|
|
@@ -2288,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2288
2286
|
|
|
2289
2287
|
// src/compiler/corePublic.ts
|
|
2290
2288
|
var versionMajorMinor = "5.0";
|
|
2291
|
-
var version =
|
|
2289
|
+
var version = "5.0.2";
|
|
2292
2290
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2293
2291
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2294
2292
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6885,6 +6883,7 @@ function diagnosticCategoryName(d, lowerCase = true) {
|
|
|
6885
6883
|
}
|
|
6886
6884
|
var ModuleResolutionKind = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
6887
6885
|
ModuleResolutionKind3[ModuleResolutionKind3["Classic"] = 1] = "Classic";
|
|
6886
|
+
ModuleResolutionKind3[ModuleResolutionKind3["NodeJs"] = 2] = "NodeJs";
|
|
6888
6887
|
ModuleResolutionKind3[ModuleResolutionKind3["Node10"] = 2] = "Node10";
|
|
6889
6888
|
ModuleResolutionKind3[ModuleResolutionKind3["Node16"] = 3] = "Node16";
|
|
6890
6889
|
ModuleResolutionKind3[ModuleResolutionKind3["NodeNext"] = 99] = "NodeNext";
|
|
@@ -7449,12 +7448,6 @@ var commentPragmas = {
|
|
|
7449
7448
|
kind: 4 /* MultiLine */
|
|
7450
7449
|
}
|
|
7451
7450
|
};
|
|
7452
|
-
var DeprecationVersion = /* @__PURE__ */ ((DeprecationVersion2) => {
|
|
7453
|
-
DeprecationVersion2["v5_0"] = "5.0";
|
|
7454
|
-
DeprecationVersion2["v5_5"] = "5.5";
|
|
7455
|
-
DeprecationVersion2["v6_0"] = "6.0";
|
|
7456
|
-
return DeprecationVersion2;
|
|
7457
|
-
})(DeprecationVersion || {});
|
|
7458
7451
|
|
|
7459
7452
|
// src/compiler/sys.ts
|
|
7460
7453
|
function generateDjb2Hash(data) {
|
|
@@ -8362,20 +8355,6 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
8362
8355
|
(path2) => sys2.directoryExists(path2)
|
|
8363
8356
|
);
|
|
8364
8357
|
}
|
|
8365
|
-
function getNodeMajorVersion() {
|
|
8366
|
-
if (typeof process === "undefined") {
|
|
8367
|
-
return void 0;
|
|
8368
|
-
}
|
|
8369
|
-
const version2 = process.version;
|
|
8370
|
-
if (!version2) {
|
|
8371
|
-
return void 0;
|
|
8372
|
-
}
|
|
8373
|
-
const dot = version2.indexOf(".");
|
|
8374
|
-
if (dot === -1) {
|
|
8375
|
-
return void 0;
|
|
8376
|
-
}
|
|
8377
|
-
return parseInt(version2.substring(1, dot));
|
|
8378
|
-
}
|
|
8379
8358
|
var sys = (() => {
|
|
8380
8359
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
8381
8360
|
function getNodeSystem() {
|
|
@@ -8392,14 +8371,12 @@ var sys = (() => {
|
|
|
8392
8371
|
let activeSession;
|
|
8393
8372
|
let profilePath = "./profile.cpuprofile";
|
|
8394
8373
|
const Buffer2 = require("buffer").Buffer;
|
|
8395
|
-
const nodeVersion = getNodeMajorVersion();
|
|
8396
|
-
const isNode4OrLater = nodeVersion >= 4;
|
|
8397
8374
|
const isLinuxOrMacOs = process.platform === "linux" || process.platform === "darwin";
|
|
8398
8375
|
const platform = _os.platform();
|
|
8399
8376
|
const useCaseSensitiveFileNames = isFileSystemCaseSensitive();
|
|
8400
8377
|
const fsRealpath = !!_fs.realpathSync.native ? process.platform === "win32" ? fsRealPathHandlingLongPath : _fs.realpathSync.native : _fs.realpathSync;
|
|
8401
8378
|
const executingFilePath = __filename.endsWith("sys.js") ? _path.join(_path.dirname(__dirname), "__fake__.js") : __filename;
|
|
8402
|
-
const fsSupportsRecursiveFsWatch =
|
|
8379
|
+
const fsSupportsRecursiveFsWatch = process.platform === "win32" || process.platform === "darwin";
|
|
8403
8380
|
const getCurrentDirectory = memoize(() => process.cwd());
|
|
8404
8381
|
const { watchFile: watchFile2, watchDirectory } = createSystemWatchFunctions({
|
|
8405
8382
|
pollingWatchFileWorker: fsWatchFileWorker,
|
|
@@ -10358,12 +10335,14 @@ var Diagnostics = {
|
|
|
10358
10335
|
Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set: diag(5096, 1 /* Error */, "Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set_5096", "Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set."),
|
|
10359
10336
|
An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled: diag(5097, 1 /* Error */, "An_import_path_can_only_end_with_a_0_extension_when_allowImportingTsExtensions_is_enabled_5097", "An import path can only end with a '{0}' extension when 'allowImportingTsExtensions' is enabled."),
|
|
10360
10337
|
Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler: diag(5098, 1 /* Error */, "Option_0_can_only_be_used_when_moduleResolution_is_set_to_node16_nodenext_or_bundler_5098", "Option '{0}' can only be used when 'moduleResolution' is set to 'node16', 'nodenext', or 'bundler'."),
|
|
10361
|
-
|
|
10362
|
-
|
|
10338
|
+
Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error: diag(5101, 1 /* Error */, "Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprec_5101", `Option '{0}' is deprecated and will stop functioning in TypeScript {1}. Specify compilerOption '"ignoreDeprecations": "{2}"' to silence this error.`),
|
|
10339
|
+
Option_0_has_been_removed_Please_remove_it_from_your_configuration: diag(5102, 1 /* Error */, "Option_0_has_been_removed_Please_remove_it_from_your_configuration_5102", "Option '{0}' has been removed. Please remove it from your configuration."),
|
|
10363
10340
|
Invalid_value_for_ignoreDeprecations: diag(5103, 1 /* Error */, "Invalid_value_for_ignoreDeprecations_5103", "Invalid value for '--ignoreDeprecations'."),
|
|
10364
10341
|
Option_0_is_redundant_and_cannot_be_specified_with_option_1: diag(5104, 1 /* Error */, "Option_0_is_redundant_and_cannot_be_specified_with_option_1_5104", "Option '{0}' is redundant and cannot be specified with option '{1}'."),
|
|
10365
10342
|
Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System: diag(5105, 1 /* Error */, "Option_verbatimModuleSyntax_cannot_be_used_when_module_is_set_to_UMD_AMD_or_System_5105", "Option 'verbatimModuleSyntax' cannot be used when 'module' is set to 'UMD', 'AMD', or 'System'."),
|
|
10366
10343
|
Use_0_instead: diag(5106, 3 /* Message */, "Use_0_instead_5106", "Use '{0}' instead."),
|
|
10344
|
+
Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error: diag(5107, 1 /* Error */, "Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDepr_5107", `Option '{0}={1}' is deprecated and will stop functioning in TypeScript {2}. Specify compilerOption '"ignoreDeprecations": "{3}"' to silence this error.`),
|
|
10345
|
+
Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
|
|
10367
10346
|
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
|
|
10368
10347
|
Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
|
|
10369
10348
|
Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
|
|
@@ -62774,6 +62753,9 @@ function createTypeChecker(host) {
|
|
|
62774
62753
|
function isTypeSubtypeOf(source, target) {
|
|
62775
62754
|
return isTypeRelatedTo(source, target, subtypeRelation);
|
|
62776
62755
|
}
|
|
62756
|
+
function isTypeStrictSubtypeOf(source, target) {
|
|
62757
|
+
return isTypeRelatedTo(source, target, strictSubtypeRelation);
|
|
62758
|
+
}
|
|
62777
62759
|
function isTypeAssignableTo(source, target) {
|
|
62778
62760
|
return isTypeRelatedTo(source, target, assignableRelation);
|
|
62779
62761
|
}
|
|
@@ -64682,7 +64664,7 @@ function createTypeChecker(host) {
|
|
|
64682
64664
|
0 /* None */
|
|
64683
64665
|
);
|
|
64684
64666
|
}
|
|
64685
|
-
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
64667
|
+
} else if (result2 && isNonGenericObjectType(target2) && !isArrayOrTupleType(target2) && source2.flags & 2097152 /* Intersection */ && getApparentType(source2).flags & 3670016 /* StructuredType */ && !some(source2.types, (t) => t === target2 || !!(getObjectFlags(t) & 262144 /* NonInferrableType */))) {
|
|
64686
64668
|
result2 &= propertiesRelatedTo(
|
|
64687
64669
|
source2,
|
|
64688
64670
|
target2,
|
|
@@ -69869,7 +69851,7 @@ function createTypeChecker(host) {
|
|
|
69869
69851
|
const narrowedType = mapType(candidate, (c) => {
|
|
69870
69852
|
const discriminant = keyPropertyName && getTypeOfPropertyOfType(c, keyPropertyName);
|
|
69871
69853
|
const matching = discriminant && getConstituentTypeForKeyType(type, discriminant);
|
|
69872
|
-
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) =>
|
|
69854
|
+
const directlyRelated = mapType(matching || type, checkDerived ? (t) => isTypeDerivedFrom(t, c) ? t : isTypeDerivedFrom(c, t) ? c : neverType : (t) => isTypeStrictSubtypeOf(t, c) ? t : isTypeStrictSubtypeOf(c, t) ? c : isTypeSubtypeOf(t, c) ? t : isTypeSubtypeOf(c, t) ? c : neverType);
|
|
69873
69855
|
return directlyRelated.flags & 131072 /* Never */ ? mapType(type, (t) => maybeTypeOfKind(t, 465829888 /* Instantiable */) && isRelated(c, getBaseConstraintOfType(t) || unknownType) ? getIntersectionType([t, c]) : neverType) : directlyRelated;
|
|
69874
69856
|
});
|
|
69875
69857
|
return !(narrowedType.flags & 131072 /* Never */) ? narrowedType : isTypeSubtypeOf(candidate, type) ? candidate : isTypeAssignableTo(type, candidate) ? type : isTypeAssignableTo(candidate, type) ? candidate : getIntersectionType([type, candidate]);
|
|
@@ -95817,8 +95799,11 @@ function transformESDecorators(context) {
|
|
|
95817
95799
|
false,
|
|
95818
95800
|
visitor
|
|
95819
95801
|
);
|
|
95802
|
+
const superStatementIndex = findSuperStatementIndex(node.body.statements, nonPrologueStart);
|
|
95803
|
+
const indexOfFirstStatementAfterSuper = superStatementIndex >= 0 ? superStatementIndex + 1 : void 0;
|
|
95804
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, nonPrologueStart, indexOfFirstStatementAfterSuper ? indexOfFirstStatementAfterSuper - nonPrologueStart : void 0));
|
|
95820
95805
|
addRange(statements, initializerStatements);
|
|
95821
|
-
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement,
|
|
95806
|
+
addRange(statements, visitNodes2(node.body.statements, visitor, isStatement, indexOfFirstStatementAfterSuper));
|
|
95822
95807
|
body = factory2.createBlock(
|
|
95823
95808
|
statements,
|
|
95824
95809
|
/*multiLine*/
|
|
@@ -117754,6 +117739,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
117754
117739
|
const createProgramOptions = isArray(rootNamesOrOptions) ? createCreateProgramOptions(rootNamesOrOptions, _options, _host, _oldProgram, _configFileParsingDiagnostics) : rootNamesOrOptions;
|
|
117755
117740
|
const { rootNames, options, configFileParsingDiagnostics, projectReferences, typeScriptVersion: typeScriptVersion3 } = createProgramOptions;
|
|
117756
117741
|
let { oldProgram } = createProgramOptions;
|
|
117742
|
+
const reportInvalidIgnoreDeprecations = memoize(() => createOptionValueDiagnostic("ignoreDeprecations", Diagnostics.Invalid_value_for_ignoreDeprecations));
|
|
117757
117743
|
let processingDefaultLibFiles;
|
|
117758
117744
|
let processingOtherFiles;
|
|
117759
117745
|
let files;
|
|
@@ -120180,127 +120166,131 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120180
120166
|
}
|
|
120181
120167
|
}
|
|
120182
120168
|
}
|
|
120183
|
-
function
|
|
120184
|
-
const version2 = typeScriptVersion3 || versionMajorMinor;
|
|
120169
|
+
function getIgnoreDeprecationsVersion() {
|
|
120185
120170
|
const ignoreDeprecations = options.ignoreDeprecations;
|
|
120186
120171
|
if (ignoreDeprecations) {
|
|
120187
|
-
if (ignoreDeprecations === "5.0"
|
|
120188
|
-
return;
|
|
120189
|
-
}
|
|
120190
|
-
|
|
120191
|
-
|
|
120172
|
+
if (ignoreDeprecations === "5.0") {
|
|
120173
|
+
return new Version(ignoreDeprecations);
|
|
120174
|
+
}
|
|
120175
|
+
reportInvalidIgnoreDeprecations();
|
|
120176
|
+
}
|
|
120177
|
+
return Version.zero;
|
|
120178
|
+
}
|
|
120179
|
+
function checkDeprecations(deprecatedIn, removedIn, createDiagnostic, fn) {
|
|
120180
|
+
const deprecatedInVersion = new Version(deprecatedIn);
|
|
120181
|
+
const removedInVersion = new Version(removedIn);
|
|
120182
|
+
const typescriptVersion = new Version(typeScriptVersion3 || versionMajorMinor);
|
|
120183
|
+
const ignoreDeprecationsVersion = getIgnoreDeprecationsVersion();
|
|
120184
|
+
const mustBeRemoved = !(removedInVersion.compareTo(typescriptVersion) === 1 /* GreaterThan */);
|
|
120185
|
+
const canBeSilenced = !mustBeRemoved && ignoreDeprecationsVersion.compareTo(deprecatedInVersion) === -1 /* LessThan */;
|
|
120186
|
+
if (mustBeRemoved || canBeSilenced) {
|
|
120187
|
+
fn((name, value, useInstead) => {
|
|
120188
|
+
if (mustBeRemoved) {
|
|
120189
|
+
if (value === void 0) {
|
|
120190
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_has_been_removed_Please_remove_it_from_your_configuration, name);
|
|
120191
|
+
} else {
|
|
120192
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_has_been_removed_Please_remove_it_from_your_configuration, name, value);
|
|
120193
|
+
}
|
|
120194
|
+
} else {
|
|
120195
|
+
if (value === void 0) {
|
|
120196
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, name, removedIn, deprecatedIn);
|
|
120197
|
+
} else {
|
|
120198
|
+
createDiagnostic(name, value, useInstead, Diagnostics.Option_0_1_is_deprecated_and_will_stop_functioning_in_TypeScript_2_Specify_compilerOption_ignoreDeprecations_Colon_3_to_silence_this_error, name, value, removedIn, deprecatedIn);
|
|
120199
|
+
}
|
|
120200
|
+
}
|
|
120201
|
+
});
|
|
120192
120202
|
}
|
|
120193
|
-
return version2;
|
|
120194
120203
|
}
|
|
120195
120204
|
function verifyDeprecatedCompilerOptions() {
|
|
120196
|
-
|
|
120197
|
-
|
|
120198
|
-
|
|
120199
|
-
|
|
120200
|
-
|
|
120201
|
-
|
|
120202
|
-
|
|
120203
|
-
|
|
120204
|
-
|
|
120205
|
-
|
|
120206
|
-
|
|
120207
|
-
|
|
120208
|
-
|
|
120209
|
-
|
|
120210
|
-
|
|
120211
|
-
|
|
120212
|
-
|
|
120213
|
-
|
|
120214
|
-
|
|
120215
|
-
|
|
120216
|
-
|
|
120217
|
-
|
|
120218
|
-
|
|
120219
|
-
|
|
120220
|
-
|
|
120221
|
-
|
|
120222
|
-
|
|
120223
|
-
|
|
120224
|
-
|
|
120225
|
-
}
|
|
120226
|
-
if (options.importsNotUsedAsValues) {
|
|
120227
|
-
createDeprecatedDiagnosticForOption(
|
|
120228
|
-
version2,
|
|
120229
|
-
"importsNotUsedAsValues",
|
|
120230
|
-
/*value*/
|
|
120231
|
-
void 0,
|
|
120232
|
-
"verbatimModuleSyntax"
|
|
120233
|
-
);
|
|
120234
|
-
}
|
|
120235
|
-
if (options.preserveValueImports) {
|
|
120236
|
-
createDeprecatedDiagnosticForOption(
|
|
120237
|
-
version2,
|
|
120238
|
-
"preserveValueImports",
|
|
120239
|
-
/*value*/
|
|
120240
|
-
void 0,
|
|
120241
|
-
"verbatimModuleSyntax"
|
|
120242
|
-
);
|
|
120243
|
-
}
|
|
120244
|
-
}
|
|
120245
|
-
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120246
|
-
if (ref.prepend) {
|
|
120247
|
-
const version2 = getVersionForDeprecationDiagnostics(
|
|
120248
|
-
/*reportInvalidIgnoreDeprecations*/
|
|
120249
|
-
false
|
|
120250
|
-
);
|
|
120251
|
-
if (version2) {
|
|
120252
|
-
createDeprecatedOptionForVersionDiagnostic(
|
|
120253
|
-
version2,
|
|
120254
|
-
(message, arg0, arg1, arg2) => createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2),
|
|
120255
|
-
"prepend"
|
|
120205
|
+
function createDiagnostic(name, value, useInstead, message, arg0, arg1, arg2, arg3) {
|
|
120206
|
+
if (useInstead) {
|
|
120207
|
+
const details = chainDiagnosticMessages(
|
|
120208
|
+
/*details*/
|
|
120209
|
+
void 0,
|
|
120210
|
+
Diagnostics.Use_0_instead,
|
|
120211
|
+
useInstead
|
|
120212
|
+
);
|
|
120213
|
+
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2, arg3);
|
|
120214
|
+
createDiagnosticForOption(
|
|
120215
|
+
/*onKey*/
|
|
120216
|
+
!value,
|
|
120217
|
+
name,
|
|
120218
|
+
/*option2*/
|
|
120219
|
+
void 0,
|
|
120220
|
+
chain
|
|
120221
|
+
);
|
|
120222
|
+
} else {
|
|
120223
|
+
createDiagnosticForOption(
|
|
120224
|
+
/*onKey*/
|
|
120225
|
+
!value,
|
|
120226
|
+
name,
|
|
120227
|
+
/*option2*/
|
|
120228
|
+
void 0,
|
|
120229
|
+
message,
|
|
120230
|
+
arg0,
|
|
120231
|
+
arg1,
|
|
120232
|
+
arg2,
|
|
120233
|
+
arg3
|
|
120256
120234
|
);
|
|
120257
120235
|
}
|
|
120258
120236
|
}
|
|
120237
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120238
|
+
if (options.target === 0 /* ES3 */) {
|
|
120239
|
+
createDeprecatedDiagnostic("target", "ES3");
|
|
120240
|
+
}
|
|
120241
|
+
if (options.noImplicitUseStrict) {
|
|
120242
|
+
createDeprecatedDiagnostic("noImplicitUseStrict");
|
|
120243
|
+
}
|
|
120244
|
+
if (options.keyofStringsOnly) {
|
|
120245
|
+
createDeprecatedDiagnostic("keyofStringsOnly");
|
|
120246
|
+
}
|
|
120247
|
+
if (options.suppressExcessPropertyErrors) {
|
|
120248
|
+
createDeprecatedDiagnostic("suppressExcessPropertyErrors");
|
|
120249
|
+
}
|
|
120250
|
+
if (options.suppressImplicitAnyIndexErrors) {
|
|
120251
|
+
createDeprecatedDiagnostic("suppressImplicitAnyIndexErrors");
|
|
120252
|
+
}
|
|
120253
|
+
if (options.noStrictGenericChecks) {
|
|
120254
|
+
createDeprecatedDiagnostic("noStrictGenericChecks");
|
|
120255
|
+
}
|
|
120256
|
+
if (options.charset) {
|
|
120257
|
+
createDeprecatedDiagnostic("charset");
|
|
120258
|
+
}
|
|
120259
|
+
if (options.out) {
|
|
120260
|
+
createDeprecatedDiagnostic(
|
|
120261
|
+
"out",
|
|
120262
|
+
/*value*/
|
|
120263
|
+
void 0,
|
|
120264
|
+
"outFile"
|
|
120265
|
+
);
|
|
120266
|
+
}
|
|
120267
|
+
if (options.importsNotUsedAsValues) {
|
|
120268
|
+
createDeprecatedDiagnostic(
|
|
120269
|
+
"importsNotUsedAsValues",
|
|
120270
|
+
/*value*/
|
|
120271
|
+
void 0,
|
|
120272
|
+
"verbatimModuleSyntax"
|
|
120273
|
+
);
|
|
120274
|
+
}
|
|
120275
|
+
if (options.preserveValueImports) {
|
|
120276
|
+
createDeprecatedDiagnostic(
|
|
120277
|
+
"preserveValueImports",
|
|
120278
|
+
/*value*/
|
|
120279
|
+
void 0,
|
|
120280
|
+
"verbatimModuleSyntax"
|
|
120281
|
+
);
|
|
120282
|
+
}
|
|
120283
|
+
});
|
|
120259
120284
|
}
|
|
120260
|
-
function
|
|
120261
|
-
|
|
120262
|
-
|
|
120263
|
-
(message, arg0, arg1, arg2) => {
|
|
120264
|
-
if (useInstead) {
|
|
120265
|
-
const details = chainDiagnosticMessages(
|
|
120266
|
-
/*details*/
|
|
120267
|
-
void 0,
|
|
120268
|
-
Diagnostics.Use_0_instead,
|
|
120269
|
-
useInstead
|
|
120270
|
-
);
|
|
120271
|
-
const chain = chainDiagnosticMessages(details, message, arg0, arg1, arg2);
|
|
120272
|
-
createDiagnosticForOption(
|
|
120273
|
-
/*onKey*/
|
|
120274
|
-
!value,
|
|
120275
|
-
name,
|
|
120276
|
-
/*option2*/
|
|
120277
|
-
void 0,
|
|
120278
|
-
chain
|
|
120279
|
-
);
|
|
120280
|
-
} else {
|
|
120281
|
-
createDiagnosticForOption(
|
|
120282
|
-
/*onKey*/
|
|
120283
|
-
!value,
|
|
120284
|
-
name,
|
|
120285
|
-
/*option2*/
|
|
120286
|
-
void 0,
|
|
120287
|
-
message,
|
|
120288
|
-
arg0,
|
|
120289
|
-
arg1,
|
|
120290
|
-
arg2
|
|
120291
|
-
);
|
|
120292
|
-
}
|
|
120293
|
-
},
|
|
120294
|
-
name,
|
|
120295
|
-
value
|
|
120296
|
-
);
|
|
120297
|
-
}
|
|
120298
|
-
function createDeprecatedOptionForVersionDiagnostic(version2, createDiagnostic, name, value) {
|
|
120299
|
-
if (version2 === "6.0" /* v6_0 */) {
|
|
120300
|
-
createDiagnostic(Diagnostics.Flag_0_is_deprecated_Please_remove_it_from_your_configuration, value || name);
|
|
120301
|
-
} else {
|
|
120302
|
-
createDiagnostic(Diagnostics.Flag_0_is_deprecated_and_will_stop_functioning_in_TypeScript_1_Specify_compilerOption_ignoreDeprecations_Colon_2_to_silence_this_error, value || name, "5.5" /* v5_5 */, "5.0" /* v5_0 */);
|
|
120285
|
+
function verifyDeprecatedProjectReference(ref, parentFile, index) {
|
|
120286
|
+
function createDiagnostic(_name, _value, _useInstead, message, arg0, arg1, arg2, arg3) {
|
|
120287
|
+
createDiagnosticForReference(parentFile, index, message, arg0, arg1, arg2, arg3);
|
|
120303
120288
|
}
|
|
120289
|
+
checkDeprecations("5.0", "5.5", createDiagnostic, (createDeprecatedDiagnostic) => {
|
|
120290
|
+
if (ref.prepend) {
|
|
120291
|
+
createDeprecatedDiagnostic("prepend");
|
|
120292
|
+
}
|
|
120293
|
+
});
|
|
120304
120294
|
}
|
|
120305
120295
|
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
|
120306
120296
|
var _a3;
|
|
@@ -120553,25 +120543,25 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120553
120543
|
arg1
|
|
120554
120544
|
);
|
|
120555
120545
|
}
|
|
120556
|
-
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2) {
|
|
120546
|
+
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1, arg2, arg3) {
|
|
120557
120547
|
const referencesSyntax = firstDefined(
|
|
120558
120548
|
getTsConfigPropArray(sourceFile || options.configFile, "references"),
|
|
120559
120549
|
(property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0
|
|
120560
120550
|
);
|
|
120561
120551
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
|
120562
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2));
|
|
120552
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, arg0, arg1, arg2, arg3));
|
|
120563
120553
|
} else {
|
|
120564
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
120554
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
120565
120555
|
}
|
|
120566
120556
|
}
|
|
120567
|
-
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2) {
|
|
120557
|
+
function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1, arg2, arg3) {
|
|
120568
120558
|
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
|
120569
|
-
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2);
|
|
120559
|
+
const needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1, arg2, arg3);
|
|
120570
120560
|
if (needCompilerDiagnostic) {
|
|
120571
120561
|
if ("messageText" in message) {
|
|
120572
120562
|
programDiagnostics.add(createCompilerDiagnosticFromMessageChain(message));
|
|
120573
120563
|
} else {
|
|
120574
|
-
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2));
|
|
120564
|
+
programDiagnostics.add(createCompilerDiagnostic(message, arg0, arg1, arg2, arg3));
|
|
120575
120565
|
}
|
|
120576
120566
|
}
|
|
120577
120567
|
}
|
|
@@ -120590,13 +120580,13 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
120590
120580
|
}
|
|
120591
120581
|
return _compilerOptionsObjectLiteralSyntax || void 0;
|
|
120592
120582
|
}
|
|
120593
|
-
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2) {
|
|
120583
|
+
function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1, arg2, arg3) {
|
|
120594
120584
|
const props = getPropertyAssignment(objectLiteral, key1, key2);
|
|
120595
120585
|
for (const prop of props) {
|
|
120596
120586
|
if ("messageText" in message) {
|
|
120597
120587
|
programDiagnostics.add(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
|
120598
120588
|
} else {
|
|
120599
|
-
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2));
|
|
120589
|
+
programDiagnostics.add(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1, arg2, arg3));
|
|
120600
120590
|
}
|
|
120601
120591
|
}
|
|
120602
120592
|
return !!props.length;
|
|
@@ -133398,6 +133388,11 @@ function canBeConvertedToAsync(node) {
|
|
|
133398
133388
|
}
|
|
133399
133389
|
|
|
133400
133390
|
// src/services/transpile.ts
|
|
133391
|
+
var optionsRedundantWithVerbatimModuleSyntax = /* @__PURE__ */ new Set([
|
|
133392
|
+
"isolatedModules",
|
|
133393
|
+
"preserveValueImports",
|
|
133394
|
+
"importsNotUsedAsValues"
|
|
133395
|
+
]);
|
|
133401
133396
|
function transpileModule(input, transpileOptions) {
|
|
133402
133397
|
const diagnostics = [];
|
|
133403
133398
|
const options = transpileOptions.compilerOptions ? fixupCompilerOptions(transpileOptions.compilerOptions, diagnostics) : {};
|
|
@@ -133408,6 +133403,9 @@ function transpileModule(input, transpileOptions) {
|
|
|
133408
133403
|
}
|
|
133409
133404
|
}
|
|
133410
133405
|
for (const option of transpileOptionValueCompilerOptions) {
|
|
133406
|
+
if (options.verbatimModuleSyntax && optionsRedundantWithVerbatimModuleSyntax.has(option.name)) {
|
|
133407
|
+
continue;
|
|
133408
|
+
}
|
|
133411
133409
|
options[option.name] = option.transpileOptionValue;
|
|
133412
133410
|
}
|
|
133413
133411
|
options.suppressOutputPathCheck = true;
|
|
@@ -141198,53 +141196,121 @@ function getTypeExportSpecifiers(originExportSpecifier, context) {
|
|
|
141198
141196
|
}
|
|
141199
141197
|
|
|
141200
141198
|
// src/services/codefixes/convertToTypeOnlyImport.ts
|
|
141201
|
-
var errorCodes14 = [
|
|
141199
|
+
var errorCodes14 = [
|
|
141200
|
+
Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
|
|
141201
|
+
Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
|
|
141202
|
+
];
|
|
141202
141203
|
var fixId13 = "convertToTypeOnlyImport";
|
|
141203
141204
|
registerCodeFix({
|
|
141204
141205
|
errorCodes: errorCodes14,
|
|
141205
141206
|
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
141206
|
-
const
|
|
141207
|
-
|
|
141208
|
-
|
|
141209
|
-
});
|
|
141210
|
-
if (changes.length) {
|
|
141207
|
+
const declaration = getDeclaration2(context.sourceFile, context.span.start);
|
|
141208
|
+
if (declaration) {
|
|
141209
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
|
|
141211
141210
|
return [createCodeFixAction(fixId13, changes, Diagnostics.Convert_to_type_only_import, fixId13, Diagnostics.Convert_all_imports_not_used_as_a_value_to_type_only_imports)];
|
|
141212
141211
|
}
|
|
141212
|
+
return void 0;
|
|
141213
141213
|
},
|
|
141214
141214
|
fixIds: [fixId13],
|
|
141215
141215
|
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
141216
141216
|
return codeFixAll(context, errorCodes14, (changes, diag2) => {
|
|
141217
|
-
const
|
|
141218
|
-
|
|
141217
|
+
const declaration = getDeclaration2(diag2.file, diag2.start);
|
|
141218
|
+
if (declaration) {
|
|
141219
|
+
doChange4(changes, diag2.file, declaration);
|
|
141220
|
+
}
|
|
141219
141221
|
});
|
|
141220
141222
|
}
|
|
141221
141223
|
});
|
|
141222
|
-
function
|
|
141223
|
-
|
|
141224
|
+
function getDeclaration2(sourceFile, pos) {
|
|
141225
|
+
const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
|
|
141226
|
+
return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
|
|
141224
141227
|
}
|
|
141225
|
-
function
|
|
141226
|
-
if (
|
|
141227
|
-
|
|
141228
|
-
|
|
141229
|
-
|
|
141230
|
-
|
|
141231
|
-
|
|
141232
|
-
|
|
141233
|
-
changes.insertNodeBefore(context.sourceFile, importDeclaration, factory.updateImportDeclaration(
|
|
141234
|
-
importDeclaration,
|
|
141235
|
-
/*modifiers*/
|
|
141236
|
-
void 0,
|
|
141237
|
-
factory.createImportClause(
|
|
141238
|
-
/*isTypeOnly*/
|
|
141239
|
-
true,
|
|
141240
|
-
importClause.name,
|
|
141241
|
-
/*namedBindings*/
|
|
141242
|
-
void 0
|
|
141243
|
-
),
|
|
141244
|
-
importDeclaration.moduleSpecifier,
|
|
141245
|
-
/*assertClause*/
|
|
141246
|
-
void 0
|
|
141228
|
+
function doChange4(changes, sourceFile, declaration) {
|
|
141229
|
+
if (isImportSpecifier(declaration)) {
|
|
141230
|
+
changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
|
|
141231
|
+
declaration,
|
|
141232
|
+
/*isTypeOnly*/
|
|
141233
|
+
true,
|
|
141234
|
+
declaration.propertyName,
|
|
141235
|
+
declaration.name
|
|
141247
141236
|
));
|
|
141237
|
+
} else {
|
|
141238
|
+
const importClause = declaration.importClause;
|
|
141239
|
+
if (importClause.name && importClause.namedBindings) {
|
|
141240
|
+
changes.replaceNodeWithNodes(sourceFile, declaration, [
|
|
141241
|
+
factory.createImportDeclaration(
|
|
141242
|
+
getSynthesizedDeepClones(
|
|
141243
|
+
declaration.modifiers,
|
|
141244
|
+
/*includeTrivia*/
|
|
141245
|
+
true
|
|
141246
|
+
),
|
|
141247
|
+
factory.createImportClause(
|
|
141248
|
+
/*isTypeOnly*/
|
|
141249
|
+
true,
|
|
141250
|
+
getSynthesizedDeepClone(
|
|
141251
|
+
importClause.name,
|
|
141252
|
+
/*includeTrivia*/
|
|
141253
|
+
true
|
|
141254
|
+
),
|
|
141255
|
+
/*namedBindings*/
|
|
141256
|
+
void 0
|
|
141257
|
+
),
|
|
141258
|
+
getSynthesizedDeepClone(
|
|
141259
|
+
declaration.moduleSpecifier,
|
|
141260
|
+
/*includeTrivia*/
|
|
141261
|
+
true
|
|
141262
|
+
),
|
|
141263
|
+
getSynthesizedDeepClone(
|
|
141264
|
+
declaration.assertClause,
|
|
141265
|
+
/*includeTrivia*/
|
|
141266
|
+
true
|
|
141267
|
+
)
|
|
141268
|
+
),
|
|
141269
|
+
factory.createImportDeclaration(
|
|
141270
|
+
getSynthesizedDeepClones(
|
|
141271
|
+
declaration.modifiers,
|
|
141272
|
+
/*includeTrivia*/
|
|
141273
|
+
true
|
|
141274
|
+
),
|
|
141275
|
+
factory.createImportClause(
|
|
141276
|
+
/*isTypeOnly*/
|
|
141277
|
+
true,
|
|
141278
|
+
/*name*/
|
|
141279
|
+
void 0,
|
|
141280
|
+
getSynthesizedDeepClone(
|
|
141281
|
+
importClause.namedBindings,
|
|
141282
|
+
/*includeTrivia*/
|
|
141283
|
+
true
|
|
141284
|
+
)
|
|
141285
|
+
),
|
|
141286
|
+
getSynthesizedDeepClone(
|
|
141287
|
+
declaration.moduleSpecifier,
|
|
141288
|
+
/*includeTrivia*/
|
|
141289
|
+
true
|
|
141290
|
+
),
|
|
141291
|
+
getSynthesizedDeepClone(
|
|
141292
|
+
declaration.assertClause,
|
|
141293
|
+
/*includeTrivia*/
|
|
141294
|
+
true
|
|
141295
|
+
)
|
|
141296
|
+
)
|
|
141297
|
+
]);
|
|
141298
|
+
} else {
|
|
141299
|
+
const importDeclaration = factory.updateImportDeclaration(
|
|
141300
|
+
declaration,
|
|
141301
|
+
declaration.modifiers,
|
|
141302
|
+
factory.updateImportClause(
|
|
141303
|
+
importClause,
|
|
141304
|
+
/*isTypeOnly*/
|
|
141305
|
+
true,
|
|
141306
|
+
importClause.name,
|
|
141307
|
+
importClause.namedBindings
|
|
141308
|
+
),
|
|
141309
|
+
declaration.moduleSpecifier,
|
|
141310
|
+
declaration.assertClause
|
|
141311
|
+
);
|
|
141312
|
+
changes.replaceNode(sourceFile, declaration, importDeclaration);
|
|
141313
|
+
}
|
|
141248
141314
|
}
|
|
141249
141315
|
}
|
|
141250
141316
|
|
|
@@ -141260,14 +141326,14 @@ registerCodeFix({
|
|
|
141260
141326
|
return void 0;
|
|
141261
141327
|
}
|
|
141262
141328
|
const { name, constraint } = info;
|
|
141263
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
141329
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, sourceFile, info));
|
|
141264
141330
|
return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)];
|
|
141265
141331
|
},
|
|
141266
141332
|
fixIds: [fixId14],
|
|
141267
141333
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
|
|
141268
141334
|
const info = getInfo2(diag2.file, diag2.start);
|
|
141269
141335
|
if (info) {
|
|
141270
|
-
|
|
141336
|
+
doChange5(changes, diag2.file, info);
|
|
141271
141337
|
}
|
|
141272
141338
|
})
|
|
141273
141339
|
});
|
|
@@ -141285,7 +141351,7 @@ function getInfo2(sourceFile, pos) {
|
|
|
141285
141351
|
}
|
|
141286
141352
|
return void 0;
|
|
141287
141353
|
}
|
|
141288
|
-
function
|
|
141354
|
+
function doChange5(changes, sourceFile, { container, typeNode, constraint, name }) {
|
|
141289
141355
|
changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
|
|
141290
141356
|
/*readonlyToken*/
|
|
141291
141357
|
void 0,
|
|
@@ -142878,12 +142944,12 @@ registerCodeFix({
|
|
|
142878
142944
|
getCodeActions(context) {
|
|
142879
142945
|
const { sourceFile, span, preferences } = context;
|
|
142880
142946
|
const property = getPropertyAccessExpression(sourceFile, span.start);
|
|
142881
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
142947
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, context.sourceFile, property, preferences));
|
|
142882
142948
|
return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)];
|
|
142883
142949
|
},
|
|
142884
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) =>
|
|
142950
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange6(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
|
|
142885
142951
|
});
|
|
142886
|
-
function
|
|
142952
|
+
function doChange6(changes, sourceFile, node, preferences) {
|
|
142887
142953
|
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
142888
142954
|
const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
|
|
142889
142955
|
changes.replaceNode(
|
|
@@ -142905,16 +142971,16 @@ registerCodeFix({
|
|
|
142905
142971
|
const { sourceFile, program, span } = context;
|
|
142906
142972
|
let diagnostic;
|
|
142907
142973
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
|
|
142908
|
-
diagnostic =
|
|
142974
|
+
diagnostic = doChange7(t, sourceFile, span.start, program.getTypeChecker());
|
|
142909
142975
|
});
|
|
142910
142976
|
return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
|
|
142911
142977
|
},
|
|
142912
142978
|
fixIds: [fixId18],
|
|
142913
142979
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => {
|
|
142914
|
-
|
|
142980
|
+
doChange7(changes, diag2.file, diag2.start, context.program.getTypeChecker());
|
|
142915
142981
|
})
|
|
142916
142982
|
});
|
|
142917
|
-
function
|
|
142983
|
+
function doChange7(changes, sourceFile, pos, checker) {
|
|
142918
142984
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
142919
142985
|
if (!isThis(token))
|
|
142920
142986
|
return void 0;
|
|
@@ -142969,7 +143035,7 @@ registerCodeFix({
|
|
|
142969
143035
|
const info = getInfo4(sourceFile, span.start, program);
|
|
142970
143036
|
if (info === void 0)
|
|
142971
143037
|
return void 0;
|
|
142972
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143038
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, program, info));
|
|
142973
143039
|
return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)];
|
|
142974
143040
|
},
|
|
142975
143041
|
getAllCodeActions(context) {
|
|
@@ -143049,7 +143115,7 @@ function getInfo4(sourceFile, pos, program) {
|
|
|
143049
143115
|
}
|
|
143050
143116
|
return void 0;
|
|
143051
143117
|
}
|
|
143052
|
-
function
|
|
143118
|
+
function doChange8(changes, program, { exportName, node, moduleSourceFile }) {
|
|
143053
143119
|
const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
|
|
143054
143120
|
if (exportDeclaration) {
|
|
143055
143121
|
updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
|
|
@@ -143143,7 +143209,7 @@ registerCodeFix({
|
|
|
143143
143209
|
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
143144
143210
|
const { sourceFile, span } = context;
|
|
143145
143211
|
const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
143146
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143212
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, namedTupleMember));
|
|
143147
143213
|
return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
|
|
143148
143214
|
},
|
|
143149
143215
|
fixIds: [fixId20]
|
|
@@ -143152,7 +143218,7 @@ function getNamedTupleMember(sourceFile, pos) {
|
|
|
143152
143218
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
143153
143219
|
return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
|
|
143154
143220
|
}
|
|
143155
|
-
function
|
|
143221
|
+
function doChange9(changes, sourceFile, namedTupleMember) {
|
|
143156
143222
|
if (!namedTupleMember) {
|
|
143157
143223
|
return;
|
|
143158
143224
|
}
|
|
@@ -143207,7 +143273,7 @@ registerCodeFix({
|
|
|
143207
143273
|
return void 0;
|
|
143208
143274
|
const { node, suggestedSymbol } = info;
|
|
143209
143275
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
143210
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
143276
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, node, suggestedSymbol, target));
|
|
143211
143277
|
return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)];
|
|
143212
143278
|
},
|
|
143213
143279
|
fixIds: [fixId21],
|
|
@@ -143215,7 +143281,7 @@ registerCodeFix({
|
|
|
143215
143281
|
const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
|
|
143216
143282
|
const target = getEmitScriptTarget(context.host.getCompilationSettings());
|
|
143217
143283
|
if (info)
|
|
143218
|
-
|
|
143284
|
+
doChange10(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
|
|
143219
143285
|
})
|
|
143220
143286
|
});
|
|
143221
143287
|
function getInfo5(sourceFile, pos, context, errorCode) {
|
|
@@ -143267,7 +143333,7 @@ function getInfo5(sourceFile, pos, context, errorCode) {
|
|
|
143267
143333
|
}
|
|
143268
143334
|
return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
|
|
143269
143335
|
}
|
|
143270
|
-
function
|
|
143336
|
+
function doChange10(changes, sourceFile, node, suggestedSymbol, target) {
|
|
143271
143337
|
const suggestion = symbolName(suggestedSymbol);
|
|
143272
143338
|
if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
|
|
143273
143339
|
const valDecl = suggestedSymbol.valueDeclaration;
|
|
@@ -144325,7 +144391,7 @@ registerCodeFix({
|
|
|
144325
144391
|
if (!nodes)
|
|
144326
144392
|
return void 0;
|
|
144327
144393
|
const { constructor, superCall } = nodes;
|
|
144328
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144394
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, constructor, superCall));
|
|
144329
144395
|
return [createCodeFixAction(fixId25, changes, Diagnostics.Make_super_call_the_first_statement_in_the_constructor, fixId25, Diagnostics.Make_all_super_calls_the_first_statement_in_their_constructor)];
|
|
144330
144396
|
},
|
|
144331
144397
|
fixIds: [fixId25],
|
|
@@ -144338,12 +144404,12 @@ registerCodeFix({
|
|
|
144338
144404
|
return;
|
|
144339
144405
|
const { constructor, superCall } = nodes;
|
|
144340
144406
|
if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
|
|
144341
|
-
|
|
144407
|
+
doChange11(changes, sourceFile, constructor, superCall);
|
|
144342
144408
|
}
|
|
144343
144409
|
});
|
|
144344
144410
|
}
|
|
144345
144411
|
});
|
|
144346
|
-
function
|
|
144412
|
+
function doChange11(changes, sourceFile, constructor, superCall) {
|
|
144347
144413
|
changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
|
|
144348
144414
|
changes.delete(sourceFile, superCall);
|
|
144349
144415
|
}
|
|
@@ -144367,18 +144433,18 @@ registerCodeFix({
|
|
|
144367
144433
|
getCodeActions(context) {
|
|
144368
144434
|
const { sourceFile, span } = context;
|
|
144369
144435
|
const ctr = getNode(sourceFile, span.start);
|
|
144370
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144436
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, ctr));
|
|
144371
144437
|
return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)];
|
|
144372
144438
|
},
|
|
144373
144439
|
fixIds: [fixId26],
|
|
144374
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) =>
|
|
144440
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange12(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
|
|
144375
144441
|
});
|
|
144376
144442
|
function getNode(sourceFile, pos) {
|
|
144377
144443
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
144378
144444
|
Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
|
|
144379
144445
|
return token.parent;
|
|
144380
144446
|
}
|
|
144381
|
-
function
|
|
144447
|
+
function doChange12(changes, sourceFile, ctr) {
|
|
144382
144448
|
const superCall = factory.createExpressionStatement(factory.createCallExpression(
|
|
144383
144449
|
factory.createSuper(),
|
|
144384
144450
|
/*typeArguments*/
|
|
@@ -144401,7 +144467,7 @@ registerCodeFix({
|
|
|
144401
144467
|
}
|
|
144402
144468
|
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
144403
144469
|
context,
|
|
144404
|
-
(changeTracker) =>
|
|
144470
|
+
(changeTracker) => doChange13(changeTracker, configFile)
|
|
144405
144471
|
);
|
|
144406
144472
|
return [
|
|
144407
144473
|
createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
|
|
@@ -144413,10 +144479,10 @@ registerCodeFix({
|
|
|
144413
144479
|
if (configFile === void 0) {
|
|
144414
144480
|
return void 0;
|
|
144415
144481
|
}
|
|
144416
|
-
|
|
144482
|
+
doChange13(changes, configFile);
|
|
144417
144483
|
})
|
|
144418
144484
|
});
|
|
144419
|
-
function
|
|
144485
|
+
function doChange13(changeTracker, configFile) {
|
|
144420
144486
|
setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
|
|
144421
144487
|
}
|
|
144422
144488
|
|
|
@@ -144433,7 +144499,7 @@ registerCodeFix({
|
|
|
144433
144499
|
if (info === void 0)
|
|
144434
144500
|
return;
|
|
144435
144501
|
const { suggestion, expression, arg } = info;
|
|
144436
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144502
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, sourceFile, arg, expression));
|
|
144437
144503
|
return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)];
|
|
144438
144504
|
},
|
|
144439
144505
|
fixIds: [fixId27],
|
|
@@ -144441,7 +144507,7 @@ registerCodeFix({
|
|
|
144441
144507
|
return codeFixAll(context, errorCodes33, (changes, diag2) => {
|
|
144442
144508
|
const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
|
|
144443
144509
|
if (info) {
|
|
144444
|
-
|
|
144510
|
+
doChange14(changes, diag2.file, info.arg, info.expression);
|
|
144445
144511
|
}
|
|
144446
144512
|
});
|
|
144447
144513
|
}
|
|
@@ -144461,7 +144527,7 @@ function getInfo8(program, sourceFile, span) {
|
|
|
144461
144527
|
}
|
|
144462
144528
|
return void 0;
|
|
144463
144529
|
}
|
|
144464
|
-
function
|
|
144530
|
+
function doChange14(changes, sourceFile, arg, expression) {
|
|
144465
144531
|
const callExpression = factory.createCallExpression(
|
|
144466
144532
|
factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
|
|
144467
144533
|
/*typeArguments*/
|
|
@@ -144531,12 +144597,12 @@ registerCodeFix({
|
|
|
144531
144597
|
getCodeActions(context) {
|
|
144532
144598
|
const { sourceFile, span } = context;
|
|
144533
144599
|
const property = getProperty2(sourceFile, span.start);
|
|
144534
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144600
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, context.sourceFile, property));
|
|
144535
144601
|
return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
|
|
144536
144602
|
},
|
|
144537
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) =>
|
|
144603
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange15(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
|
|
144538
144604
|
});
|
|
144539
|
-
function
|
|
144605
|
+
function doChange15(changes, sourceFile, node) {
|
|
144540
144606
|
changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
|
|
144541
144607
|
}
|
|
144542
144608
|
function getProperty2(sourceFile, pos) {
|
|
@@ -144601,14 +144667,14 @@ registerCodeFix({
|
|
|
144601
144667
|
if (!info) {
|
|
144602
144668
|
return void 0;
|
|
144603
144669
|
}
|
|
144604
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144670
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, sourceFile, info));
|
|
144605
144671
|
return [createCodeFixAction(fixId30, changes, [Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId30, Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)];
|
|
144606
144672
|
},
|
|
144607
144673
|
fixIds: [fixId30],
|
|
144608
144674
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
|
|
144609
144675
|
const info = getInfo9(diag2.file, diag2.start, diag2.code);
|
|
144610
144676
|
if (info)
|
|
144611
|
-
|
|
144677
|
+
doChange16(changes, context.sourceFile, info);
|
|
144612
144678
|
})
|
|
144613
144679
|
});
|
|
144614
144680
|
function getInfo9(sourceFile, pos, diagCode) {
|
|
@@ -144617,7 +144683,7 @@ function getInfo9(sourceFile, pos, diagCode) {
|
|
|
144617
144683
|
return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
|
|
144618
144684
|
}
|
|
144619
144685
|
}
|
|
144620
|
-
function
|
|
144686
|
+
function doChange16(changes, sourceFile, { node, className }) {
|
|
144621
144687
|
suppressLeadingAndTrailingTrivia(node);
|
|
144622
144688
|
changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
|
|
144623
144689
|
}
|
|
@@ -144634,7 +144700,7 @@ registerCodeFix({
|
|
|
144634
144700
|
fixIds: [fixIdExpression, fixIdHtmlEntity],
|
|
144635
144701
|
getCodeActions(context) {
|
|
144636
144702
|
const { sourceFile, preferences, span } = context;
|
|
144637
|
-
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144703
|
+
const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(
|
|
144638
144704
|
t,
|
|
144639
144705
|
preferences,
|
|
144640
144706
|
sourceFile,
|
|
@@ -144642,7 +144708,7 @@ registerCodeFix({
|
|
|
144642
144708
|
/* useHtmlEntity */
|
|
144643
144709
|
false
|
|
144644
144710
|
));
|
|
144645
|
-
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
144711
|
+
const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(
|
|
144646
144712
|
t,
|
|
144647
144713
|
preferences,
|
|
144648
144714
|
sourceFile,
|
|
@@ -144656,7 +144722,7 @@ registerCodeFix({
|
|
|
144656
144722
|
];
|
|
144657
144723
|
},
|
|
144658
144724
|
getAllCodeActions(context) {
|
|
144659
|
-
return codeFixAll(context, errorCodes37, (changes, diagnostic) =>
|
|
144725
|
+
return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange17(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
|
|
144660
144726
|
}
|
|
144661
144727
|
});
|
|
144662
144728
|
var htmlEntity = {
|
|
@@ -144666,7 +144732,7 @@ var htmlEntity = {
|
|
|
144666
144732
|
function isValidCharacter(character) {
|
|
144667
144733
|
return hasProperty(htmlEntity, character);
|
|
144668
144734
|
}
|
|
144669
|
-
function
|
|
144735
|
+
function doChange17(changes, preferences, sourceFile, start2, useHtmlEntity) {
|
|
144670
144736
|
const character = sourceFile.getText()[start2];
|
|
144671
144737
|
if (!isValidCharacter(character)) {
|
|
144672
144738
|
return;
|
|
@@ -145142,13 +145208,13 @@ registerCodeFix({
|
|
|
145142
145208
|
const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
|
|
145143
145209
|
if (syntacticDiagnostics.length)
|
|
145144
145210
|
return;
|
|
145145
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145211
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
|
|
145146
145212
|
return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)];
|
|
145147
145213
|
},
|
|
145148
145214
|
fixIds: [fixId32],
|
|
145149
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) =>
|
|
145215
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange18(changes, diag2.file, diag2.start, diag2.length, diag2.code))
|
|
145150
145216
|
});
|
|
145151
|
-
function
|
|
145217
|
+
function doChange18(changes, sourceFile, start2, length2, errorCode) {
|
|
145152
145218
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
145153
145219
|
const statement = findAncestor(token, isStatement);
|
|
145154
145220
|
if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
|
|
@@ -145203,13 +145269,13 @@ var errorCodes42 = [Diagnostics.Unused_label.code];
|
|
|
145203
145269
|
registerCodeFix({
|
|
145204
145270
|
errorCodes: errorCodes42,
|
|
145205
145271
|
getCodeActions(context) {
|
|
145206
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145272
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start));
|
|
145207
145273
|
return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)];
|
|
145208
145274
|
},
|
|
145209
145275
|
fixIds: [fixId33],
|
|
145210
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) =>
|
|
145276
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start))
|
|
145211
145277
|
});
|
|
145212
|
-
function
|
|
145278
|
+
function doChange19(changes, sourceFile, start2) {
|
|
145213
145279
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
145214
145280
|
const labeledStatement = cast(token.parent, isLabeledStatement);
|
|
145215
145281
|
const pos = token.getStart(sourceFile);
|
|
@@ -145247,7 +145313,7 @@ registerCodeFix({
|
|
|
145247
145313
|
}
|
|
145248
145314
|
return actions2;
|
|
145249
145315
|
function fix(type2, fixId51, fixAllDescription) {
|
|
145250
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145316
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, sourceFile, typeNode, type2, checker));
|
|
145251
145317
|
return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription);
|
|
145252
145318
|
}
|
|
145253
145319
|
},
|
|
@@ -145261,11 +145327,11 @@ registerCodeFix({
|
|
|
145261
145327
|
return;
|
|
145262
145328
|
const { typeNode, type } = info;
|
|
145263
145329
|
const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
|
|
145264
|
-
|
|
145330
|
+
doChange20(changes, sourceFile, typeNode, fixedType, checker);
|
|
145265
145331
|
});
|
|
145266
145332
|
}
|
|
145267
145333
|
});
|
|
145268
|
-
function
|
|
145334
|
+
function doChange20(changes, sourceFile, oldTypeNode, newType, checker) {
|
|
145269
145335
|
changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
|
|
145270
145336
|
newType,
|
|
145271
145337
|
/*enclosingDeclaration*/
|
|
@@ -145328,16 +145394,16 @@ registerCodeFix({
|
|
|
145328
145394
|
const callName = getCallName(sourceFile, span.start);
|
|
145329
145395
|
if (!callName)
|
|
145330
145396
|
return;
|
|
145331
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145397
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, context.sourceFile, callName));
|
|
145332
145398
|
return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)];
|
|
145333
145399
|
},
|
|
145334
145400
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => {
|
|
145335
145401
|
const callName = getCallName(diag2.file, diag2.start);
|
|
145336
145402
|
if (callName)
|
|
145337
|
-
|
|
145403
|
+
doChange21(changes, diag2.file, callName);
|
|
145338
145404
|
})
|
|
145339
145405
|
});
|
|
145340
|
-
function
|
|
145406
|
+
function doChange21(changes, sourceFile, name) {
|
|
145341
145407
|
changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
|
|
145342
145408
|
}
|
|
145343
145409
|
function getCallName(sourceFile, start2) {
|
|
@@ -145369,7 +145435,7 @@ registerCodeFix({
|
|
|
145369
145435
|
const nodes = getNodes3(sourceFile, span.start);
|
|
145370
145436
|
if (!nodes)
|
|
145371
145437
|
return void 0;
|
|
145372
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
145438
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, sourceFile, nodes));
|
|
145373
145439
|
return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)];
|
|
145374
145440
|
},
|
|
145375
145441
|
fixIds: [fixId35],
|
|
@@ -145379,7 +145445,7 @@ registerCodeFix({
|
|
|
145379
145445
|
const nodes = getNodes3(diag2.file, diag2.start);
|
|
145380
145446
|
if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
|
|
145381
145447
|
return;
|
|
145382
|
-
|
|
145448
|
+
doChange22(changes, context.sourceFile, nodes);
|
|
145383
145449
|
});
|
|
145384
145450
|
}
|
|
145385
145451
|
});
|
|
@@ -145418,7 +145484,7 @@ function getNodes3(sourceFile, start2) {
|
|
|
145418
145484
|
returnType: getReturnType(containingFunction)
|
|
145419
145485
|
};
|
|
145420
145486
|
}
|
|
145421
|
-
function
|
|
145487
|
+
function doChange22(changes, sourceFile, { insertBefore, returnType }) {
|
|
145422
145488
|
if (returnType) {
|
|
145423
145489
|
const entityName = getEntityNameFromTypeNode(returnType);
|
|
145424
145490
|
if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
|
|
@@ -145437,14 +145503,14 @@ var fixId36 = "fixPropertyOverrideAccessor";
|
|
|
145437
145503
|
registerCodeFix({
|
|
145438
145504
|
errorCodes: errorCodes46,
|
|
145439
145505
|
getCodeActions(context) {
|
|
145440
|
-
const edits =
|
|
145506
|
+
const edits = doChange23(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
|
|
145441
145507
|
if (edits) {
|
|
145442
145508
|
return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
|
|
145443
145509
|
}
|
|
145444
145510
|
},
|
|
145445
145511
|
fixIds: [fixId36],
|
|
145446
145512
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
|
|
145447
|
-
const edits =
|
|
145513
|
+
const edits = doChange23(diag2.file, diag2.start, diag2.length, diag2.code, context);
|
|
145448
145514
|
if (edits) {
|
|
145449
145515
|
for (const edit of edits) {
|
|
145450
145516
|
changes.pushRaw(context.sourceFile, edit);
|
|
@@ -145452,7 +145518,7 @@ registerCodeFix({
|
|
|
145452
145518
|
}
|
|
145453
145519
|
})
|
|
145454
145520
|
});
|
|
145455
|
-
function
|
|
145521
|
+
function doChange23(file, start2, length2, code, context) {
|
|
145456
145522
|
let startPosition;
|
|
145457
145523
|
let endPosition;
|
|
145458
145524
|
if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
|
|
@@ -145522,7 +145588,7 @@ registerCodeFix({
|
|
|
145522
145588
|
const token = getTokenAtPosition(sourceFile, start2);
|
|
145523
145589
|
let declaration;
|
|
145524
145590
|
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
|
|
145525
|
-
declaration =
|
|
145591
|
+
declaration = doChange24(
|
|
145526
145592
|
changes2,
|
|
145527
145593
|
sourceFile,
|
|
145528
145594
|
token,
|
|
@@ -145543,7 +145609,7 @@ registerCodeFix({
|
|
|
145543
145609
|
const { sourceFile, program, cancellationToken, host, preferences } = context;
|
|
145544
145610
|
const markSeen = nodeSeenTracker();
|
|
145545
145611
|
return codeFixAll(context, errorCodes47, (changes, err) => {
|
|
145546
|
-
|
|
145612
|
+
doChange24(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
|
|
145547
145613
|
});
|
|
145548
145614
|
}
|
|
145549
145615
|
});
|
|
@@ -145582,7 +145648,7 @@ function mapSuggestionDiagnostic(errorCode) {
|
|
|
145582
145648
|
}
|
|
145583
145649
|
return errorCode;
|
|
145584
145650
|
}
|
|
145585
|
-
function
|
|
145651
|
+
function doChange24(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
|
|
145586
145652
|
if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
|
|
145587
145653
|
return void 0;
|
|
145588
145654
|
}
|
|
@@ -146493,7 +146559,7 @@ registerCodeFix({
|
|
|
146493
146559
|
return void 0;
|
|
146494
146560
|
}
|
|
146495
146561
|
const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
|
|
146496
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
146562
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, sourceFile, returnTypeNode, promisedTypeNode));
|
|
146497
146563
|
return [createCodeFixAction(
|
|
146498
146564
|
fixId38,
|
|
146499
146565
|
changes,
|
|
@@ -146509,7 +146575,7 @@ registerCodeFix({
|
|
|
146509
146575
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
|
|
146510
146576
|
const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
|
|
146511
146577
|
if (info) {
|
|
146512
|
-
|
|
146578
|
+
doChange25(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
|
|
146513
146579
|
}
|
|
146514
146580
|
})
|
|
146515
146581
|
});
|
|
@@ -146536,7 +146602,7 @@ function getInfo12(sourceFile, checker, pos) {
|
|
|
146536
146602
|
return { returnTypeNode, returnType, promisedTypeNode, promisedType };
|
|
146537
146603
|
}
|
|
146538
146604
|
}
|
|
146539
|
-
function
|
|
146605
|
+
function doChange25(changes, sourceFile, returnTypeNode, promisedTypeNode) {
|
|
146540
146606
|
changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
|
|
146541
146607
|
}
|
|
146542
146608
|
|
|
@@ -147707,18 +147773,18 @@ registerCodeFix({
|
|
|
147707
147773
|
if (!info) {
|
|
147708
147774
|
return void 0;
|
|
147709
147775
|
}
|
|
147710
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147776
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, context.sourceFile, info));
|
|
147711
147777
|
return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)];
|
|
147712
147778
|
},
|
|
147713
147779
|
fixIds: [fixId40],
|
|
147714
147780
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => {
|
|
147715
147781
|
const info = getInfo14(diag2.file, context.program, diag2.start);
|
|
147716
147782
|
if (info) {
|
|
147717
|
-
|
|
147783
|
+
doChange26(changes, context.sourceFile, info);
|
|
147718
147784
|
}
|
|
147719
147785
|
})
|
|
147720
147786
|
});
|
|
147721
|
-
function
|
|
147787
|
+
function doChange26(changes, sourceFile, info) {
|
|
147722
147788
|
const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
|
|
147723
147789
|
changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
|
|
147724
147790
|
/*modifiers*/
|
|
@@ -147791,14 +147857,14 @@ registerCodeFix({
|
|
|
147791
147857
|
const info = getInfo15(sourceFile, start2);
|
|
147792
147858
|
if (!info)
|
|
147793
147859
|
return void 0;
|
|
147794
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147860
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, info, context.preferences));
|
|
147795
147861
|
return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)];
|
|
147796
147862
|
},
|
|
147797
147863
|
fixIds: [fixId41],
|
|
147798
147864
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
|
|
147799
147865
|
const info = getInfo15(diag2.file, diag2.start);
|
|
147800
147866
|
if (info)
|
|
147801
|
-
|
|
147867
|
+
doChange27(changes, diag2.file, info, context.preferences);
|
|
147802
147868
|
})
|
|
147803
147869
|
});
|
|
147804
147870
|
function getInfo15(sourceFile, pos) {
|
|
@@ -147813,7 +147879,7 @@ function getInfo15(sourceFile, pos) {
|
|
|
147813
147879
|
return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
|
|
147814
147880
|
}
|
|
147815
147881
|
}
|
|
147816
|
-
function
|
|
147882
|
+
function doChange27(changes, sourceFile, info, preferences) {
|
|
147817
147883
|
changes.replaceNode(sourceFile, info.importNode, makeImport(
|
|
147818
147884
|
info.name,
|
|
147819
147885
|
/*namedImports*/
|
|
@@ -147859,11 +147925,11 @@ registerCodeFix({
|
|
|
147859
147925
|
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
147860
147926
|
const { sourceFile, span } = context;
|
|
147861
147927
|
const importType = getImportTypeNode(sourceFile, span.start);
|
|
147862
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147928
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, importType));
|
|
147863
147929
|
return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)];
|
|
147864
147930
|
},
|
|
147865
147931
|
fixIds: [fixId43],
|
|
147866
|
-
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) =>
|
|
147932
|
+
getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange28(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
|
|
147867
147933
|
});
|
|
147868
147934
|
function getImportTypeNode(sourceFile, pos) {
|
|
147869
147935
|
const token = getTokenAtPosition(sourceFile, pos);
|
|
@@ -147871,7 +147937,7 @@ function getImportTypeNode(sourceFile, pos) {
|
|
|
147871
147937
|
Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
|
|
147872
147938
|
return token.parent;
|
|
147873
147939
|
}
|
|
147874
|
-
function
|
|
147940
|
+
function doChange28(changes, sourceFile, importType) {
|
|
147875
147941
|
const newTypeNode = factory.updateImportTypeNode(
|
|
147876
147942
|
importType,
|
|
147877
147943
|
importType.argument,
|
|
@@ -147894,7 +147960,7 @@ registerCodeFix({
|
|
|
147894
147960
|
const node = findNodeToFix(sourceFile, span.start);
|
|
147895
147961
|
if (!node)
|
|
147896
147962
|
return void 0;
|
|
147897
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
147963
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, node));
|
|
147898
147964
|
return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
|
|
147899
147965
|
},
|
|
147900
147966
|
fixIds: [fixID2],
|
|
@@ -147902,7 +147968,7 @@ registerCodeFix({
|
|
|
147902
147968
|
const node = findNodeToFix(context.sourceFile, diag2.start);
|
|
147903
147969
|
if (!node)
|
|
147904
147970
|
return void 0;
|
|
147905
|
-
|
|
147971
|
+
doChange29(changes, context.sourceFile, node);
|
|
147906
147972
|
})
|
|
147907
147973
|
});
|
|
147908
147974
|
function findNodeToFix(sourceFile, pos) {
|
|
@@ -147918,7 +147984,7 @@ function findNodeToFix(sourceFile, pos) {
|
|
|
147918
147984
|
return void 0;
|
|
147919
147985
|
return binaryExpr;
|
|
147920
147986
|
}
|
|
147921
|
-
function
|
|
147987
|
+
function doChange29(changeTracker, sf, node) {
|
|
147922
147988
|
const jsx = flattenInvalidBinaryExpr(node);
|
|
147923
147989
|
if (jsx)
|
|
147924
147990
|
changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
|
|
@@ -147952,7 +148018,7 @@ registerCodeFix({
|
|
|
147952
148018
|
const info = getInfo16(sourceFile, span.start);
|
|
147953
148019
|
if (!info)
|
|
147954
148020
|
return void 0;
|
|
147955
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
148021
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info));
|
|
147956
148022
|
const name = idText(info.container.name);
|
|
147957
148023
|
return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])];
|
|
147958
148024
|
},
|
|
@@ -147960,7 +148026,7 @@ registerCodeFix({
|
|
|
147960
148026
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
|
|
147961
148027
|
const info = getInfo16(diag2.file, diag2.start);
|
|
147962
148028
|
if (info)
|
|
147963
|
-
|
|
148029
|
+
doChange30(changes, diag2.file, info);
|
|
147964
148030
|
})
|
|
147965
148031
|
});
|
|
147966
148032
|
function getInfo16(sourceFile, pos) {
|
|
@@ -147976,7 +148042,7 @@ function getInfo16(sourceFile, pos) {
|
|
|
147976
148042
|
function createTypeAliasFromInterface(declaration, type) {
|
|
147977
148043
|
return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
|
|
147978
148044
|
}
|
|
147979
|
-
function
|
|
148045
|
+
function doChange30(changes, sourceFile, { indexSignature, container }) {
|
|
147980
148046
|
const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
|
|
147981
148047
|
const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
|
|
147982
148048
|
const parameter = first(indexSignature.parameters);
|
|
@@ -148130,7 +148196,7 @@ registerCodeFix({
|
|
|
148130
148196
|
const info = getInfo17(sourceFile, span.start, program);
|
|
148131
148197
|
if (info === void 0)
|
|
148132
148198
|
return;
|
|
148133
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
148199
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info.token));
|
|
148134
148200
|
return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)];
|
|
148135
148201
|
},
|
|
148136
148202
|
getAllCodeActions: (context) => {
|
|
@@ -148141,7 +148207,7 @@ registerCodeFix({
|
|
|
148141
148207
|
const info = getInfo17(diag2.file, diag2.start, program);
|
|
148142
148208
|
if (info) {
|
|
148143
148209
|
if (addToSeen(seen, getSymbolId(info.symbol))) {
|
|
148144
|
-
return
|
|
148210
|
+
return doChange31(changes, diag2.file, info.token);
|
|
148145
148211
|
}
|
|
148146
148212
|
}
|
|
148147
148213
|
return void 0;
|
|
@@ -148164,7 +148230,7 @@ function getInfo17(sourceFile, pos, program) {
|
|
|
148164
148230
|
return;
|
|
148165
148231
|
return { symbol, token: constToken };
|
|
148166
148232
|
}
|
|
148167
|
-
function
|
|
148233
|
+
function doChange31(changes, sourceFile, token) {
|
|
148168
148234
|
changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
|
|
148169
148235
|
}
|
|
148170
148236
|
|
|
@@ -148179,7 +148245,7 @@ registerCodeFix({
|
|
|
148179
148245
|
const info = getInfo18(sourceFile, context.span.start, context.errorCode);
|
|
148180
148246
|
if (!info)
|
|
148181
148247
|
return void 0;
|
|
148182
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
148248
|
+
const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info));
|
|
148183
148249
|
return [createCodeFixAction(
|
|
148184
148250
|
fixId49,
|
|
148185
148251
|
changes,
|
|
@@ -148192,14 +148258,14 @@ registerCodeFix({
|
|
|
148192
148258
|
getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => {
|
|
148193
148259
|
const info = getInfo18(diag2.file, diag2.start, diag2.code);
|
|
148194
148260
|
if (info)
|
|
148195
|
-
|
|
148261
|
+
doChange32(changes, context.sourceFile, info);
|
|
148196
148262
|
})
|
|
148197
148263
|
});
|
|
148198
148264
|
function getInfo18(sourceFile, pos, _) {
|
|
148199
148265
|
const node = getTokenAtPosition(sourceFile, pos);
|
|
148200
148266
|
return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
|
|
148201
148267
|
}
|
|
148202
|
-
function
|
|
148268
|
+
function doChange32(changes, sourceFile, { node }) {
|
|
148203
148269
|
const newNode = factory.createToken(27 /* CommaToken */);
|
|
148204
148270
|
changes.replaceNode(sourceFile, node, newNode);
|
|
148205
148271
|
}
|
|
@@ -157256,7 +157322,7 @@ registerRefactor(refactorName, {
|
|
|
157256
157322
|
Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
|
|
157257
157323
|
const info = getInfo19(context);
|
|
157258
157324
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
157259
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157325
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, info, t, context.cancellationToken));
|
|
157260
157326
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
157261
157327
|
}
|
|
157262
157328
|
});
|
|
@@ -157309,7 +157375,7 @@ function getInfo19(context, considerPartialSpans = true) {
|
|
|
157309
157375
|
return void 0;
|
|
157310
157376
|
}
|
|
157311
157377
|
}
|
|
157312
|
-
function
|
|
157378
|
+
function doChange33(exportingSourceFile, program, info, changes, cancellationToken) {
|
|
157313
157379
|
changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
|
|
157314
157380
|
changeImports(program, info, changes, cancellationToken);
|
|
157315
157381
|
}
|
|
@@ -157504,7 +157570,7 @@ registerRefactor(refactorName2, {
|
|
|
157504
157570
|
Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
|
|
157505
157571
|
const info = getImportConversionInfo(context);
|
|
157506
157572
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
157507
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
157573
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, t, info));
|
|
157508
157574
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
157509
157575
|
}
|
|
157510
157576
|
});
|
|
@@ -157535,7 +157601,7 @@ function getImportConversionInfo(context, considerPartialSpans = true) {
|
|
|
157535
157601
|
function getShouldUseDefault(program, importClause) {
|
|
157536
157602
|
return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
|
|
157537
157603
|
}
|
|
157538
|
-
function
|
|
157604
|
+
function doChange34(sourceFile, program, changes, info) {
|
|
157539
157605
|
const checker = program.getTypeChecker();
|
|
157540
157606
|
if (info.convertTo === 0 /* Named */) {
|
|
157541
157607
|
doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
|
|
@@ -158008,7 +158074,7 @@ registerRefactor(refactorName4, {
|
|
|
158008
158074
|
getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
|
|
158009
158075
|
Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
|
|
158010
158076
|
const statements = Debug.checkDefined(getStatementsToMove(context));
|
|
158011
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
158077
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, statements, t, context.host, context.preferences));
|
|
158012
158078
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
158013
158079
|
}
|
|
158014
158080
|
});
|
|
@@ -158033,7 +158099,7 @@ function getRangeToMove(context) {
|
|
|
158033
158099
|
afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
|
|
158034
158100
|
};
|
|
158035
158101
|
}
|
|
158036
|
-
function
|
|
158102
|
+
function doChange35(oldFile, program, toMove, changes, host, preferences) {
|
|
158037
158103
|
const checker = program.getTypeChecker();
|
|
158038
158104
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
158039
158105
|
const currentDirectory = getDirectoryPath(oldFile.fileName);
|
|
@@ -159405,12 +159471,12 @@ function getRefactorEditsToConvertParametersToDestructuredObject(context, action
|
|
|
159405
159471
|
return void 0;
|
|
159406
159472
|
const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
|
|
159407
159473
|
if (groupedReferences.valid) {
|
|
159408
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
159474
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(file, program, host, t, functionDeclaration, groupedReferences));
|
|
159409
159475
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
159410
159476
|
}
|
|
159411
159477
|
return { edits: [] };
|
|
159412
159478
|
}
|
|
159413
|
-
function
|
|
159479
|
+
function doChange36(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
|
|
159414
159480
|
const signature = groupedReferences.signature;
|
|
159415
159481
|
const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
|
|
159416
159482
|
if (signature) {
|
|
@@ -160174,7 +160240,7 @@ function getRefactorEditsToConvertToOptionalChain(context, actionName2) {
|
|
|
160174
160240
|
Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
|
|
160175
160241
|
const edits = ts_textChanges_exports.ChangeTracker.with(
|
|
160176
160242
|
context,
|
|
160177
|
-
(t) =>
|
|
160243
|
+
(t) => doChange37(context.file, context.program.getTypeChecker(), t, info, actionName2)
|
|
160178
160244
|
);
|
|
160179
160245
|
return { edits, renameFilename: void 0, renameLocation: void 0 };
|
|
160180
160246
|
}
|
|
@@ -160330,7 +160396,7 @@ function convertOccurrences(checker, toConvert, occurrences) {
|
|
|
160330
160396
|
}
|
|
160331
160397
|
return toConvert;
|
|
160332
160398
|
}
|
|
160333
|
-
function
|
|
160399
|
+
function doChange37(sourceFile, checker, changes, info, _actionName) {
|
|
160334
160400
|
const { finalExpression, occurrences, expression } = info;
|
|
160335
160401
|
const firstOccurrence = occurrences[occurrences.length - 1];
|
|
160336
160402
|
const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
|
|
@@ -162025,7 +162091,7 @@ registerRefactor(refactorName12, {
|
|
|
162025
162091
|
function getRefactorEditsToInferReturnType(context) {
|
|
162026
162092
|
const info = getInfo21(context);
|
|
162027
162093
|
if (info && !isRefactorErrorInfo(info)) {
|
|
162028
|
-
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) =>
|
|
162094
|
+
const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange38(context.file, t, info.declaration, info.returnTypeNode));
|
|
162029
162095
|
return { renameFilename: void 0, renameLocation: void 0, edits };
|
|
162030
162096
|
}
|
|
162031
162097
|
return void 0;
|
|
@@ -162050,7 +162116,7 @@ function getRefactorActionsToInferReturnType(context) {
|
|
|
162050
162116
|
}
|
|
162051
162117
|
return emptyArray;
|
|
162052
162118
|
}
|
|
162053
|
-
function
|
|
162119
|
+
function doChange38(sourceFile, changes, declaration, typeNode) {
|
|
162054
162120
|
const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
|
|
162055
162121
|
const needParens = isArrowFunction(declaration) && closeParen === void 0;
|
|
162056
162122
|
const endNode2 = needParens ? first(declaration.parameters) : closeParen;
|
|
@@ -167693,7 +167759,6 @@ __export(ts_exports3, {
|
|
|
167693
167759
|
ContextFlags: () => ContextFlags,
|
|
167694
167760
|
CoreServicesShimHostAdapter: () => CoreServicesShimHostAdapter,
|
|
167695
167761
|
Debug: () => Debug,
|
|
167696
|
-
DeprecationVersion: () => DeprecationVersion,
|
|
167697
167762
|
DiagnosticCategory: () => DiagnosticCategory,
|
|
167698
167763
|
Diagnostics: () => Diagnostics,
|
|
167699
167764
|
DocumentHighlights: () => DocumentHighlights,
|
|
@@ -168516,7 +168581,6 @@ __export(ts_exports3, {
|
|
|
168516
168581
|
getNodeForGeneratedName: () => getNodeForGeneratedName,
|
|
168517
168582
|
getNodeId: () => getNodeId,
|
|
168518
168583
|
getNodeKind: () => getNodeKind,
|
|
168519
|
-
getNodeMajorVersion: () => getNodeMajorVersion,
|
|
168520
168584
|
getNodeModifiers: () => getNodeModifiers,
|
|
168521
168585
|
getNodeModulePathParts: () => getNodeModulePathParts,
|
|
168522
168586
|
getNonAssignedNameOfDeclaration: () => getNonAssignedNameOfDeclaration,
|
|
@@ -181030,8 +181094,7 @@ function initializeNodeSystem() {
|
|
|
181030
181094
|
}
|
|
181031
181095
|
}
|
|
181032
181096
|
const libDirectory = getDirectoryPath(normalizePath(sys2.getExecutingFilePath()));
|
|
181033
|
-
const
|
|
181034
|
-
const useWatchGuard = process.platform === "win32" && nodeVersion >= 4;
|
|
181097
|
+
const useWatchGuard = process.platform === "win32";
|
|
181035
181098
|
const originalWatchDirectory = sys2.watchDirectory.bind(sys2);
|
|
181036
181099
|
const logger = createLogger();
|
|
181037
181100
|
Debug.loggingHost = {
|
|
@@ -181586,7 +181649,7 @@ function start({ args, logger, cancellationToken, serverMode, unknownServerMode,
|
|
|
181586
181649
|
logger.info(`Starting TS Server`);
|
|
181587
181650
|
logger.info(`Version: ${version}`);
|
|
181588
181651
|
logger.info(`Arguments: ${args.join(" ")}`);
|
|
181589
|
-
logger.info(`Platform: ${platform} NodeVersion: ${
|
|
181652
|
+
logger.info(`Platform: ${platform} NodeVersion: ${process.version} CaseSensitive: ${sys.useCaseSensitiveFileNames}`);
|
|
181590
181653
|
logger.info(`ServerMode: ${serverMode} hasUnknownServerMode: ${unknownServerMode}`);
|
|
181591
181654
|
setStackTraceLimit();
|
|
181592
181655
|
if (Debug.isDebugging) {
|
|
@@ -181643,7 +181706,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
181643
181706
|
ContextFlags,
|
|
181644
181707
|
CoreServicesShimHostAdapter,
|
|
181645
181708
|
Debug,
|
|
181646
|
-
DeprecationVersion,
|
|
181647
181709
|
DiagnosticCategory,
|
|
181648
181710
|
Diagnostics,
|
|
181649
181711
|
DocumentHighlights,
|
|
@@ -182466,7 +182528,6 @@ start(initializeNodeSystem(), require("os").platform());
|
|
|
182466
182528
|
getNodeForGeneratedName,
|
|
182467
182529
|
getNodeId,
|
|
182468
182530
|
getNodeKind,
|
|
182469
|
-
getNodeMajorVersion,
|
|
182470
182531
|
getNodeModifiers,
|
|
182471
182532
|
getNodeModulePathParts,
|
|
182472
182533
|
getNonAssignedNameOfDeclaration,
|