typescript 5.1.0-dev.20230227 → 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/tsserver.js CHANGED
@@ -472,7 +472,6 @@ __export(server_exports, {
472
472
  createTypeChecker: () => createTypeChecker,
473
473
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
474
474
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
475
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
476
475
  createUnparsedSourceFile: () => createUnparsedSourceFile,
477
476
  createWatchCompilerHost: () => createWatchCompilerHost2,
478
477
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -1883,7 +1882,6 @@ __export(server_exports, {
1883
1882
  nodeToDisplayParts: () => nodeToDisplayParts,
1884
1883
  noop: () => noop,
1885
1884
  noopFileWatcher: () => noopFileWatcher,
1886
- noopPush: () => noopPush,
1887
1885
  normalizePath: () => normalizePath,
1888
1886
  normalizeSlashes: () => normalizeSlashes,
1889
1887
  not: () => not,
@@ -2288,7 +2286,7 @@ module.exports = __toCommonJS(server_exports);
2288
2286
 
2289
2287
  // src/compiler/corePublic.ts
2290
2288
  var versionMajorMinor = "5.1";
2291
- var version = `${versionMajorMinor}.0-dev.20230227`;
2289
+ var version = `${versionMajorMinor}.0-dev.20230302`;
2292
2290
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2293
2291
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2294
2292
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -3271,9 +3269,6 @@ function multiMapRemove(key, value) {
3271
3269
  }
3272
3270
  }
3273
3271
  }
3274
- function createUnderscoreEscapedMultiMap() {
3275
- return createMultiMap();
3276
- }
3277
3272
  function createQueue(items) {
3278
3273
  const elements = (items == null ? void 0 : items.slice()) || [];
3279
3274
  let headIndex = 0;
@@ -3446,10 +3441,6 @@ function cast(value, test) {
3446
3441
  }
3447
3442
  function noop(_) {
3448
3443
  }
3449
- var noopPush = {
3450
- push: noop,
3451
- length: 0
3452
- };
3453
3444
  function returnFalse() {
3454
3445
  return false;
3455
3446
  }
@@ -10639,6 +10630,7 @@ var Diagnostics = {
10639
10630
  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."),
10640
10631
  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."),
10641
10632
  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."),
10633
+ 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."),
10642
10634
  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."),
10643
10635
  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}'."),
10644
10636
  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."),
@@ -11034,6 +11026,8 @@ var Diagnostics = {
11034
11026
  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."),
11035
11027
  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."),
11036
11028
  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."),
11029
+ 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."),
11030
+ 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."),
11037
11031
  Add_missing_super_call: diag(90001, 3 /* Message */, "Add_missing_super_call_90001", "Add missing 'super()' call"),
11038
11032
  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"),
11039
11033
  Change_extends_to_implements: diag(90003, 3 /* Message */, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'"),
@@ -11248,6 +11242,8 @@ var Diagnostics = {
11248
11242
  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}'"),
11249
11243
  Use_0: diag(95174, 3 /* Message */, "Use_0_95174", "Use `{0}`."),
11250
11244
  Use_Number_isNaN_in_all_conditions: diag(95175, 3 /* Message */, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."),
11245
+ Convert_typedef_to_TypeScript_type: diag(95176, 3 /* Message */, "Convert_typedef_to_TypeScript_type_95176", "Convert typedef to TypeScript type."),
11246
+ Convert_all_typedef_to_TypeScript_types: diag(95177, 3 /* Message */, "Convert_all_typedef_to_TypeScript_types_95177", "Convert all typedef to TypeScript types."),
11251
11247
  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."),
11252
11248
  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'."),
11253
11249
  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?"),
@@ -40956,20 +40952,14 @@ function getEffectiveTypeRoots(options, host) {
40956
40952
  currentDirectory = host.getCurrentDirectory();
40957
40953
  }
40958
40954
  if (currentDirectory !== void 0) {
40959
- return getDefaultTypeRoots(currentDirectory, host);
40955
+ return getDefaultTypeRoots(currentDirectory);
40960
40956
  }
40961
40957
  }
40962
- function getDefaultTypeRoots(currentDirectory, host) {
40963
- if (!host.directoryExists) {
40964
- return [combinePaths(currentDirectory, nodeModulesAtTypes)];
40965
- }
40958
+ function getDefaultTypeRoots(currentDirectory) {
40966
40959
  let typeRoots;
40967
40960
  forEachAncestorDirectory(normalizePath(currentDirectory), (directory) => {
40968
40961
  const atTypes = combinePaths(directory, nodeModulesAtTypes);
40969
- if (host.directoryExists(atTypes)) {
40970
- (typeRoots || (typeRoots = [])).push(atTypes);
40971
- }
40972
- return void 0;
40962
+ (typeRoots != null ? typeRoots : typeRoots = []).push(atTypes);
40973
40963
  });
40974
40964
  return typeRoots;
40975
40965
  }
@@ -41106,10 +41096,22 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
41106
41096
  }
41107
41097
  return firstDefined(typeRoots, (typeRoot) => {
41108
41098
  const candidate = combinePaths(typeRoot, typeReferenceDirectiveName);
41109
- const candidateDirectory = getDirectoryPath(candidate);
41110
- const directoryExists = directoryProbablyExists(candidateDirectory, host);
41099
+ const directoryExists = directoryProbablyExists(typeRoot, host);
41111
41100
  if (!directoryExists && traceEnabled) {
41112
- trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory);
41101
+ trace(host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
41102
+ }
41103
+ if (options.typeRoots) {
41104
+ const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, moduleResolutionState);
41105
+ if (resolvedFromFile) {
41106
+ const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
41107
+ const packageInfo = packageDirectory ? getPackageJsonInfo(
41108
+ packageDirectory,
41109
+ /*onlyRecordFailures*/
41110
+ false,
41111
+ moduleResolutionState
41112
+ ) : void 0;
41113
+ return resolvedTypeScriptOnly(withPackageId(packageInfo, resolvedFromFile));
41114
+ }
41113
41115
  }
41114
41116
  return resolvedTypeScriptOnly(
41115
41117
  loadNodeModuleFromDirectory(
@@ -41129,33 +41131,37 @@ function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFil
41129
41131
  function secondaryLookup() {
41130
41132
  const initialLocationForSecondaryLookup = containingFile && getDirectoryPath(containingFile);
41131
41133
  if (initialLocationForSecondaryLookup !== void 0) {
41132
- if (traceEnabled) {
41133
- trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
41134
- }
41135
41134
  let result2;
41136
- if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
41137
- const searchResult = loadModuleFromNearestNodeModulesDirectory(
41138
- 4 /* Declaration */,
41139
- typeReferenceDirectiveName,
41140
- initialLocationForSecondaryLookup,
41141
- moduleResolutionState,
41142
- /*cache*/
41143
- void 0,
41144
- /*redirectedReference*/
41145
- void 0
41146
- );
41147
- result2 = searchResult && searchResult.value;
41148
- } else {
41149
- const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
41150
- result2 = nodeLoadModuleByRelativeName(
41151
- 4 /* Declaration */,
41152
- candidate,
41153
- /*onlyRecordFailures*/
41154
- false,
41155
- moduleResolutionState,
41156
- /*considerPackageJson*/
41157
- true
41158
- );
41135
+ if (!options.typeRoots || !endsWith(containingFile, inferredTypesContainingFile)) {
41136
+ if (traceEnabled) {
41137
+ trace(host, Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup);
41138
+ }
41139
+ if (!isExternalModuleNameRelative(typeReferenceDirectiveName)) {
41140
+ const searchResult = loadModuleFromNearestNodeModulesDirectory(
41141
+ 4 /* Declaration */,
41142
+ typeReferenceDirectiveName,
41143
+ initialLocationForSecondaryLookup,
41144
+ moduleResolutionState,
41145
+ /*cache*/
41146
+ void 0,
41147
+ /*redirectedReference*/
41148
+ void 0
41149
+ );
41150
+ result2 = searchResult && searchResult.value;
41151
+ } else {
41152
+ const { path: candidate } = normalizePathForCJSResolution(initialLocationForSecondaryLookup, typeReferenceDirectiveName);
41153
+ result2 = nodeLoadModuleByRelativeName(
41154
+ 4 /* Declaration */,
41155
+ candidate,
41156
+ /*onlyRecordFailures*/
41157
+ false,
41158
+ moduleResolutionState,
41159
+ /*considerPackageJson*/
41160
+ true
41161
+ );
41162
+ }
41163
+ } else if (traceEnabled) {
41164
+ trace(host, Diagnostics.Resolving_type_reference_directive_for_program_that_specifies_custom_typeRoots_skipping_lookup_in_node_modules_folder);
41159
41165
  }
41160
41166
  return resolvedTypeScriptOnly(result2);
41161
41167
  } else {
@@ -41987,6 +41993,9 @@ function nodeModuleNameResolverWorker(features, moduleName, containingDirectory,
41987
41993
  }
41988
41994
  resolved2 = loadModuleFromNearestNodeModulesDirectory(extensions2, moduleName, containingDirectory, state2, cache, redirectedReference);
41989
41995
  }
41996
+ if (extensions2 & 4 /* Declaration */) {
41997
+ resolved2 != null ? resolved2 : resolved2 = resolveFromTypeRoot(moduleName, state2);
41998
+ }
41990
41999
  return resolved2 && { value: resolved2.value && { resolved: resolved2.value, isExternalLibraryImport: true } };
41991
42000
  } else {
41992
42001
  const { path: candidate, parts } = normalizePathForCJSResolution(containingDirectory, moduleName);
@@ -42167,6 +42176,7 @@ function tryFile(fileName, onlyRecordFailures, state) {
42167
42176
  return forEach(state.compilerOptions.moduleSuffixes, (suffix) => tryFileLookup(fileNameNoExtension + suffix + ext, onlyRecordFailures, state));
42168
42177
  }
42169
42178
  function tryFileLookup(fileName, onlyRecordFailures, state) {
42179
+ var _a2;
42170
42180
  if (!onlyRecordFailures) {
42171
42181
  if (state.host.fileExists(fileName)) {
42172
42182
  if (state.traceEnabled) {
@@ -42179,7 +42189,7 @@ function tryFileLookup(fileName, onlyRecordFailures, state) {
42179
42189
  }
42180
42190
  }
42181
42191
  }
42182
- state.failedLookupLocations.push(fileName);
42192
+ (_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(fileName);
42183
42193
  return void 0;
42184
42194
  }
42185
42195
  function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson = true) {
@@ -42294,8 +42304,8 @@ function getTemporaryModuleResolutionState(packageJsonInfoCache, host, options)
42294
42304
  host,
42295
42305
  compilerOptions: options,
42296
42306
  traceEnabled: isTraceEnabled(options, host),
42297
- failedLookupLocations: noopPush,
42298
- affectingLocations: noopPush,
42307
+ failedLookupLocations: void 0,
42308
+ affectingLocations: void 0,
42299
42309
  packageJsonInfoCache,
42300
42310
  features: 0 /* None */,
42301
42311
  conditions: emptyArray,
@@ -42329,24 +42339,24 @@ function getVersionPathsOfPackageJsonInfo(packageJsonInfo, state) {
42329
42339
  return packageJsonInfo.contents.versionPaths || void 0;
42330
42340
  }
42331
42341
  function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
42332
- var _a2, _b, _c;
42342
+ var _a2, _b, _c, _d, _e, _f, _g, _h;
42333
42343
  const { host, traceEnabled } = state;
42334
42344
  const packageJsonPath = combinePaths(packageDirectory, "package.json");
42335
42345
  if (onlyRecordFailures) {
42336
- state.failedLookupLocations.push(packageJsonPath);
42346
+ (_a2 = state.failedLookupLocations) == null ? void 0 : _a2.push(packageJsonPath);
42337
42347
  return void 0;
42338
42348
  }
42339
- const existing = (_a2 = state.packageJsonInfoCache) == null ? void 0 : _a2.getPackageJsonInfo(packageJsonPath);
42349
+ const existing = (_b = state.packageJsonInfoCache) == null ? void 0 : _b.getPackageJsonInfo(packageJsonPath);
42340
42350
  if (existing !== void 0) {
42341
42351
  if (typeof existing !== "boolean") {
42342
42352
  if (traceEnabled)
42343
42353
  trace(host, Diagnostics.File_0_exists_according_to_earlier_cached_lookups, packageJsonPath);
42344
- state.affectingLocations.push(packageJsonPath);
42354
+ (_c = state.affectingLocations) == null ? void 0 : _c.push(packageJsonPath);
42345
42355
  return existing.packageDirectory === packageDirectory ? existing : { packageDirectory, contents: existing.contents };
42346
42356
  } else {
42347
42357
  if (existing && traceEnabled)
42348
42358
  trace(host, Diagnostics.File_0_does_not_exist_according_to_earlier_cached_lookups, packageJsonPath);
42349
- state.failedLookupLocations.push(packageJsonPath);
42359
+ (_d = state.failedLookupLocations) == null ? void 0 : _d.push(packageJsonPath);
42350
42360
  return void 0;
42351
42361
  }
42352
42362
  }
@@ -42357,15 +42367,15 @@ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
42357
42367
  trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
42358
42368
  }
42359
42369
  const result = { packageDirectory, contents: { packageJsonContent, versionPaths: void 0, resolvedEntrypoints: void 0 } };
42360
- (_b = state.packageJsonInfoCache) == null ? void 0 : _b.setPackageJsonInfo(packageJsonPath, result);
42361
- state.affectingLocations.push(packageJsonPath);
42370
+ (_e = state.packageJsonInfoCache) == null ? void 0 : _e.setPackageJsonInfo(packageJsonPath, result);
42371
+ (_f = state.affectingLocations) == null ? void 0 : _f.push(packageJsonPath);
42362
42372
  return result;
42363
42373
  } else {
42364
42374
  if (directoryExists && traceEnabled) {
42365
42375
  trace(host, Diagnostics.File_0_does_not_exist, packageJsonPath);
42366
42376
  }
42367
- (_c = state.packageJsonInfoCache) == null ? void 0 : _c.setPackageJsonInfo(packageJsonPath, directoryExists);
42368
- state.failedLookupLocations.push(packageJsonPath);
42377
+ (_g = state.packageJsonInfoCache) == null ? void 0 : _g.setPackageJsonInfo(packageJsonPath, directoryExists);
42378
+ (_h = state.failedLookupLocations) == null ? void 0 : _h.push(packageJsonPath);
42369
42379
  }
42370
42380
  }
42371
42381
  function loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, jsonContent, versionPaths) {
@@ -43186,11 +43196,13 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
43186
43196
  state
43187
43197
  ));
43188
43198
  });
43189
- if (resolved2) {
43199
+ if (resolved2)
43190
43200
  return resolved2;
43191
- }
43192
43201
  if (extensions & (1 /* TypeScript */ | 4 /* Declaration */)) {
43193
- return loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
43202
+ let resolved3 = loadModuleFromNearestNodeModulesDirectoryTypesScope(moduleName, containingDirectory, state);
43203
+ if (extensions & 4 /* Declaration */)
43204
+ resolved3 != null ? resolved3 : resolved3 = resolveFromTypeRoot(moduleName, state);
43205
+ return resolved3;
43194
43206
  }
43195
43207
  } else {
43196
43208
  const candidate = normalizePath(combinePaths(containingDirectory, moduleName));
@@ -43204,6 +43216,31 @@ function classicNameResolver(moduleName, containingFile, compilerOptions, host,
43204
43216
  }
43205
43217
  }
43206
43218
  }
43219
+ function resolveFromTypeRoot(moduleName, state) {
43220
+ if (!state.compilerOptions.typeRoots)
43221
+ return;
43222
+ for (const typeRoot of state.compilerOptions.typeRoots) {
43223
+ const candidate = combinePaths(typeRoot, moduleName);
43224
+ const directoryExists = directoryProbablyExists(typeRoot, state.host);
43225
+ if (!directoryExists && state.traceEnabled) {
43226
+ trace(state.host, Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, typeRoot);
43227
+ }
43228
+ const resolvedFromFile = loadModuleFromFile(4 /* Declaration */, candidate, !directoryExists, state);
43229
+ if (resolvedFromFile) {
43230
+ const packageDirectory = parseNodeModuleFromPath(resolvedFromFile.path);
43231
+ const packageInfo = packageDirectory ? getPackageJsonInfo(
43232
+ packageDirectory,
43233
+ /*onlyRecordFailures*/
43234
+ false,
43235
+ state
43236
+ ) : void 0;
43237
+ return toSearchResult(withPackageId(packageInfo, resolvedFromFile));
43238
+ }
43239
+ const resolved = loadNodeModuleFromDirectory(4 /* Declaration */, candidate, !directoryExists, state);
43240
+ if (resolved)
43241
+ return toSearchResult(resolved);
43242
+ }
43243
+ }
43207
43244
  function shouldAllowImportingTsExtension(compilerOptions, fromFileName) {
43208
43245
  return !!compilerOptions.allowImportingTsExtensions || fromFileName && isDeclarationFileName(fromFileName);
43209
43246
  }
@@ -52401,7 +52438,7 @@ function createTypeChecker(host) {
52401
52438
  }
52402
52439
  }
52403
52440
  const mayHaveNameCollisions = !(context.flags & 64 /* UseFullyQualifiedType */);
52404
- const seenNames = mayHaveNameCollisions ? createUnderscoreEscapedMultiMap() : void 0;
52441
+ const seenNames = mayHaveNameCollisions ? createMultiMap() : void 0;
52405
52442
  const result = [];
52406
52443
  let i = 0;
52407
52444
  for (const type of types) {
@@ -56202,7 +56239,11 @@ function createTypeChecker(host) {
56202
56239
  const baseTypeVariable = getBaseTypeVariableOfClass(symbol);
56203
56240
  return baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type;
56204
56241
  } else {
56205
- return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(type) : type;
56242
+ return strictNullChecks && symbol.flags & 16777216 /* Optional */ ? getOptionalType(
56243
+ type,
56244
+ /*isProperty*/
56245
+ true
56246
+ ) : type;
56206
56247
  }
56207
56248
  }
56208
56249
  function getTypeOfEnumMember(symbol) {
@@ -64682,7 +64723,7 @@ function createTypeChecker(host) {
64682
64723
  0 /* None */
64683
64724
  );
64684
64725
  }
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 */))) {
64726
+ } 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
64727
  result2 &= propertiesRelatedTo(
64687
64728
  source2,
64688
64729
  target2,
@@ -64903,6 +64944,7 @@ function createTypeChecker(host) {
64903
64944
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
64904
64945
  if (sourceFlags & 8388608 /* IndexedAccess */) {
64905
64946
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
64947
+ instantiateType(source2.objectType, reportUnreliableMapper);
64906
64948
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
64907
64949
  }
64908
64950
  if (result2) {
@@ -68048,7 +68090,7 @@ function createTypeChecker(host) {
68048
68090
  );
68049
68091
  }
68050
68092
  function isInAmbientOrTypeNode(node) {
68051
- return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeLiteralNode(n)));
68093
+ return !!(node.flags & 16777216 /* Ambient */ || findAncestor(node, (n) => isInterfaceDeclaration(n) || isTypeAliasDeclaration(n) || isTypeLiteralNode(n)));
68052
68094
  }
68053
68095
  function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
68054
68096
  switch (node.kind) {
@@ -71196,6 +71238,16 @@ function createTypeChecker(host) {
71196
71238
  const symbol = getSymbolOfDeclaration(element);
71197
71239
  return getTypeOfPropertyOfContextualType(type, symbol.escapedName, getSymbolLinks(symbol).nameType);
71198
71240
  }
71241
+ if (hasDynamicName(element)) {
71242
+ const name = getNameOfDeclaration(element);
71243
+ if (name && isComputedPropertyName(name)) {
71244
+ const exprType = checkExpression(name.expression);
71245
+ const propType = isTypeUsableAsPropertyName(exprType) && getTypeOfPropertyOfContextualType(type, getPropertyNameFromType(exprType));
71246
+ if (propType) {
71247
+ return propType;
71248
+ }
71249
+ }
71250
+ }
71199
71251
  if (element.name) {
71200
71252
  const nameType = getLiteralTypeFromPropertyName(element.name);
71201
71253
  return mapType(
@@ -75969,7 +76021,7 @@ function createTypeChecker(host) {
75969
76021
  }
75970
76022
  function getNonArrayRestType(signature) {
75971
76023
  const restType = getEffectiveRestType(signature);
75972
- return restType && !isArrayType(restType) && !isTypeAny(restType) && (getReducedType(restType).flags & 131072 /* Never */) === 0 ? restType : void 0;
76024
+ return restType && !isArrayType(restType) && !isTypeAny(restType) ? restType : void 0;
75973
76025
  }
75974
76026
  function getTypeOfFirstParameterOfSignature(signature) {
75975
76027
  return getTypeOfFirstParameterOfSignatureWithFallback(signature, neverType);
@@ -80783,6 +80835,9 @@ function createTypeChecker(host) {
80783
80835
  return;
80784
80836
  }
80785
80837
  if (isBindingPattern(node.name)) {
80838
+ if (isInAmbientOrTypeNode(node)) {
80839
+ return;
80840
+ }
80786
80841
  const needCheckInitializer = hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* ForInStatement */;
80787
80842
  const needCheckWidenedType = !some(node.name.elements, not(isOmittedExpression));
80788
80843
  if (needCheckInitializer || needCheckWidenedType) {
@@ -90052,6 +90107,7 @@ function createDefaultValueCheck(flattenContext, value, defaultValue, location)
90052
90107
  );
90053
90108
  }
90054
90109
  function createDestructuringPropertyAccess(flattenContext, value, propertyName) {
90110
+ const { factory: factory2 } = flattenContext.context;
90055
90111
  if (isComputedPropertyName(propertyName)) {
90056
90112
  const argumentExpression = ensureIdentifier(
90057
90113
  flattenContext,
@@ -90063,7 +90119,7 @@ function createDestructuringPropertyAccess(flattenContext, value, propertyName)
90063
90119
  );
90064
90120
  return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
90065
90121
  } else if (isStringOrNumericLiteralLike(propertyName)) {
90066
- const argumentExpression = factory.cloneNode(propertyName);
90122
+ const argumentExpression = factory2.cloneNode(propertyName);
90067
90123
  return flattenContext.context.factory.createElementAccessExpression(value, argumentExpression);
90068
90124
  } else {
90069
90125
  const name = flattenContext.context.factory.createIdentifier(idText(propertyName));
@@ -90138,28 +90194,29 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
90138
90194
  if (level === 0 /* LiftRestriction */ && !hasInvalidEscape(template)) {
90139
90195
  return visitEachChild(node, visitor, context);
90140
90196
  }
90197
+ const { factory: factory2 } = context;
90141
90198
  if (isNoSubstitutionTemplateLiteral(template)) {
90142
- cookedStrings.push(createTemplateCooked(template));
90143
- rawStrings.push(getRawLiteral(template, currentSourceFile));
90199
+ cookedStrings.push(createTemplateCooked(factory2, template));
90200
+ rawStrings.push(getRawLiteral(factory2, template, currentSourceFile));
90144
90201
  } else {
90145
- cookedStrings.push(createTemplateCooked(template.head));
90146
- rawStrings.push(getRawLiteral(template.head, currentSourceFile));
90202
+ cookedStrings.push(createTemplateCooked(factory2, template.head));
90203
+ rawStrings.push(getRawLiteral(factory2, template.head, currentSourceFile));
90147
90204
  for (const templateSpan of template.templateSpans) {
90148
- cookedStrings.push(createTemplateCooked(templateSpan.literal));
90149
- rawStrings.push(getRawLiteral(templateSpan.literal, currentSourceFile));
90205
+ cookedStrings.push(createTemplateCooked(factory2, templateSpan.literal));
90206
+ rawStrings.push(getRawLiteral(factory2, templateSpan.literal, currentSourceFile));
90150
90207
  templateArguments.push(Debug.checkDefined(visitNode(templateSpan.expression, visitor, isExpression)));
90151
90208
  }
90152
90209
  }
90153
90210
  const helperCall = context.getEmitHelperFactory().createTemplateObjectHelper(
90154
- factory.createArrayLiteralExpression(cookedStrings),
90155
- factory.createArrayLiteralExpression(rawStrings)
90211
+ factory2.createArrayLiteralExpression(cookedStrings),
90212
+ factory2.createArrayLiteralExpression(rawStrings)
90156
90213
  );
90157
90214
  if (isExternalModule(currentSourceFile)) {
90158
- const tempVar = factory.createUniqueName("templateObject");
90215
+ const tempVar = factory2.createUniqueName("templateObject");
90159
90216
  recordTaggedTemplateString(tempVar);
90160
- templateArguments[0] = factory.createLogicalOr(
90217
+ templateArguments[0] = factory2.createLogicalOr(
90161
90218
  tempVar,
90162
- factory.createAssignment(
90219
+ factory2.createAssignment(
90163
90220
  tempVar,
90164
90221
  helperCall
90165
90222
  )
@@ -90167,17 +90224,17 @@ function processTaggedTemplateExpression(context, node, visitor, currentSourceFi
90167
90224
  } else {
90168
90225
  templateArguments[0] = helperCall;
90169
90226
  }
90170
- return factory.createCallExpression(
90227
+ return factory2.createCallExpression(
90171
90228
  tag,
90172
90229
  /*typeArguments*/
90173
90230
  void 0,
90174
90231
  templateArguments
90175
90232
  );
90176
90233
  }
90177
- function createTemplateCooked(template) {
90178
- return template.templateFlags ? factory.createVoidZero() : factory.createStringLiteral(template.text);
90234
+ function createTemplateCooked(factory2, template) {
90235
+ return template.templateFlags ? factory2.createVoidZero() : factory2.createStringLiteral(template.text);
90179
90236
  }
90180
- function getRawLiteral(node, currentSourceFile) {
90237
+ function getRawLiteral(factory2, node, currentSourceFile) {
90181
90238
  let text = node.rawText;
90182
90239
  if (text === void 0) {
90183
90240
  Debug.assertIsDefined(
@@ -90189,7 +90246,7 @@ function getRawLiteral(node, currentSourceFile) {
90189
90246
  text = text.substring(1, text.length - (isLast ? 1 : 2));
90190
90247
  }
90191
90248
  text = text.replace(/\r\n?/g, "\n");
90192
- return setTextRange(factory.createStringLiteral(text), node);
90249
+ return setTextRange(factory2.createStringLiteral(text), node);
90193
90250
  }
90194
90251
 
90195
90252
  // src/compiler/transformers/ts.ts
@@ -93645,12 +93702,14 @@ function transformClassFields(context) {
93645
93702
  if (privateIdentifierInfo.kind === "f" /* Field */) {
93646
93703
  if (!privateIdentifierInfo.isStatic) {
93647
93704
  return createPrivateInstanceFieldInitializer(
93705
+ factory2,
93648
93706
  receiver,
93649
93707
  visitNode(property.initializer, initializerVisitor, isExpression),
93650
93708
  privateIdentifierInfo.brandCheckIdentifier
93651
93709
  );
93652
93710
  } else {
93653
93711
  return createPrivateStaticFieldInitializer(
93712
+ factory2,
93654
93713
  privateIdentifierInfo.variableName,
93655
93714
  visitNode(property.initializer, initializerVisitor, isExpression)
93656
93715
  );
@@ -93732,7 +93791,7 @@ function transformClassFields(context) {
93732
93791
  Debug.assert(weakSetName, "weakSetName should be set in private identifier environment");
93733
93792
  statements.push(
93734
93793
  factory2.createExpressionStatement(
93735
- createPrivateInstanceMethodInitializer(receiver, weakSetName)
93794
+ createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName)
93736
93795
  )
93737
93796
  );
93738
93797
  }
@@ -94185,25 +94244,25 @@ function transformClassFields(context) {
94185
94244
  return void 0;
94186
94245
  }
94187
94246
  }
94188
- function createPrivateStaticFieldInitializer(variableName, initializer) {
94189
- return factory.createAssignment(
94247
+ function createPrivateStaticFieldInitializer(factory2, variableName, initializer) {
94248
+ return factory2.createAssignment(
94190
94249
  variableName,
94191
- factory.createObjectLiteralExpression([
94192
- factory.createPropertyAssignment("value", initializer || factory.createVoidZero())
94250
+ factory2.createObjectLiteralExpression([
94251
+ factory2.createPropertyAssignment("value", initializer || factory2.createVoidZero())
94193
94252
  ])
94194
94253
  );
94195
94254
  }
94196
- function createPrivateInstanceFieldInitializer(receiver, initializer, weakMapName) {
94197
- return factory.createCallExpression(
94198
- factory.createPropertyAccessExpression(weakMapName, "set"),
94255
+ function createPrivateInstanceFieldInitializer(factory2, receiver, initializer, weakMapName) {
94256
+ return factory2.createCallExpression(
94257
+ factory2.createPropertyAccessExpression(weakMapName, "set"),
94199
94258
  /*typeArguments*/
94200
94259
  void 0,
94201
- [receiver, initializer || factory.createVoidZero()]
94260
+ [receiver, initializer || factory2.createVoidZero()]
94202
94261
  );
94203
94262
  }
94204
- function createPrivateInstanceMethodInitializer(receiver, weakSetName) {
94205
- return factory.createCallExpression(
94206
- factory.createPropertyAccessExpression(weakSetName, "add"),
94263
+ function createPrivateInstanceMethodInitializer(factory2, receiver, weakSetName) {
94264
+ return factory2.createCallExpression(
94265
+ factory2.createPropertyAccessExpression(weakSetName, "add"),
94207
94266
  /*typeArguments*/
94208
94267
  void 0,
94209
94268
  [receiver]
@@ -94219,6 +94278,7 @@ function isPrivateIdentifierInExpression(node) {
94219
94278
  // src/compiler/transformers/typeSerializer.ts
94220
94279
  function createRuntimeTypeSerializer(context) {
94221
94280
  const {
94281
+ factory: factory2,
94222
94282
  hoistVariableDeclaration
94223
94283
  } = context;
94224
94284
  const resolver = context.getEmitResolver();
@@ -94258,9 +94318,9 @@ function createRuntimeTypeSerializer(context) {
94258
94318
  case 260 /* ClassDeclaration */:
94259
94319
  case 228 /* ClassExpression */:
94260
94320
  case 171 /* MethodDeclaration */:
94261
- return factory.createIdentifier("Function");
94321
+ return factory2.createIdentifier("Function");
94262
94322
  default:
94263
- return factory.createVoidZero();
94323
+ return factory2.createVoidZero();
94264
94324
  }
94265
94325
  }
94266
94326
  function serializeParameterTypesOfNode(node, container) {
@@ -94281,7 +94341,7 @@ function createRuntimeTypeSerializer(context) {
94281
94341
  }
94282
94342
  }
94283
94343
  }
94284
- return factory.createArrayLiteralExpression(expressions);
94344
+ return factory2.createArrayLiteralExpression(expressions);
94285
94345
  }
94286
94346
  function getParametersOfDecoratedDeclaration(node, container) {
94287
94347
  if (container && node.kind === 174 /* GetAccessor */) {
@@ -94296,39 +94356,39 @@ function createRuntimeTypeSerializer(context) {
94296
94356
  if (isFunctionLike(node) && node.type) {
94297
94357
  return serializeTypeNode(node.type);
94298
94358
  } else if (isAsyncFunction(node)) {
94299
- return factory.createIdentifier("Promise");
94359
+ return factory2.createIdentifier("Promise");
94300
94360
  }
94301
- return factory.createVoidZero();
94361
+ return factory2.createVoidZero();
94302
94362
  }
94303
94363
  function serializeTypeNode(node) {
94304
94364
  if (node === void 0) {
94305
- return factory.createIdentifier("Object");
94365
+ return factory2.createIdentifier("Object");
94306
94366
  }
94307
94367
  node = skipTypeParentheses(node);
94308
94368
  switch (node.kind) {
94309
94369
  case 114 /* VoidKeyword */:
94310
94370
  case 155 /* UndefinedKeyword */:
94311
94371
  case 144 /* NeverKeyword */:
94312
- return factory.createVoidZero();
94372
+ return factory2.createVoidZero();
94313
94373
  case 181 /* FunctionType */:
94314
94374
  case 182 /* ConstructorType */:
94315
- return factory.createIdentifier("Function");
94375
+ return factory2.createIdentifier("Function");
94316
94376
  case 185 /* ArrayType */:
94317
94377
  case 186 /* TupleType */:
94318
- return factory.createIdentifier("Array");
94378
+ return factory2.createIdentifier("Array");
94319
94379
  case 179 /* TypePredicate */:
94320
- return node.assertsModifier ? factory.createVoidZero() : factory.createIdentifier("Boolean");
94380
+ return node.assertsModifier ? factory2.createVoidZero() : factory2.createIdentifier("Boolean");
94321
94381
  case 134 /* BooleanKeyword */:
94322
- return factory.createIdentifier("Boolean");
94382
+ return factory2.createIdentifier("Boolean");
94323
94383
  case 200 /* TemplateLiteralType */:
94324
94384
  case 152 /* StringKeyword */:
94325
- return factory.createIdentifier("String");
94385
+ return factory2.createIdentifier("String");
94326
94386
  case 149 /* ObjectKeyword */:
94327
- return factory.createIdentifier("Object");
94387
+ return factory2.createIdentifier("Object");
94328
94388
  case 198 /* LiteralType */:
94329
94389
  return serializeLiteralOfLiteralTypeNode(node.literal);
94330
94390
  case 148 /* NumberKeyword */:
94331
- return factory.createIdentifier("Number");
94391
+ return factory2.createIdentifier("Number");
94332
94392
  case 160 /* BigIntKeyword */:
94333
94393
  return getGlobalConstructor("BigInt", 7 /* ES2020 */);
94334
94394
  case 153 /* SymbolKeyword */:
@@ -94380,13 +94440,13 @@ function createRuntimeTypeSerializer(context) {
94380
94440
  default:
94381
94441
  return Debug.failBadSyntaxKind(node);
94382
94442
  }
94383
- return factory.createIdentifier("Object");
94443
+ return factory2.createIdentifier("Object");
94384
94444
  }
94385
94445
  function serializeLiteralOfLiteralTypeNode(node) {
94386
94446
  switch (node.kind) {
94387
94447
  case 10 /* StringLiteral */:
94388
94448
  case 14 /* NoSubstitutionTemplateLiteral */:
94389
- return factory.createIdentifier("String");
94449
+ return factory2.createIdentifier("String");
94390
94450
  case 221 /* PrefixUnaryExpression */: {
94391
94451
  const operand = node.operand;
94392
94452
  switch (operand.kind) {
@@ -94398,14 +94458,14 @@ function createRuntimeTypeSerializer(context) {
94398
94458
  }
94399
94459
  }
94400
94460
  case 8 /* NumericLiteral */:
94401
- return factory.createIdentifier("Number");
94461
+ return factory2.createIdentifier("Number");
94402
94462
  case 9 /* BigIntLiteral */:
94403
94463
  return getGlobalConstructor("BigInt", 7 /* ES2020 */);
94404
94464
  case 110 /* TrueKeyword */:
94405
94465
  case 95 /* FalseKeyword */:
94406
- return factory.createIdentifier("Boolean");
94466
+ return factory2.createIdentifier("Boolean");
94407
94467
  case 104 /* NullKeyword */:
94408
- return factory.createVoidZero();
94468
+ return factory2.createVoidZero();
94409
94469
  default:
94410
94470
  return Debug.failBadSyntaxKind(node);
94411
94471
  }
@@ -94416,16 +94476,16 @@ function createRuntimeTypeSerializer(context) {
94416
94476
  typeNode = skipTypeParentheses(typeNode);
94417
94477
  if (typeNode.kind === 144 /* NeverKeyword */) {
94418
94478
  if (isIntersection)
94419
- return factory.createVoidZero();
94479
+ return factory2.createVoidZero();
94420
94480
  continue;
94421
94481
  }
94422
94482
  if (typeNode.kind === 157 /* UnknownKeyword */) {
94423
94483
  if (!isIntersection)
94424
- return factory.createIdentifier("Object");
94484
+ return factory2.createIdentifier("Object");
94425
94485
  continue;
94426
94486
  }
94427
94487
  if (typeNode.kind === 131 /* AnyKeyword */) {
94428
- return factory.createIdentifier("Object");
94488
+ return factory2.createIdentifier("Object");
94429
94489
  }
94430
94490
  if (!strictNullChecks && (isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* NullKeyword */ || typeNode.kind === 155 /* UndefinedKeyword */)) {
94431
94491
  continue;
@@ -94436,13 +94496,13 @@ function createRuntimeTypeSerializer(context) {
94436
94496
  }
94437
94497
  if (serializedType) {
94438
94498
  if (!equateSerializedTypeNodes(serializedType, serializedConstituent)) {
94439
- return factory.createIdentifier("Object");
94499
+ return factory2.createIdentifier("Object");
94440
94500
  }
94441
94501
  } else {
94442
94502
  serializedType = serializedConstituent;
94443
94503
  }
94444
94504
  }
94445
- return serializedType != null ? serializedType : factory.createVoidZero();
94505
+ return serializedType != null ? serializedType : factory2.createVoidZero();
94446
94506
  }
94447
94507
  function equateSerializedTypeNodes(left, right) {
94448
94508
  return (
@@ -94476,48 +94536,48 @@ function createRuntimeTypeSerializer(context) {
94476
94536
  switch (kind) {
94477
94537
  case 0 /* Unknown */:
94478
94538
  if (findAncestor(node, (n) => n.parent && isConditionalTypeNode(n.parent) && (n.parent.trueType === n || n.parent.falseType === n))) {
94479
- return factory.createIdentifier("Object");
94539
+ return factory2.createIdentifier("Object");
94480
94540
  }
94481
94541
  const serialized = serializeEntityNameAsExpressionFallback(node.typeName);
94482
- const temp = factory.createTempVariable(hoistVariableDeclaration);
94483
- return factory.createConditionalExpression(
94484
- factory.createTypeCheck(factory.createAssignment(temp, serialized), "function"),
94542
+ const temp = factory2.createTempVariable(hoistVariableDeclaration);
94543
+ return factory2.createConditionalExpression(
94544
+ factory2.createTypeCheck(factory2.createAssignment(temp, serialized), "function"),
94485
94545
  /*questionToken*/
94486
94546
  void 0,
94487
94547
  temp,
94488
94548
  /*colonToken*/
94489
94549
  void 0,
94490
- factory.createIdentifier("Object")
94550
+ factory2.createIdentifier("Object")
94491
94551
  );
94492
94552
  case 1 /* TypeWithConstructSignatureAndValue */:
94493
94553
  return serializeEntityNameAsExpression(node.typeName);
94494
94554
  case 2 /* VoidNullableOrNeverType */:
94495
- return factory.createVoidZero();
94555
+ return factory2.createVoidZero();
94496
94556
  case 4 /* BigIntLikeType */:
94497
94557
  return getGlobalConstructor("BigInt", 7 /* ES2020 */);
94498
94558
  case 6 /* BooleanType */:
94499
- return factory.createIdentifier("Boolean");
94559
+ return factory2.createIdentifier("Boolean");
94500
94560
  case 3 /* NumberLikeType */:
94501
- return factory.createIdentifier("Number");
94561
+ return factory2.createIdentifier("Number");
94502
94562
  case 5 /* StringLikeType */:
94503
- return factory.createIdentifier("String");
94563
+ return factory2.createIdentifier("String");
94504
94564
  case 7 /* ArrayLikeType */:
94505
- return factory.createIdentifier("Array");
94565
+ return factory2.createIdentifier("Array");
94506
94566
  case 8 /* ESSymbolType */:
94507
94567
  return getGlobalConstructor("Symbol", 2 /* ES2015 */);
94508
94568
  case 10 /* TypeWithCallSignature */:
94509
- return factory.createIdentifier("Function");
94569
+ return factory2.createIdentifier("Function");
94510
94570
  case 9 /* Promise */:
94511
- return factory.createIdentifier("Promise");
94571
+ return factory2.createIdentifier("Promise");
94512
94572
  case 11 /* ObjectType */:
94513
- return factory.createIdentifier("Object");
94573
+ return factory2.createIdentifier("Object");
94514
94574
  default:
94515
94575
  return Debug.assertNever(kind);
94516
94576
  }
94517
94577
  }
94518
94578
  function createCheckedValue(left, right) {
94519
- return factory.createLogicalAnd(
94520
- factory.createStrictInequality(factory.createTypeOfExpression(left), factory.createStringLiteral("undefined")),
94579
+ return factory2.createLogicalAnd(
94580
+ factory2.createStrictInequality(factory2.createTypeOfExpression(left), factory2.createStringLiteral("undefined")),
94521
94581
  right
94522
94582
  );
94523
94583
  }
@@ -94530,13 +94590,13 @@ function createRuntimeTypeSerializer(context) {
94530
94590
  return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
94531
94591
  }
94532
94592
  const left = serializeEntityNameAsExpressionFallback(node.left);
94533
- const temp = factory.createTempVariable(hoistVariableDeclaration);
94534
- return factory.createLogicalAnd(
94535
- factory.createLogicalAnd(
94593
+ const temp = factory2.createTempVariable(hoistVariableDeclaration);
94594
+ return factory2.createLogicalAnd(
94595
+ factory2.createLogicalAnd(
94536
94596
  left.left,
94537
- factory.createStrictInequality(factory.createAssignment(temp, left.right), factory.createVoidZero())
94597
+ factory2.createStrictInequality(factory2.createAssignment(temp, left.right), factory2.createVoidZero())
94538
94598
  ),
94539
- factory.createPropertyAccessExpression(temp, node.right)
94599
+ factory2.createPropertyAccessExpression(temp, node.right)
94540
94600
  );
94541
94601
  }
94542
94602
  function serializeEntityNameAsExpression(node) {
@@ -94551,21 +94611,21 @@ function createRuntimeTypeSerializer(context) {
94551
94611
  }
94552
94612
  }
94553
94613
  function serializeQualifiedNameAsExpression(node) {
94554
- return factory.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right);
94614
+ return factory2.createPropertyAccessExpression(serializeEntityNameAsExpression(node.left), node.right);
94555
94615
  }
94556
94616
  function getGlobalConstructorWithFallback(name) {
94557
- return factory.createConditionalExpression(
94558
- factory.createTypeCheck(factory.createIdentifier(name), "function"),
94617
+ return factory2.createConditionalExpression(
94618
+ factory2.createTypeCheck(factory2.createIdentifier(name), "function"),
94559
94619
  /*questionToken*/
94560
94620
  void 0,
94561
- factory.createIdentifier(name),
94621
+ factory2.createIdentifier(name),
94562
94622
  /*colonToken*/
94563
94623
  void 0,
94564
- factory.createIdentifier("Object")
94624
+ factory2.createIdentifier("Object")
94565
94625
  );
94566
94626
  }
94567
94627
  function getGlobalConstructor(name, minLanguageVersion) {
94568
- return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory.createIdentifier(name);
94628
+ return languageVersion < minLanguageVersion ? getGlobalConstructorWithFallback(name) : factory2.createIdentifier(name);
94569
94629
  }
94570
94630
  }
94571
94631
 
@@ -109396,7 +109456,7 @@ function transformDeclarations(context) {
109396
109456
  }
109397
109457
  const newParam = factory2.updateParameterDeclaration(
109398
109458
  p,
109399
- maskModifiers(p, modifierMask),
109459
+ maskModifiers(factory2, p, modifierMask),
109400
109460
  p.dotDotDotToken,
109401
109461
  filterBindingPatternInitializersAndRenamings(p.name),
109402
109462
  resolver.isOptionalParameter(p) ? p.questionToken || factory2.createToken(57 /* QuestionToken */) : void 0,
@@ -110510,8 +110570,8 @@ function isAlwaysType(node) {
110510
110570
  }
110511
110571
  return false;
110512
110572
  }
110513
- function maskModifiers(node, modifierMask, modifierAdditions) {
110514
- return factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
110573
+ function maskModifiers(factory2, node, modifierMask, modifierAdditions) {
110574
+ return factory2.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions));
110515
110575
  }
110516
110576
  function maskModifierFlags(node, modifierMask = 258047 /* All */ ^ 4 /* Public */, modifierAdditions = 0 /* None */) {
110517
110577
  let flags = getEffectiveModifierFlags(node) & modifierMask | modifierAdditions;
@@ -123397,7 +123457,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123397
123457
  return toWatch && directoryWatchesOfFailedLookups.has(toWatch.dirPath) ? toWatch.dirPath : void 0;
123398
123458
  }
123399
123459
  function createTypeRootsWatch(typeRootPath, typeRoot) {
123400
- return resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
123460
+ return canWatchTypeRootPath(typeRootPath) ? resolutionHost.watchTypeRootsDirectory(typeRoot, (fileOrDirectory) => {
123401
123461
  const fileOrDirectoryPath = resolutionHost.toPath(fileOrDirectory);
123402
123462
  if (cachedDirectoryStructureHost) {
123403
123463
  cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
@@ -123408,7 +123468,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123408
123468
  if (dirPath) {
123409
123469
  scheduleInvalidateResolutionOfFailedLookupLocation(fileOrDirectoryPath, dirPath === fileOrDirectoryPath);
123410
123470
  }
123411
- }, 1 /* Recursive */);
123471
+ }, 1 /* Recursive */) : noopFileWatcher;
123412
123472
  }
123413
123473
  function updateTypeRootsWatch() {
123414
123474
  const options = resolutionHost.getCompilationSettings();
@@ -123416,7 +123476,7 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123416
123476
  closeTypeRootsWatch();
123417
123477
  return;
123418
123478
  }
123419
- const typeRoots = getEffectiveTypeRoots(options, { directoryExists: directoryExistsForTypeRootWatch, getCurrentDirectory });
123479
+ const typeRoots = getEffectiveTypeRoots(options, { getCurrentDirectory });
123420
123480
  if (typeRoots) {
123421
123481
  mutateMap(
123422
123482
  typeRootsWatches,
@@ -123430,7 +123490,9 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
123430
123490
  closeTypeRootsWatch();
123431
123491
  }
123432
123492
  }
123433
- function directoryExistsForTypeRootWatch(nodeTypesDirectory) {
123493
+ function canWatchTypeRootPath(nodeTypesDirectory) {
123494
+ if (resolutionHost.getCompilationSettings().typeRoots)
123495
+ return true;
123434
123496
  const dir = getDirectoryPath(getDirectoryPath(nodeTypesDirectory));
123435
123497
  const dirPath = resolutionHost.toPath(dir);
123436
123498
  return dirPath === rootPath || canWatchDirectoryOrFile(dirPath);
@@ -133235,6 +133297,10 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
133235
133297
  diags.push(createDiagnosticForNode(init, Diagnostics.require_call_may_be_converted_to_an_import));
133236
133298
  }
133237
133299
  }
133300
+ const jsdocTypedefNode = ts_codefix_exports.getJSDocTypedefNode(node);
133301
+ if (jsdocTypedefNode) {
133302
+ diags.push(createDiagnosticForNode(jsdocTypedefNode, Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type));
133303
+ }
133238
133304
  if (ts_codefix_exports.parameterShouldGetTypeFromJSDoc(node)) {
133239
133305
  diags.push(createDiagnosticForNode(node.name || node, Diagnostics.JSDoc_types_may_be_moved_to_TypeScript_types));
133240
133306
  }
@@ -135259,7 +135325,6 @@ var invalidOperationsInSyntacticMode = [
135259
135325
  "getTypeDefinitionAtPosition",
135260
135326
  "getReferencesAtPosition",
135261
135327
  "findReferences",
135262
- "getOccurrencesAtPosition",
135263
135328
  "getDocumentHighlights",
135264
135329
  "getNavigateToItems",
135265
135330
  "getRenameInfo",
@@ -135682,18 +135747,6 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
135682
135747
  synchronizeHostData();
135683
135748
  return ts_FindAllReferences_exports.getImplementationsAtPosition(program, cancellationToken, program.getSourceFiles(), getValidSourceFile(fileName), position);
135684
135749
  }
135685
- function getOccurrencesAtPosition(fileName, position) {
135686
- return flatMap(
135687
- getDocumentHighlights(fileName, position, [fileName]),
135688
- (entry) => entry.highlightSpans.map((highlightSpan) => ({
135689
- fileName: entry.fileName,
135690
- textSpan: highlightSpan.textSpan,
135691
- isWriteAccess: highlightSpan.kind === "writtenReference" /* writtenReference */,
135692
- ...highlightSpan.isInString && { isInString: true },
135693
- ...highlightSpan.contextSpan && { contextSpan: highlightSpan.contextSpan }
135694
- }))
135695
- );
135696
- }
135697
135750
  function getDocumentHighlights(fileName, position, filesToSearch) {
135698
135751
  const normalizedFileName = normalizePath(fileName);
135699
135752
  Debug.assert(filesToSearch.some((f) => normalizePath(f) === normalizedFileName));
@@ -135886,22 +135939,22 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
135886
135939
  }
135887
135940
  return [];
135888
135941
  }
135889
- function getCodeFixesAtPosition(fileName, start2, end, errorCodes63, formatOptions, preferences = emptyOptions) {
135942
+ function getCodeFixesAtPosition(fileName, start2, end, errorCodes64, formatOptions, preferences = emptyOptions) {
135890
135943
  synchronizeHostData();
135891
135944
  const sourceFile = getValidSourceFile(fileName);
135892
135945
  const span = createTextSpanFromBounds(start2, end);
135893
135946
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
135894
- return flatMap(deduplicate(errorCodes63, equateValues, compareValues), (errorCode) => {
135947
+ return flatMap(deduplicate(errorCodes64, equateValues, compareValues), (errorCode) => {
135895
135948
  cancellationToken.throwIfCancellationRequested();
135896
135949
  return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
135897
135950
  });
135898
135951
  }
135899
- function getCombinedCodeFix(scope, fixId51, formatOptions, preferences = emptyOptions) {
135952
+ function getCombinedCodeFix(scope, fixId52, formatOptions, preferences = emptyOptions) {
135900
135953
  synchronizeHostData();
135901
135954
  Debug.assert(scope.type === "file");
135902
135955
  const sourceFile = getValidSourceFile(scope.fileName);
135903
135956
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
135904
- return ts_codefix_exports.getAllFixes({ fixId: fixId51, sourceFile, program, host, cancellationToken, formatContext, preferences });
135957
+ return ts_codefix_exports.getAllFixes({ fixId: fixId52, sourceFile, program, host, cancellationToken, formatContext, preferences });
135905
135958
  }
135906
135959
  function organizeImports2(args, formatOptions, preferences = emptyOptions) {
135907
135960
  var _a3;
@@ -136323,7 +136376,6 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
136323
136376
  getReferencesAtPosition,
136324
136377
  findReferences,
136325
136378
  getFileReferences,
136326
- getOccurrencesAtPosition,
136327
136379
  getDocumentHighlights,
136328
136380
  getNameOrDottedNameSpan,
136329
136381
  getBreakpointStatementAtPosition,
@@ -137042,12 +137094,6 @@ var LanguageServiceShimObject = class extends ShimBase {
137042
137094
  () => this.languageService.getFileReferences(fileName)
137043
137095
  );
137044
137096
  }
137045
- getOccurrencesAtPosition(fileName, position) {
137046
- return this.forwardJSONCall(
137047
- `getOccurrencesAtPosition('${fileName}', ${position})`,
137048
- () => this.languageService.getOccurrencesAtPosition(fileName, position)
137049
- );
137050
- }
137051
137097
  getDocumentHighlights(fileName, position, filesToSearch) {
137052
137098
  return this.forwardJSONCall(
137053
137099
  `getDocumentHighlights('${fileName}', ${position})`,
@@ -138656,6 +138702,7 @@ __export(ts_codefix_exports, {
138656
138702
  getFixes: () => getFixes,
138657
138703
  getImportCompletionAction: () => getImportCompletionAction,
138658
138704
  getImportKind: () => getImportKind,
138705
+ getJSDocTypedefNode: () => getJSDocTypedefNode,
138659
138706
  getNoopSymbolTrackerWithResolver: () => getNoopSymbolTrackerWithResolver,
138660
138707
  getPromoteTypeOnlyCompletionAction: () => getPromoteTypeOnlyCompletionAction,
138661
138708
  getSupportedErrorCodes: () => getSupportedErrorCodes,
@@ -138685,23 +138732,23 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description2) {
138685
138732
  void 0
138686
138733
  );
138687
138734
  }
138688
- function createCodeFixAction(fixName8, changes, description2, fixId51, fixAllDescription, command) {
138689
- return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId51, diagnosticToString(fixAllDescription), command);
138735
+ function createCodeFixAction(fixName8, changes, description2, fixId52, fixAllDescription, command) {
138736
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, diagnosticToString(fixAllDescription), command);
138690
138737
  }
138691
- function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId51, fixAllDescription, command) {
138692
- return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId51, fixAllDescription && diagnosticToString(fixAllDescription), command);
138738
+ function createCodeFixActionMaybeFixAll(fixName8, changes, description2, fixId52, fixAllDescription, command) {
138739
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description2), changes, fixId52, fixAllDescription && diagnosticToString(fixAllDescription), command);
138693
138740
  }
138694
- function createCodeFixActionWorker(fixName8, description2, changes, fixId51, fixAllDescription, command) {
138695
- return { fixName: fixName8, description: description2, changes, fixId: fixId51, fixAllDescription, commands: command ? [command] : void 0 };
138741
+ function createCodeFixActionWorker(fixName8, description2, changes, fixId52, fixAllDescription, command) {
138742
+ return { fixName: fixName8, description: description2, changes, fixId: fixId52, fixAllDescription, commands: command ? [command] : void 0 };
138696
138743
  }
138697
138744
  function registerCodeFix(reg) {
138698
138745
  for (const error of reg.errorCodes) {
138699
138746
  errorCodeToFixes.add(String(error), reg);
138700
138747
  }
138701
138748
  if (reg.fixIds) {
138702
- for (const fixId51 of reg.fixIds) {
138703
- Debug.assert(!fixIdToRegistration.has(fixId51));
138704
- fixIdToRegistration.set(fixId51, reg);
138749
+ for (const fixId52 of reg.fixIds) {
138750
+ Debug.assert(!fixIdToRegistration.has(fixId52));
138751
+ fixIdToRegistration.set(fixId52, reg);
138705
138752
  }
138706
138753
  }
138707
138754
  }
@@ -138709,17 +138756,17 @@ function getSupportedErrorCodes() {
138709
138756
  return arrayFrom(errorCodeToFixes.keys());
138710
138757
  }
138711
138758
  function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
138712
- const { errorCodes: errorCodes63 } = registration;
138759
+ const { errorCodes: errorCodes64 } = registration;
138713
138760
  let maybeFixableDiagnostics = 0;
138714
138761
  for (const diag2 of diagnostics) {
138715
- if (contains(errorCodes63, diag2.code))
138762
+ if (contains(errorCodes64, diag2.code))
138716
138763
  maybeFixableDiagnostics++;
138717
138764
  if (maybeFixableDiagnostics > 1)
138718
138765
  break;
138719
138766
  }
138720
138767
  const fixAllUnavailable = maybeFixableDiagnostics < 2;
138721
- return ({ fixId: fixId51, fixAllDescription, ...action }) => {
138722
- return fixAllUnavailable ? action : { ...action, fixId: fixId51, fixAllDescription };
138768
+ return ({ fixId: fixId52, fixAllDescription, ...action }) => {
138769
+ return fixAllUnavailable ? action : { ...action, fixId: fixId52, fixAllDescription };
138723
138770
  };
138724
138771
  }
138725
138772
  function getFixes(context) {
@@ -138736,14 +138783,14 @@ function createCombinedCodeActions(changes, commands) {
138736
138783
  function createFileTextChanges(fileName, textChanges2) {
138737
138784
  return { fileName, textChanges: textChanges2 };
138738
138785
  }
138739
- function codeFixAll(context, errorCodes63, use) {
138786
+ function codeFixAll(context, errorCodes64, use) {
138740
138787
  const commands = [];
138741
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes63, (diag2) => use(t, diag2, commands)));
138788
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => eachDiagnostic(context, errorCodes64, (diag2) => use(t, diag2, commands)));
138742
138789
  return createCombinedCodeActions(changes, commands.length === 0 ? void 0 : commands);
138743
138790
  }
138744
- function eachDiagnostic(context, errorCodes63, cb) {
138791
+ function eachDiagnostic(context, errorCodes64, cb) {
138745
138792
  for (const diag2 of getDiagnostics(context)) {
138746
- if (contains(errorCodes63, diag2.code)) {
138793
+ if (contains(errorCodes64, diag2.code)) {
138747
138794
  cb(diag2);
138748
138795
  }
138749
138796
  }
@@ -141198,61 +141245,268 @@ function getTypeExportSpecifiers(originExportSpecifier, context) {
141198
141245
  }
141199
141246
 
141200
141247
  // src/services/codefixes/convertToTypeOnlyImport.ts
141201
- var errorCodes14 = [Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code];
141248
+ var errorCodes14 = [
141249
+ Diagnostics.This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error.code,
141250
+ Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_verbatimModuleSyntax_is_enabled.code
141251
+ ];
141202
141252
  var fixId13 = "convertToTypeOnlyImport";
141203
141253
  registerCodeFix({
141204
141254
  errorCodes: errorCodes14,
141205
141255
  getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
141206
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
141207
- const importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
141208
- fixSingleImportDeclaration(t, importDeclaration, context);
141209
- });
141210
- if (changes.length) {
141256
+ const declaration = getDeclaration2(context.sourceFile, context.span.start);
141257
+ if (declaration) {
141258
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, context.sourceFile, declaration));
141211
141259
  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
141260
  }
141261
+ return void 0;
141213
141262
  },
141214
141263
  fixIds: [fixId13],
141215
141264
  getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
141216
141265
  return codeFixAll(context, errorCodes14, (changes, diag2) => {
141217
- const importDeclaration = getImportDeclarationForDiagnosticSpan(diag2, context.sourceFile);
141218
- fixSingleImportDeclaration(changes, importDeclaration, context);
141266
+ const declaration = getDeclaration2(diag2.file, diag2.start);
141267
+ if (declaration) {
141268
+ doChange4(changes, diag2.file, declaration);
141269
+ }
141219
141270
  });
141220
141271
  }
141221
141272
  });
141222
- function getImportDeclarationForDiagnosticSpan(span, sourceFile) {
141223
- return tryCast(getTokenAtPosition(sourceFile, span.start).parent, isImportDeclaration);
141273
+ function getDeclaration2(sourceFile, pos) {
141274
+ const { parent: parent2 } = getTokenAtPosition(sourceFile, pos);
141275
+ return isImportSpecifier(parent2) || isImportDeclaration(parent2) && parent2.importClause ? parent2 : void 0;
141276
+ }
141277
+ function doChange4(changes, sourceFile, declaration) {
141278
+ if (isImportSpecifier(declaration)) {
141279
+ changes.replaceNode(sourceFile, declaration, factory.updateImportSpecifier(
141280
+ declaration,
141281
+ /*isTypeOnly*/
141282
+ true,
141283
+ declaration.propertyName,
141284
+ declaration.name
141285
+ ));
141286
+ } else {
141287
+ const importClause = declaration.importClause;
141288
+ if (importClause.name && importClause.namedBindings) {
141289
+ changes.replaceNodeWithNodes(sourceFile, declaration, [
141290
+ factory.createImportDeclaration(
141291
+ getSynthesizedDeepClones(
141292
+ declaration.modifiers,
141293
+ /*includeTrivia*/
141294
+ true
141295
+ ),
141296
+ factory.createImportClause(
141297
+ /*isTypeOnly*/
141298
+ true,
141299
+ getSynthesizedDeepClone(
141300
+ importClause.name,
141301
+ /*includeTrivia*/
141302
+ true
141303
+ ),
141304
+ /*namedBindings*/
141305
+ void 0
141306
+ ),
141307
+ getSynthesizedDeepClone(
141308
+ declaration.moduleSpecifier,
141309
+ /*includeTrivia*/
141310
+ true
141311
+ ),
141312
+ getSynthesizedDeepClone(
141313
+ declaration.assertClause,
141314
+ /*includeTrivia*/
141315
+ true
141316
+ )
141317
+ ),
141318
+ factory.createImportDeclaration(
141319
+ getSynthesizedDeepClones(
141320
+ declaration.modifiers,
141321
+ /*includeTrivia*/
141322
+ true
141323
+ ),
141324
+ factory.createImportClause(
141325
+ /*isTypeOnly*/
141326
+ true,
141327
+ /*name*/
141328
+ void 0,
141329
+ getSynthesizedDeepClone(
141330
+ importClause.namedBindings,
141331
+ /*includeTrivia*/
141332
+ true
141333
+ )
141334
+ ),
141335
+ getSynthesizedDeepClone(
141336
+ declaration.moduleSpecifier,
141337
+ /*includeTrivia*/
141338
+ true
141339
+ ),
141340
+ getSynthesizedDeepClone(
141341
+ declaration.assertClause,
141342
+ /*includeTrivia*/
141343
+ true
141344
+ )
141345
+ )
141346
+ ]);
141347
+ } else {
141348
+ const importDeclaration = factory.updateImportDeclaration(
141349
+ declaration,
141350
+ declaration.modifiers,
141351
+ factory.updateImportClause(
141352
+ importClause,
141353
+ /*isTypeOnly*/
141354
+ true,
141355
+ importClause.name,
141356
+ importClause.namedBindings
141357
+ ),
141358
+ declaration.moduleSpecifier,
141359
+ declaration.assertClause
141360
+ );
141361
+ changes.replaceNode(sourceFile, declaration, importDeclaration);
141362
+ }
141363
+ }
141364
+ }
141365
+
141366
+ // src/services/codefixes/convertTypedefToType.ts
141367
+ var fixId14 = "convertTypedefToType";
141368
+ var errorCodes15 = [Diagnostics.JSDoc_typedef_may_be_converted_to_TypeScript_type.code];
141369
+ registerCodeFix({
141370
+ fixIds: [fixId14],
141371
+ errorCodes: errorCodes15,
141372
+ getCodeActions(context) {
141373
+ const node = getTokenAtPosition(
141374
+ context.sourceFile,
141375
+ context.span.start
141376
+ );
141377
+ if (!node)
141378
+ return;
141379
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, node, context.sourceFile));
141380
+ if (changes.length > 0) {
141381
+ return [
141382
+ createCodeFixAction(
141383
+ fixId14,
141384
+ changes,
141385
+ Diagnostics.Convert_typedef_to_TypeScript_type,
141386
+ fixId14,
141387
+ Diagnostics.Convert_all_typedef_to_TypeScript_types
141388
+ )
141389
+ ];
141390
+ }
141391
+ },
141392
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
141393
+ const node = getTokenAtPosition(diag2.file, diag2.start);
141394
+ if (node)
141395
+ doChange5(changes, node, diag2.file);
141396
+ })
141397
+ });
141398
+ function doChange5(changes, node, sourceFile) {
141399
+ if (isJSDocTypedefTag(node)) {
141400
+ fixSingleTypeDef(changes, node, sourceFile);
141401
+ }
141224
141402
  }
141225
- function fixSingleImportDeclaration(changes, importDeclaration, context) {
141226
- if (!(importDeclaration == null ? void 0 : importDeclaration.importClause)) {
141403
+ function fixSingleTypeDef(changes, typeDefNode, sourceFile) {
141404
+ if (!typeDefNode)
141405
+ return;
141406
+ const declaration = createDeclaration(typeDefNode);
141407
+ if (!declaration)
141227
141408
  return;
141409
+ const comment = typeDefNode.parent;
141410
+ changes.replaceNode(
141411
+ sourceFile,
141412
+ comment,
141413
+ declaration
141414
+ );
141415
+ }
141416
+ function createDeclaration(tag) {
141417
+ var _a2;
141418
+ const { typeExpression } = tag;
141419
+ if (!typeExpression)
141420
+ return;
141421
+ const typeName = (_a2 = tag.name) == null ? void 0 : _a2.getText();
141422
+ if (!typeName)
141423
+ return;
141424
+ if (typeExpression.kind === 325 /* JSDocTypeLiteral */) {
141425
+ return createInterfaceForTypeLiteral(typeName, typeExpression);
141228
141426
  }
141229
- const { importClause } = importDeclaration;
141230
- changes.insertText(context.sourceFile, importDeclaration.getStart() + "import".length, " type");
141231
- if (importClause.name && importClause.namedBindings) {
141232
- changes.deleteNodeRangeExcludingEnd(context.sourceFile, importClause.name, importDeclaration.importClause.namedBindings);
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
141247
- ));
141427
+ if (typeExpression.kind === 312 /* JSDocTypeExpression */) {
141428
+ return createTypeAliasForTypeExpression(typeName, typeExpression);
141429
+ }
141430
+ }
141431
+ function createInterfaceForTypeLiteral(typeName, typeLiteral) {
141432
+ const propertySignatures = createSignatureFromTypeLiteral(typeLiteral);
141433
+ if (!some(propertySignatures))
141434
+ return;
141435
+ const interfaceDeclaration = factory.createInterfaceDeclaration(
141436
+ /*modifiers*/
141437
+ void 0,
141438
+ typeName,
141439
+ /*typeParameters*/
141440
+ void 0,
141441
+ /*heritageClauses*/
141442
+ void 0,
141443
+ propertySignatures
141444
+ );
141445
+ return interfaceDeclaration;
141446
+ }
141447
+ function createTypeAliasForTypeExpression(typeName, typeExpression) {
141448
+ const typeReference = getSynthesizedDeepClone(typeExpression.type);
141449
+ if (!typeReference)
141450
+ return;
141451
+ const declaration = factory.createTypeAliasDeclaration(
141452
+ /*modifiers*/
141453
+ void 0,
141454
+ factory.createIdentifier(typeName),
141455
+ /*typeParameters*/
141456
+ void 0,
141457
+ typeReference
141458
+ );
141459
+ return declaration;
141460
+ }
141461
+ function createSignatureFromTypeLiteral(typeLiteral) {
141462
+ const propertyTags = typeLiteral.jsDocPropertyTags;
141463
+ if (!some(propertyTags))
141464
+ return;
141465
+ const getSignature = (tag) => {
141466
+ var _a2;
141467
+ const name = getPropertyName(tag);
141468
+ const type = (_a2 = tag.typeExpression) == null ? void 0 : _a2.type;
141469
+ const isOptional = tag.isBracketed;
141470
+ let typeReference;
141471
+ if (type && isJSDocTypeLiteral(type)) {
141472
+ const signatures = createSignatureFromTypeLiteral(type);
141473
+ typeReference = factory.createTypeLiteralNode(signatures);
141474
+ } else if (type) {
141475
+ typeReference = getSynthesizedDeepClone(type);
141476
+ }
141477
+ if (typeReference && name) {
141478
+ const questionToken = isOptional ? factory.createToken(57 /* QuestionToken */) : void 0;
141479
+ const prop = factory.createPropertySignature(
141480
+ /*modifiers*/
141481
+ void 0,
141482
+ name,
141483
+ questionToken,
141484
+ typeReference
141485
+ );
141486
+ return prop;
141487
+ }
141488
+ };
141489
+ const props = mapDefined(propertyTags, getSignature);
141490
+ return props;
141491
+ }
141492
+ function getPropertyName(tag) {
141493
+ return tag.name.kind === 79 /* Identifier */ ? tag.name.text : tag.name.right.text;
141494
+ }
141495
+ function getJSDocTypedefNode(node) {
141496
+ if (hasJSDocNodes(node)) {
141497
+ return forEach(node.jsDoc, (node2) => {
141498
+ var _a2;
141499
+ return (_a2 = node2.tags) == null ? void 0 : _a2.find(isJSDocTypedefTag);
141500
+ });
141248
141501
  }
141502
+ return void 0;
141249
141503
  }
141250
141504
 
141251
141505
  // src/services/codefixes/convertLiteralTypeToMappedType.ts
141252
- var fixId14 = "convertLiteralTypeToMappedType";
141253
- var errorCodes15 = [Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
141506
+ var fixId15 = "convertLiteralTypeToMappedType";
141507
+ var 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];
141254
141508
  registerCodeFix({
141255
- errorCodes: errorCodes15,
141509
+ errorCodes: errorCodes16,
141256
141510
  getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
141257
141511
  const { sourceFile, span } = context;
141258
141512
  const info = getInfo2(sourceFile, span.start);
@@ -141260,14 +141514,14 @@ registerCodeFix({
141260
141514
  return void 0;
141261
141515
  }
141262
141516
  const { name, constraint } = info;
141263
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange4(t, sourceFile, info));
141264
- return [createCodeFixAction(fixId14, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId14, Diagnostics.Convert_all_type_literals_to_mapped_type)];
141517
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange6(t, sourceFile, info));
141518
+ return [createCodeFixAction(fixId15, changes, [Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId15, Diagnostics.Convert_all_type_literals_to_mapped_type)];
141265
141519
  },
141266
- fixIds: [fixId14],
141267
- getAllCodeActions: (context) => codeFixAll(context, errorCodes15, (changes, diag2) => {
141520
+ fixIds: [fixId15],
141521
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes16, (changes, diag2) => {
141268
141522
  const info = getInfo2(diag2.file, diag2.start);
141269
141523
  if (info) {
141270
- doChange4(changes, diag2.file, info);
141524
+ doChange6(changes, diag2.file, info);
141271
141525
  }
141272
141526
  })
141273
141527
  });
@@ -141285,7 +141539,7 @@ function getInfo2(sourceFile, pos) {
141285
141539
  }
141286
141540
  return void 0;
141287
141541
  }
141288
- function doChange4(changes, sourceFile, { container, typeNode, constraint, name }) {
141542
+ function doChange6(changes, sourceFile, { container, typeNode, constraint, name }) {
141289
141543
  changes.replaceNode(sourceFile, container, factory.createMappedTypeNode(
141290
141544
  /*readonlyToken*/
141291
141545
  void 0,
@@ -141306,25 +141560,25 @@ function doChange4(changes, sourceFile, { container, typeNode, constraint, name
141306
141560
  }
141307
141561
 
141308
141562
  // src/services/codefixes/fixClassIncorrectlyImplementsInterface.ts
141309
- var errorCodes16 = [
141563
+ var errorCodes17 = [
141310
141564
  Diagnostics.Class_0_incorrectly_implements_interface_1.code,
141311
141565
  Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code
141312
141566
  ];
141313
- var fixId15 = "fixClassIncorrectlyImplementsInterface";
141567
+ var fixId16 = "fixClassIncorrectlyImplementsInterface";
141314
141568
  registerCodeFix({
141315
- errorCodes: errorCodes16,
141569
+ errorCodes: errorCodes17,
141316
141570
  getCodeActions(context) {
141317
141571
  const { sourceFile, span } = context;
141318
141572
  const classDeclaration = getClass(sourceFile, span.start);
141319
141573
  return mapDefined(getEffectiveImplementsTypeNodes(classDeclaration), (implementedTypeNode) => {
141320
141574
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingDeclarations(context, implementedTypeNode, sourceFile, classDeclaration, t, context.preferences));
141321
- return changes.length === 0 ? void 0 : createCodeFixAction(fixId15, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId15, Diagnostics.Implement_all_unimplemented_interfaces);
141575
+ return changes.length === 0 ? void 0 : createCodeFixAction(fixId16, changes, [Diagnostics.Implement_interface_0, implementedTypeNode.getText(sourceFile)], fixId16, Diagnostics.Implement_all_unimplemented_interfaces);
141322
141576
  });
141323
141577
  },
141324
- fixIds: [fixId15],
141578
+ fixIds: [fixId16],
141325
141579
  getAllCodeActions(context) {
141326
141580
  const seenClassDeclarations = /* @__PURE__ */ new Map();
141327
- return codeFixAll(context, errorCodes16, (changes, diag2) => {
141581
+ return codeFixAll(context, errorCodes17, (changes, diag2) => {
141328
141582
  const classDeclaration = getClass(diag2.file, diag2.start);
141329
141583
  if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
141330
141584
  for (const implementedTypeNode of getEffectiveImplementsTypeNodes(classDeclaration)) {
@@ -141389,7 +141643,7 @@ function getHeritageClauseSymbolTable(classDeclaration, checker) {
141389
141643
  // src/services/codefixes/importFixes.ts
141390
141644
  var importFixName = "import";
141391
141645
  var importFixId = "fixMissingImport";
141392
- var errorCodes17 = [
141646
+ var errorCodes18 = [
141393
141647
  Diagnostics.Cannot_find_name_0.code,
141394
141648
  Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
141395
141649
  Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
@@ -141401,7 +141655,7 @@ var errorCodes17 = [
141401
141655
  Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code
141402
141656
  ];
141403
141657
  registerCodeFix({
141404
- errorCodes: errorCodes17,
141658
+ errorCodes: errorCodes18,
141405
141659
  getCodeActions(context) {
141406
141660
  const { errorCode, preferences, sourceFile, span, program } = context;
141407
141661
  const info = getFixInfos(
@@ -141436,7 +141690,7 @@ registerCodeFix({
141436
141690
  host,
141437
141691
  cancellationToken
141438
141692
  );
141439
- eachDiagnostic(context, errorCodes17, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
141693
+ eachDiagnostic(context, errorCodes18, (diag2) => importAdder.addImportFromDiagnostic(diag2, context));
141440
141694
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, importAdder.writeFixes));
141441
141695
  }
141442
141696
  });
@@ -142602,8 +142856,8 @@ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitali
142602
142856
  }
142603
142857
 
142604
142858
  // src/services/codefixes/fixAddMissingConstraint.ts
142605
- var fixId16 = "addMissingConstraint";
142606
- var errorCodes18 = [
142859
+ var fixId17 = "addMissingConstraint";
142860
+ var errorCodes19 = [
142607
142861
  // We want errors this could be attached to:
142608
142862
  // Diagnostics.This_type_parameter_probably_needs_an_extends_0_constraint
142609
142863
  Diagnostics.Type_0_is_not_comparable_to_type_1.code,
@@ -142616,21 +142870,21 @@ var errorCodes18 = [
142616
142870
  Diagnostics.Type_0_does_not_satisfy_the_constraint_1.code
142617
142871
  ];
142618
142872
  registerCodeFix({
142619
- errorCodes: errorCodes18,
142873
+ errorCodes: errorCodes19,
142620
142874
  getCodeActions(context) {
142621
142875
  const { sourceFile, span, program, preferences, host } = context;
142622
142876
  const info = getInfo3(program, sourceFile, span);
142623
142877
  if (info === void 0)
142624
142878
  return;
142625
142879
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingConstraint(t, program, preferences, host, sourceFile, info));
142626
- return [createCodeFixAction(fixId16, changes, Diagnostics.Add_extends_constraint, fixId16, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
142880
+ return [createCodeFixAction(fixId17, changes, Diagnostics.Add_extends_constraint, fixId17, Diagnostics.Add_extends_constraint_to_all_type_parameters)];
142627
142881
  },
142628
- fixIds: [fixId16],
142882
+ fixIds: [fixId17],
142629
142883
  getAllCodeActions: (context) => {
142630
142884
  const { program, preferences, host } = context;
142631
142885
  const seen = /* @__PURE__ */ new Map();
142632
142886
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
142633
- eachDiagnostic(context, errorCodes18, (diag2) => {
142887
+ eachDiagnostic(context, errorCodes19, (diag2) => {
142634
142888
  const info = getInfo3(program, diag2.file, createTextSpan(diag2.start, diag2.length));
142635
142889
  if (info) {
142636
142890
  if (addToSeen(seen, getNodeId(info.declaration))) {
@@ -142714,7 +142968,7 @@ function tryGetConstraintType(checker, node) {
142714
142968
  var fixName = "fixOverrideModifier";
142715
142969
  var fixAddOverrideId = "fixAddOverrideModifier";
142716
142970
  var fixRemoveOverrideId = "fixRemoveOverrideModifier";
142717
- var errorCodes19 = [
142971
+ var errorCodes20 = [
142718
142972
  Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code,
142719
142973
  Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
142720
142974
  Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
@@ -142778,20 +143032,20 @@ var errorCodeFixIdMap = {
142778
143032
  }
142779
143033
  };
142780
143034
  registerCodeFix({
142781
- errorCodes: errorCodes19,
143035
+ errorCodes: errorCodes20,
142782
143036
  getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
142783
143037
  const { errorCode, span } = context;
142784
143038
  const info = errorCodeFixIdMap[errorCode];
142785
143039
  if (!info)
142786
143040
  return emptyArray;
142787
- const { descriptions, fixId: fixId51, fixAllDescriptions } = info;
143041
+ const { descriptions, fixId: fixId52, fixAllDescriptions } = info;
142788
143042
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
142789
143043
  return [
142790
- createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId51, fixAllDescriptions)
143044
+ createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId52, fixAllDescriptions)
142791
143045
  ];
142792
143046
  },
142793
143047
  fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
142794
- getAllCodeActions: (context) => codeFixAll(context, errorCodes19, (changes, diag2) => {
143048
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => {
142795
143049
  const { code, start: start2 } = diag2;
142796
143050
  const info = errorCodeFixIdMap[code];
142797
143051
  if (!info || info.fixId !== context.fixId) {
@@ -142868,22 +143122,22 @@ function findContainerClassElementLike(sourceFile, pos) {
142868
143122
  }
142869
143123
 
142870
143124
  // src/services/codefixes/fixNoPropertyAccessFromIndexSignature.ts
142871
- var fixId17 = "fixNoPropertyAccessFromIndexSignature";
142872
- var errorCodes20 = [
143125
+ var fixId18 = "fixNoPropertyAccessFromIndexSignature";
143126
+ var errorCodes21 = [
142873
143127
  Diagnostics.Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0.code
142874
143128
  ];
142875
143129
  registerCodeFix({
142876
- errorCodes: errorCodes20,
142877
- fixIds: [fixId17],
143130
+ errorCodes: errorCodes21,
143131
+ fixIds: [fixId18],
142878
143132
  getCodeActions(context) {
142879
143133
  const { sourceFile, span, preferences } = context;
142880
143134
  const property = getPropertyAccessExpression(sourceFile, span.start);
142881
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange5(t, context.sourceFile, property, preferences));
142882
- return [createCodeFixAction(fixId17, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId17, Diagnostics.Use_element_access_for_all_undeclared_properties)];
143135
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, context.sourceFile, property, preferences));
143136
+ return [createCodeFixAction(fixId18, changes, [Diagnostics.Use_element_access_for_0, property.name.text], fixId18, Diagnostics.Use_element_access_for_all_undeclared_properties)];
142883
143137
  },
142884
- getAllCodeActions: (context) => codeFixAll(context, errorCodes20, (changes, diag2) => doChange5(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
143138
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => doChange7(changes, diag2.file, getPropertyAccessExpression(diag2.file, diag2.start), context.preferences))
142885
143139
  });
142886
- function doChange5(changes, sourceFile, node, preferences) {
143140
+ function doChange7(changes, sourceFile, node, preferences) {
142887
143141
  const quotePreference = getQuotePreference(sourceFile, preferences);
142888
143142
  const argumentsExpression = factory.createStringLiteral(node.name.text, quotePreference === 0 /* Single */);
142889
143143
  changes.replaceNode(
@@ -142897,24 +143151,24 @@ function getPropertyAccessExpression(sourceFile, pos) {
142897
143151
  }
142898
143152
 
142899
143153
  // src/services/codefixes/fixImplicitThis.ts
142900
- var fixId18 = "fixImplicitThis";
142901
- var errorCodes21 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
143154
+ var fixId19 = "fixImplicitThis";
143155
+ var errorCodes22 = [Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code];
142902
143156
  registerCodeFix({
142903
- errorCodes: errorCodes21,
143157
+ errorCodes: errorCodes22,
142904
143158
  getCodeActions: function getCodeActionsToFixImplicitThis(context) {
142905
143159
  const { sourceFile, program, span } = context;
142906
143160
  let diagnostic;
142907
143161
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
142908
- diagnostic = doChange6(t, sourceFile, span.start, program.getTypeChecker());
143162
+ diagnostic = doChange8(t, sourceFile, span.start, program.getTypeChecker());
142909
143163
  });
142910
- return diagnostic ? [createCodeFixAction(fixId18, changes, diagnostic, fixId18, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
143164
+ return diagnostic ? [createCodeFixAction(fixId19, changes, diagnostic, fixId19, Diagnostics.Fix_all_implicit_this_errors)] : emptyArray;
142911
143165
  },
142912
- fixIds: [fixId18],
142913
- getAllCodeActions: (context) => codeFixAll(context, errorCodes21, (changes, diag2) => {
142914
- doChange6(changes, diag2.file, diag2.start, context.program.getTypeChecker());
143166
+ fixIds: [fixId19],
143167
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes22, (changes, diag2) => {
143168
+ doChange8(changes, diag2.file, diag2.start, context.program.getTypeChecker());
142915
143169
  })
142916
143170
  });
142917
- function doChange6(changes, sourceFile, pos, checker) {
143171
+ function doChange8(changes, sourceFile, pos, checker) {
142918
143172
  const token = getTokenAtPosition(sourceFile, pos);
142919
143173
  if (!isThis(token))
142920
143174
  return void 0;
@@ -142957,26 +143211,26 @@ function doChange6(changes, sourceFile, pos, checker) {
142957
143211
  }
142958
143212
 
142959
143213
  // src/services/codefixes/fixImportNonExportedMember.ts
142960
- var fixId19 = "fixImportNonExportedMember";
142961
- var errorCodes22 = [
143214
+ var fixId20 = "fixImportNonExportedMember";
143215
+ var errorCodes23 = [
142962
143216
  Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code
142963
143217
  ];
142964
143218
  registerCodeFix({
142965
- errorCodes: errorCodes22,
142966
- fixIds: [fixId19],
143219
+ errorCodes: errorCodes23,
143220
+ fixIds: [fixId20],
142967
143221
  getCodeActions(context) {
142968
143222
  const { sourceFile, span, program } = context;
142969
143223
  const info = getInfo4(sourceFile, span.start, program);
142970
143224
  if (info === void 0)
142971
143225
  return void 0;
142972
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange7(t, program, info));
142973
- return [createCodeFixAction(fixId19, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId19, Diagnostics.Export_all_referenced_locals)];
143226
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, program, info));
143227
+ return [createCodeFixAction(fixId20, changes, [Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId20, Diagnostics.Export_all_referenced_locals)];
142974
143228
  },
142975
143229
  getAllCodeActions(context) {
142976
143230
  const { program } = context;
142977
143231
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
142978
143232
  const exports = /* @__PURE__ */ new Map();
142979
- eachDiagnostic(context, errorCodes22, (diag2) => {
143233
+ eachDiagnostic(context, errorCodes23, (diag2) => {
142980
143234
  const info = getInfo4(diag2.file, diag2.start, program);
142981
143235
  if (info === void 0)
142982
143236
  return void 0;
@@ -143049,7 +143303,7 @@ function getInfo4(sourceFile, pos, program) {
143049
143303
  }
143050
143304
  return void 0;
143051
143305
  }
143052
- function doChange7(changes, program, { exportName, node, moduleSourceFile }) {
143306
+ function doChange9(changes, program, { exportName, node, moduleSourceFile }) {
143053
143307
  const exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly);
143054
143308
  if (exportDeclaration) {
143055
143309
  updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]);
@@ -143133,26 +143387,26 @@ function getNodeOfSymbol(symbol) {
143133
143387
  }
143134
143388
 
143135
143389
  // src/services/codefixes/fixIncorrectNamedTupleSyntax.ts
143136
- var fixId20 = "fixIncorrectNamedTupleSyntax";
143137
- var errorCodes23 = [
143390
+ var fixId21 = "fixIncorrectNamedTupleSyntax";
143391
+ var errorCodes24 = [
143138
143392
  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,
143139
143393
  Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type.code
143140
143394
  ];
143141
143395
  registerCodeFix({
143142
- errorCodes: errorCodes23,
143396
+ errorCodes: errorCodes24,
143143
143397
  getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
143144
143398
  const { sourceFile, span } = context;
143145
143399
  const namedTupleMember = getNamedTupleMember(sourceFile, span.start);
143146
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange8(t, sourceFile, namedTupleMember));
143147
- return [createCodeFixAction(fixId20, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId20, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
143400
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, namedTupleMember));
143401
+ return [createCodeFixAction(fixId21, changes, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels, fixId21, Diagnostics.Move_labeled_tuple_element_modifiers_to_labels)];
143148
143402
  },
143149
- fixIds: [fixId20]
143403
+ fixIds: [fixId21]
143150
143404
  });
143151
143405
  function getNamedTupleMember(sourceFile, pos) {
143152
143406
  const token = getTokenAtPosition(sourceFile, pos);
143153
143407
  return findAncestor(token, (t) => t.kind === 199 /* NamedTupleMember */);
143154
143408
  }
143155
- function doChange8(changes, sourceFile, namedTupleMember) {
143409
+ function doChange10(changes, sourceFile, namedTupleMember) {
143156
143410
  if (!namedTupleMember) {
143157
143411
  return;
143158
143412
  }
@@ -143181,8 +143435,8 @@ function doChange8(changes, sourceFile, namedTupleMember) {
143181
143435
  }
143182
143436
 
143183
143437
  // src/services/codefixes/fixSpelling.ts
143184
- var fixId21 = "fixSpelling";
143185
- var errorCodes24 = [
143438
+ var fixId22 = "fixSpelling";
143439
+ var errorCodes25 = [
143186
143440
  Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
143187
143441
  Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code,
143188
143442
  Diagnostics.Cannot_find_name_0_Did_you_mean_1.code,
@@ -143199,7 +143453,7 @@ var errorCodes24 = [
143199
143453
  Diagnostics.Type_0_is_not_assignable_to_type_1.code
143200
143454
  ];
143201
143455
  registerCodeFix({
143202
- errorCodes: errorCodes24,
143456
+ errorCodes: errorCodes25,
143203
143457
  getCodeActions(context) {
143204
143458
  const { sourceFile, errorCode } = context;
143205
143459
  const info = getInfo5(sourceFile, context.span.start, context, errorCode);
@@ -143207,15 +143461,15 @@ registerCodeFix({
143207
143461
  return void 0;
143208
143462
  const { node, suggestedSymbol } = info;
143209
143463
  const target = getEmitScriptTarget(context.host.getCompilationSettings());
143210
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange9(t, sourceFile, node, suggestedSymbol, target));
143211
- return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId21, Diagnostics.Fix_all_detected_spelling_errors)];
143464
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, node, suggestedSymbol, target));
143465
+ return [createCodeFixAction("spelling", changes, [Diagnostics.Change_spelling_to_0, symbolName(suggestedSymbol)], fixId22, Diagnostics.Fix_all_detected_spelling_errors)];
143212
143466
  },
143213
- fixIds: [fixId21],
143214
- getAllCodeActions: (context) => codeFixAll(context, errorCodes24, (changes, diag2) => {
143467
+ fixIds: [fixId22],
143468
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
143215
143469
  const info = getInfo5(diag2.file, diag2.start, context, diag2.code);
143216
143470
  const target = getEmitScriptTarget(context.host.getCompilationSettings());
143217
143471
  if (info)
143218
- doChange9(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
143472
+ doChange11(changes, context.sourceFile, info.node, info.suggestedSymbol, target);
143219
143473
  })
143220
143474
  });
143221
143475
  function getInfo5(sourceFile, pos, context, errorCode) {
@@ -143267,7 +143521,7 @@ function getInfo5(sourceFile, pos, context, errorCode) {
143267
143521
  }
143268
143522
  return suggestedSymbol === void 0 ? void 0 : { node, suggestedSymbol };
143269
143523
  }
143270
- function doChange9(changes, sourceFile, node, suggestedSymbol, target) {
143524
+ function doChange11(changes, sourceFile, node, suggestedSymbol, target) {
143271
143525
  const suggestion = symbolName(suggestedSymbol);
143272
143526
  if (!isIdentifierText(suggestion, target) && isPropertyAccessExpression(node.parent)) {
143273
143527
  const valDecl = suggestedSymbol.valueDeclaration;
@@ -143303,17 +143557,17 @@ function getResolvedSourceFileFromImportDeclaration(sourceFile, context, importD
143303
143557
  }
143304
143558
 
143305
143559
  // src/services/codefixes/returnValueCorrect.ts
143306
- var fixId22 = "returnValueCorrect";
143560
+ var fixId23 = "returnValueCorrect";
143307
143561
  var fixIdAddReturnStatement = "fixAddReturnStatement";
143308
143562
  var fixRemoveBracesFromArrowFunctionBody = "fixRemoveBracesFromArrowFunctionBody";
143309
143563
  var fixIdWrapTheBlockWithParen = "fixWrapTheBlockWithParen";
143310
- var errorCodes25 = [
143564
+ var errorCodes26 = [
143311
143565
  Diagnostics.A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value.code,
143312
143566
  Diagnostics.Type_0_is_not_assignable_to_type_1.code,
143313
143567
  Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code
143314
143568
  ];
143315
143569
  registerCodeFix({
143316
- errorCodes: errorCodes25,
143570
+ errorCodes: errorCodes26,
143317
143571
  fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
143318
143572
  getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
143319
143573
  const { program, sourceFile, span: { start: start2 }, errorCode } = context;
@@ -143329,7 +143583,7 @@ registerCodeFix({
143329
143583
  return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)];
143330
143584
  }
143331
143585
  },
143332
- getAllCodeActions: (context) => codeFixAll(context, errorCodes25, (changes, diag2) => {
143586
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes26, (changes, diag2) => {
143333
143587
  const info = getInfo6(context.program.getTypeChecker(), diag2.file, diag2.start, diag2.code);
143334
143588
  if (!info)
143335
143589
  return void 0;
@@ -143537,7 +143791,7 @@ function wrapBlockWithParen(changes, sourceFile, declaration, expression) {
143537
143791
  }
143538
143792
  function getActionForfixAddReturnStatement(context, expression, statement) {
143539
143793
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addReturnStatement(t, context.sourceFile, expression, statement));
143540
- return createCodeFixAction(fixId22, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
143794
+ return createCodeFixAction(fixId23, changes, Diagnostics.Add_a_return_statement, fixIdAddReturnStatement, Diagnostics.Add_all_missing_return_statement);
143541
143795
  }
143542
143796
  function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration, expression, commentSource) {
143543
143797
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => removeBlockBodyBrace(
@@ -143549,11 +143803,11 @@ function getActionForFixRemoveBracesFromArrowFunctionBody(context, declaration,
143549
143803
  /* withParen */
143550
143804
  false
143551
143805
  ));
143552
- return createCodeFixAction(fixId22, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
143806
+ return createCodeFixAction(fixId23, changes, Diagnostics.Remove_braces_from_arrow_function_body, fixRemoveBracesFromArrowFunctionBody, Diagnostics.Remove_braces_from_all_arrow_function_bodies_with_relevant_issues);
143553
143807
  }
143554
143808
  function getActionForfixWrapTheBlockWithParen(context, declaration, expression) {
143555
143809
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => wrapBlockWithParen(t, context.sourceFile, declaration, expression));
143556
- return createCodeFixAction(fixId22, changes, Diagnostics.Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal, fixIdWrapTheBlockWithParen, Diagnostics.Wrap_all_object_literal_with_parentheses);
143810
+ 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);
143557
143811
  }
143558
143812
 
143559
143813
  // src/services/codefixes/fixAddMissingMember.ts
@@ -143561,7 +143815,7 @@ var fixMissingMember = "fixMissingMember";
143561
143815
  var fixMissingProperties = "fixMissingProperties";
143562
143816
  var fixMissingAttributes = "fixMissingAttributes";
143563
143817
  var fixMissingFunctionDeclaration = "fixMissingFunctionDeclaration";
143564
- var errorCodes26 = [
143818
+ var errorCodes27 = [
143565
143819
  Diagnostics.Property_0_does_not_exist_on_type_1.code,
143566
143820
  Diagnostics.Property_0_does_not_exist_on_type_1_Did_you_mean_2.code,
143567
143821
  Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2.code,
@@ -143571,7 +143825,7 @@ var errorCodes26 = [
143571
143825
  Diagnostics.Cannot_find_name_0.code
143572
143826
  ];
143573
143827
  registerCodeFix({
143574
- errorCodes: errorCodes26,
143828
+ errorCodes: errorCodes27,
143575
143829
  getCodeActions(context) {
143576
143830
  const typeChecker = context.program.getTypeChecker();
143577
143831
  const info = getInfo7(context.sourceFile, context.span.start, context.errorCode, typeChecker, context.program);
@@ -143598,21 +143852,21 @@ registerCodeFix({
143598
143852
  },
143599
143853
  fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
143600
143854
  getAllCodeActions: (context) => {
143601
- const { program, fixId: fixId51 } = context;
143855
+ const { program, fixId: fixId52 } = context;
143602
143856
  const checker = program.getTypeChecker();
143603
143857
  const seen = /* @__PURE__ */ new Map();
143604
143858
  const typeDeclToMembers = /* @__PURE__ */ new Map();
143605
143859
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
143606
- eachDiagnostic(context, errorCodes26, (diag2) => {
143860
+ eachDiagnostic(context, errorCodes27, (diag2) => {
143607
143861
  const info = getInfo7(diag2.file, diag2.start, diag2.code, checker, context.program);
143608
143862
  if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
143609
143863
  return;
143610
143864
  }
143611
- if (fixId51 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
143865
+ if (fixId52 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
143612
143866
  addFunctionDeclaration(changes, context, info);
143613
- } else if (fixId51 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
143867
+ } else if (fixId52 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
143614
143868
  addObjectLiteralProperties(changes, context, info);
143615
- } else if (fixId51 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
143869
+ } else if (fixId52 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
143616
143870
  addJsxAttributes(changes, context, info);
143617
143871
  } else {
143618
143872
  if (info.kind === 1 /* Enum */) {
@@ -144184,17 +144438,17 @@ function findScope(node) {
144184
144438
  }
144185
144439
 
144186
144440
  // src/services/codefixes/fixAddMissingNewOperator.ts
144187
- var fixId23 = "addMissingNewOperator";
144188
- var errorCodes27 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
144441
+ var fixId24 = "addMissingNewOperator";
144442
+ var errorCodes28 = [Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new.code];
144189
144443
  registerCodeFix({
144190
- errorCodes: errorCodes27,
144444
+ errorCodes: errorCodes28,
144191
144445
  getCodeActions(context) {
144192
144446
  const { sourceFile, span } = context;
144193
144447
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingNewOperator(t, sourceFile, span));
144194
- return [createCodeFixAction(fixId23, changes, Diagnostics.Add_missing_new_operator_to_call, fixId23, Diagnostics.Add_missing_new_operator_to_all_calls)];
144448
+ return [createCodeFixAction(fixId24, changes, Diagnostics.Add_missing_new_operator_to_call, fixId24, Diagnostics.Add_missing_new_operator_to_all_calls)];
144195
144449
  },
144196
- fixIds: [fixId23],
144197
- getAllCodeActions: (context) => codeFixAll(context, errorCodes27, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
144450
+ fixIds: [fixId24],
144451
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes28, (changes, diag2) => addMissingNewOperator(changes, context.sourceFile, diag2))
144198
144452
  });
144199
144453
  function addMissingNewOperator(changes, sourceFile, span) {
144200
144454
  const call = cast(findAncestorMatchingSpan2(sourceFile, span), isCallExpression);
@@ -144214,12 +144468,12 @@ function findAncestorMatchingSpan2(sourceFile, span) {
144214
144468
  var fixName2 = "fixCannotFindModule";
144215
144469
  var fixIdInstallTypesPackage = "installTypesPackage";
144216
144470
  var errorCodeCannotFindModule = Diagnostics.Cannot_find_module_0_or_its_corresponding_type_declarations.code;
144217
- var errorCodes28 = [
144471
+ var errorCodes29 = [
144218
144472
  errorCodeCannotFindModule,
144219
144473
  Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type.code
144220
144474
  ];
144221
144475
  registerCodeFix({
144222
- errorCodes: errorCodes28,
144476
+ errorCodes: errorCodes29,
144223
144477
  getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
144224
144478
  const { host, sourceFile, span: { start: start2 } } = context;
144225
144479
  const packageName = tryGetImportedPackageName(sourceFile, start2);
@@ -144238,7 +144492,7 @@ registerCodeFix({
144238
144492
  },
144239
144493
  fixIds: [fixIdInstallTypesPackage],
144240
144494
  getAllCodeActions: (context) => {
144241
- return codeFixAll(context, errorCodes28, (_changes, diag2, commands) => {
144495
+ return codeFixAll(context, errorCodes29, (_changes, diag2, commands) => {
144242
144496
  const packageName = tryGetImportedPackageName(diag2.file, diag2.start);
144243
144497
  if (packageName === void 0)
144244
144498
  return void 0;
@@ -144273,22 +144527,22 @@ function getTypesPackageNameToInstall(packageName, host, diagCode) {
144273
144527
  }
144274
144528
 
144275
144529
  // src/services/codefixes/fixClassDoesntImplementInheritedAbstractMember.ts
144276
- var errorCodes29 = [
144530
+ var errorCodes30 = [
144277
144531
  Diagnostics.Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2.code,
144278
144532
  Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1.code
144279
144533
  ];
144280
- var fixId24 = "fixClassDoesntImplementInheritedAbstractMember";
144534
+ var fixId25 = "fixClassDoesntImplementInheritedAbstractMember";
144281
144535
  registerCodeFix({
144282
- errorCodes: errorCodes29,
144536
+ errorCodes: errorCodes30,
144283
144537
  getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
144284
144538
  const { sourceFile, span } = context;
144285
144539
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => addMissingMembers(getClass2(sourceFile, span.start), sourceFile, context, t, context.preferences));
144286
- return changes.length === 0 ? void 0 : [createCodeFixAction(fixId24, changes, Diagnostics.Implement_inherited_abstract_class, fixId24, Diagnostics.Implement_all_inherited_abstract_classes)];
144540
+ return changes.length === 0 ? void 0 : [createCodeFixAction(fixId25, changes, Diagnostics.Implement_inherited_abstract_class, fixId25, Diagnostics.Implement_all_inherited_abstract_classes)];
144287
144541
  },
144288
- fixIds: [fixId24],
144542
+ fixIds: [fixId25],
144289
144543
  getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
144290
144544
  const seenClassDeclarations = /* @__PURE__ */ new Map();
144291
- return codeFixAll(context, errorCodes29, (changes, diag2) => {
144545
+ return codeFixAll(context, errorCodes30, (changes, diag2) => {
144292
144546
  const classDeclaration = getClass2(diag2.file, diag2.start);
144293
144547
  if (addToSeen(seenClassDeclarations, getNodeId(classDeclaration))) {
144294
144548
  addMissingMembers(classDeclaration, context.sourceFile, context, changes, context.preferences);
@@ -144315,35 +144569,35 @@ function symbolPointsToNonPrivateAndAbstractMember(symbol) {
144315
144569
  }
144316
144570
 
144317
144571
  // src/services/codefixes/fixClassSuperMustPrecedeThisAccess.ts
144318
- var fixId25 = "classSuperMustPrecedeThisAccess";
144319
- var errorCodes30 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
144572
+ var fixId26 = "classSuperMustPrecedeThisAccess";
144573
+ var errorCodes31 = [Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class.code];
144320
144574
  registerCodeFix({
144321
- errorCodes: errorCodes30,
144575
+ errorCodes: errorCodes31,
144322
144576
  getCodeActions(context) {
144323
144577
  const { sourceFile, span } = context;
144324
144578
  const nodes = getNodes(sourceFile, span.start);
144325
144579
  if (!nodes)
144326
144580
  return void 0;
144327
144581
  const { constructor, superCall } = nodes;
144328
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange10(t, sourceFile, constructor, superCall));
144329
- 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)];
144582
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange12(t, sourceFile, constructor, superCall));
144583
+ 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)];
144330
144584
  },
144331
- fixIds: [fixId25],
144585
+ fixIds: [fixId26],
144332
144586
  getAllCodeActions(context) {
144333
144587
  const { sourceFile } = context;
144334
144588
  const seenClasses = /* @__PURE__ */ new Map();
144335
- return codeFixAll(context, errorCodes30, (changes, diag2) => {
144589
+ return codeFixAll(context, errorCodes31, (changes, diag2) => {
144336
144590
  const nodes = getNodes(diag2.file, diag2.start);
144337
144591
  if (!nodes)
144338
144592
  return;
144339
144593
  const { constructor, superCall } = nodes;
144340
144594
  if (addToSeen(seenClasses, getNodeId(constructor.parent))) {
144341
- doChange10(changes, sourceFile, constructor, superCall);
144595
+ doChange12(changes, sourceFile, constructor, superCall);
144342
144596
  }
144343
144597
  });
144344
144598
  }
144345
144599
  });
144346
- function doChange10(changes, sourceFile, constructor, superCall) {
144600
+ function doChange12(changes, sourceFile, constructor, superCall) {
144347
144601
  changes.insertNodeAtConstructorStart(sourceFile, constructor, superCall);
144348
144602
  changes.delete(sourceFile, superCall);
144349
144603
  }
@@ -144360,25 +144614,25 @@ function findSuperCall(n) {
144360
144614
  }
144361
144615
 
144362
144616
  // src/services/codefixes/fixConstructorForDerivedNeedSuperCall.ts
144363
- var fixId26 = "constructorForDerivedNeedSuperCall";
144364
- var errorCodes31 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
144617
+ var fixId27 = "constructorForDerivedNeedSuperCall";
144618
+ var errorCodes32 = [Diagnostics.Constructors_for_derived_classes_must_contain_a_super_call.code];
144365
144619
  registerCodeFix({
144366
- errorCodes: errorCodes31,
144620
+ errorCodes: errorCodes32,
144367
144621
  getCodeActions(context) {
144368
144622
  const { sourceFile, span } = context;
144369
144623
  const ctr = getNode(sourceFile, span.start);
144370
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange11(t, sourceFile, ctr));
144371
- return [createCodeFixAction(fixId26, changes, Diagnostics.Add_missing_super_call, fixId26, Diagnostics.Add_all_missing_super_calls)];
144624
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, ctr));
144625
+ return [createCodeFixAction(fixId27, changes, Diagnostics.Add_missing_super_call, fixId27, Diagnostics.Add_all_missing_super_calls)];
144372
144626
  },
144373
- fixIds: [fixId26],
144374
- getAllCodeActions: (context) => codeFixAll(context, errorCodes31, (changes, diag2) => doChange11(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
144627
+ fixIds: [fixId27],
144628
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes, diag2) => doChange13(changes, context.sourceFile, getNode(diag2.file, diag2.start)))
144375
144629
  });
144376
144630
  function getNode(sourceFile, pos) {
144377
144631
  const token = getTokenAtPosition(sourceFile, pos);
144378
144632
  Debug.assert(isConstructorDeclaration(token.parent), "token should be at the constructor declaration");
144379
144633
  return token.parent;
144380
144634
  }
144381
- function doChange11(changes, sourceFile, ctr) {
144635
+ function doChange13(changes, sourceFile, ctr) {
144382
144636
  const superCall = factory.createExpressionStatement(factory.createCallExpression(
144383
144637
  factory.createSuper(),
144384
144638
  /*typeArguments*/
@@ -144391,9 +144645,9 @@ function doChange11(changes, sourceFile, ctr) {
144391
144645
 
144392
144646
  // src/services/codefixes/fixEnableJsxFlag.ts
144393
144647
  var fixID = "fixEnableJsxFlag";
144394
- var errorCodes32 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
144648
+ var errorCodes33 = [Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
144395
144649
  registerCodeFix({
144396
- errorCodes: errorCodes32,
144650
+ errorCodes: errorCodes33,
144397
144651
  getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
144398
144652
  const { configFile } = context.program.getCompilerOptions();
144399
144653
  if (configFile === void 0) {
@@ -144401,47 +144655,47 @@ registerCodeFix({
144401
144655
  }
144402
144656
  const changes = ts_textChanges_exports.ChangeTracker.with(
144403
144657
  context,
144404
- (changeTracker) => doChange12(changeTracker, configFile)
144658
+ (changeTracker) => doChange14(changeTracker, configFile)
144405
144659
  );
144406
144660
  return [
144407
144661
  createCodeFixActionWithoutFixAll(fixID, changes, Diagnostics.Enable_the_jsx_flag_in_your_configuration_file)
144408
144662
  ];
144409
144663
  },
144410
144664
  fixIds: [fixID],
144411
- getAllCodeActions: (context) => codeFixAll(context, errorCodes32, (changes) => {
144665
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes33, (changes) => {
144412
144666
  const { configFile } = context.program.getCompilerOptions();
144413
144667
  if (configFile === void 0) {
144414
144668
  return void 0;
144415
144669
  }
144416
- doChange12(changes, configFile);
144670
+ doChange14(changes, configFile);
144417
144671
  })
144418
144672
  });
144419
- function doChange12(changeTracker, configFile) {
144673
+ function doChange14(changeTracker, configFile) {
144420
144674
  setJsonCompilerOptionValue(changeTracker, configFile, "jsx", factory.createStringLiteral("react"));
144421
144675
  }
144422
144676
 
144423
144677
  // src/services/codefixes/fixNaNEquality.ts
144424
- var fixId27 = "fixNaNEquality";
144425
- var errorCodes33 = [
144678
+ var fixId28 = "fixNaNEquality";
144679
+ var errorCodes34 = [
144426
144680
  Diagnostics.This_condition_will_always_return_0.code
144427
144681
  ];
144428
144682
  registerCodeFix({
144429
- errorCodes: errorCodes33,
144683
+ errorCodes: errorCodes34,
144430
144684
  getCodeActions(context) {
144431
144685
  const { sourceFile, span, program } = context;
144432
144686
  const info = getInfo8(program, sourceFile, span);
144433
144687
  if (info === void 0)
144434
144688
  return;
144435
144689
  const { suggestion, expression, arg } = info;
144436
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange13(t, sourceFile, arg, expression));
144437
- return [createCodeFixAction(fixId27, changes, [Diagnostics.Use_0, suggestion], fixId27, Diagnostics.Use_Number_isNaN_in_all_conditions)];
144690
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, arg, expression));
144691
+ return [createCodeFixAction(fixId28, changes, [Diagnostics.Use_0, suggestion], fixId28, Diagnostics.Use_Number_isNaN_in_all_conditions)];
144438
144692
  },
144439
- fixIds: [fixId27],
144693
+ fixIds: [fixId28],
144440
144694
  getAllCodeActions: (context) => {
144441
- return codeFixAll(context, errorCodes33, (changes, diag2) => {
144695
+ return codeFixAll(context, errorCodes34, (changes, diag2) => {
144442
144696
  const info = getInfo8(context.program, diag2.file, createTextSpan(diag2.start, diag2.length));
144443
144697
  if (info) {
144444
- doChange13(changes, diag2.file, info.arg, info.expression);
144698
+ doChange15(changes, diag2.file, info.arg, info.expression);
144445
144699
  }
144446
144700
  });
144447
144701
  }
@@ -144461,7 +144715,7 @@ function getInfo8(program, sourceFile, span) {
144461
144715
  }
144462
144716
  return void 0;
144463
144717
  }
144464
- function doChange13(changes, sourceFile, arg, expression) {
144718
+ function doChange15(changes, sourceFile, arg, expression) {
144465
144719
  const callExpression = factory.createCallExpression(
144466
144720
  factory.createPropertyAccessExpression(factory.createIdentifier("Number"), factory.createIdentifier("isNaN")),
144467
144721
  /*typeArguments*/
@@ -144521,22 +144775,22 @@ registerCodeFix({
144521
144775
  });
144522
144776
 
144523
144777
  // src/services/codefixes/fixPropertyAssignment.ts
144524
- var fixId28 = "fixPropertyAssignment";
144525
- var errorCodes34 = [
144778
+ var fixId29 = "fixPropertyAssignment";
144779
+ var errorCodes35 = [
144526
144780
  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
144527
144781
  ];
144528
144782
  registerCodeFix({
144529
- errorCodes: errorCodes34,
144530
- fixIds: [fixId28],
144783
+ errorCodes: errorCodes35,
144784
+ fixIds: [fixId29],
144531
144785
  getCodeActions(context) {
144532
144786
  const { sourceFile, span } = context;
144533
144787
  const property = getProperty2(sourceFile, span.start);
144534
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange14(t, context.sourceFile, property));
144535
- return [createCodeFixAction(fixId28, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId28, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
144788
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(t, context.sourceFile, property));
144789
+ return [createCodeFixAction(fixId29, changes, [Diagnostics.Change_0_to_1, "=", ":"], fixId29, [Diagnostics.Switch_each_misused_0_to_1, "=", ":"])];
144536
144790
  },
144537
- getAllCodeActions: (context) => codeFixAll(context, errorCodes34, (changes, diag2) => doChange14(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
144791
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => doChange16(changes, diag2.file, getProperty2(diag2.file, diag2.start)))
144538
144792
  });
144539
- function doChange14(changes, sourceFile, node) {
144793
+ function doChange16(changes, sourceFile, node) {
144540
144794
  changes.replaceNode(sourceFile, node, factory.createPropertyAssignment(node.name, node.objectAssignmentInitializer));
144541
144795
  }
144542
144796
  function getProperty2(sourceFile, pos) {
@@ -144544,10 +144798,10 @@ function getProperty2(sourceFile, pos) {
144544
144798
  }
144545
144799
 
144546
144800
  // src/services/codefixes/fixExtendsInterfaceBecomesImplements.ts
144547
- var fixId29 = "extendsInterfaceBecomesImplements";
144548
- var errorCodes35 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
144801
+ var fixId30 = "extendsInterfaceBecomesImplements";
144802
+ var errorCodes36 = [Diagnostics.Cannot_extend_an_interface_0_Did_you_mean_implements.code];
144549
144803
  registerCodeFix({
144550
- errorCodes: errorCodes35,
144804
+ errorCodes: errorCodes36,
144551
144805
  getCodeActions(context) {
144552
144806
  const { sourceFile } = context;
144553
144807
  const nodes = getNodes2(sourceFile, context.span.start);
@@ -144555,10 +144809,10 @@ registerCodeFix({
144555
144809
  return void 0;
144556
144810
  const { extendsToken, heritageClauses } = nodes;
144557
144811
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChanges2(t, sourceFile, extendsToken, heritageClauses));
144558
- return [createCodeFixAction(fixId29, changes, Diagnostics.Change_extends_to_implements, fixId29, Diagnostics.Change_all_extended_interfaces_to_implements)];
144812
+ return [createCodeFixAction(fixId30, changes, Diagnostics.Change_extends_to_implements, fixId30, Diagnostics.Change_all_extended_interfaces_to_implements)];
144559
144813
  },
144560
- fixIds: [fixId29],
144561
- getAllCodeActions: (context) => codeFixAll(context, errorCodes35, (changes, diag2) => {
144814
+ fixIds: [fixId30],
144815
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
144562
144816
  const nodes = getNodes2(diag2.file, diag2.start);
144563
144817
  if (nodes)
144564
144818
  doChanges2(changes, diag2.file, nodes.extendsToken, nodes.heritageClauses);
@@ -144586,29 +144840,29 @@ function doChanges2(changes, sourceFile, extendsToken, heritageClauses) {
144586
144840
  }
144587
144841
 
144588
144842
  // src/services/codefixes/fixForgottenThisPropertyAccess.ts
144589
- var fixId30 = "forgottenThisPropertyAccess";
144843
+ var fixId31 = "forgottenThisPropertyAccess";
144590
144844
  var didYouMeanStaticMemberCode = Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0.code;
144591
- var errorCodes36 = [
144845
+ var errorCodes37 = [
144592
144846
  Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0.code,
144593
144847
  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,
144594
144848
  didYouMeanStaticMemberCode
144595
144849
  ];
144596
144850
  registerCodeFix({
144597
- errorCodes: errorCodes36,
144851
+ errorCodes: errorCodes37,
144598
144852
  getCodeActions(context) {
144599
144853
  const { sourceFile } = context;
144600
144854
  const info = getInfo9(sourceFile, context.span.start, context.errorCode);
144601
144855
  if (!info) {
144602
144856
  return void 0;
144603
144857
  }
144604
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange15(t, sourceFile, info));
144605
- 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)];
144858
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, sourceFile, info));
144859
+ 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)];
144606
144860
  },
144607
- fixIds: [fixId30],
144608
- getAllCodeActions: (context) => codeFixAll(context, errorCodes36, (changes, diag2) => {
144861
+ fixIds: [fixId31],
144862
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes37, (changes, diag2) => {
144609
144863
  const info = getInfo9(diag2.file, diag2.start, diag2.code);
144610
144864
  if (info)
144611
- doChange15(changes, context.sourceFile, info);
144865
+ doChange17(changes, context.sourceFile, info);
144612
144866
  })
144613
144867
  });
144614
144868
  function getInfo9(sourceFile, pos, diagCode) {
@@ -144617,7 +144871,7 @@ function getInfo9(sourceFile, pos, diagCode) {
144617
144871
  return { node, className: diagCode === didYouMeanStaticMemberCode ? getContainingClass(node).name.text : void 0 };
144618
144872
  }
144619
144873
  }
144620
- function doChange15(changes, sourceFile, { node, className }) {
144874
+ function doChange17(changes, sourceFile, { node, className }) {
144621
144875
  suppressLeadingAndTrailingTrivia(node);
144622
144876
  changes.replaceNode(sourceFile, node, factory.createPropertyAccessExpression(className ? factory.createIdentifier(className) : factory.createThis(), node));
144623
144877
  }
@@ -144625,16 +144879,16 @@ function doChange15(changes, sourceFile, { node, className }) {
144625
144879
  // src/services/codefixes/fixInvalidJsxCharacters.ts
144626
144880
  var fixIdExpression = "fixInvalidJsxCharacters_expression";
144627
144881
  var fixIdHtmlEntity = "fixInvalidJsxCharacters_htmlEntity";
144628
- var errorCodes37 = [
144882
+ var errorCodes38 = [
144629
144883
  Diagnostics.Unexpected_token_Did_you_mean_or_gt.code,
144630
144884
  Diagnostics.Unexpected_token_Did_you_mean_or_rbrace.code
144631
144885
  ];
144632
144886
  registerCodeFix({
144633
- errorCodes: errorCodes37,
144887
+ errorCodes: errorCodes38,
144634
144888
  fixIds: [fixIdExpression, fixIdHtmlEntity],
144635
144889
  getCodeActions(context) {
144636
144890
  const { sourceFile, preferences, span } = context;
144637
- const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(
144891
+ const changeToExpression = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
144638
144892
  t,
144639
144893
  preferences,
144640
144894
  sourceFile,
@@ -144642,7 +144896,7 @@ registerCodeFix({
144642
144896
  /* useHtmlEntity */
144643
144897
  false
144644
144898
  ));
144645
- const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange16(
144899
+ const changeToHtmlEntity = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(
144646
144900
  t,
144647
144901
  preferences,
144648
144902
  sourceFile,
@@ -144656,7 +144910,7 @@ registerCodeFix({
144656
144910
  ];
144657
144911
  },
144658
144912
  getAllCodeActions(context) {
144659
- return codeFixAll(context, errorCodes37, (changes, diagnostic) => doChange16(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
144913
+ return codeFixAll(context, errorCodes38, (changes, diagnostic) => doChange18(changes, context.preferences, diagnostic.file, diagnostic.start, context.fixId === fixIdHtmlEntity));
144660
144914
  }
144661
144915
  });
144662
144916
  var htmlEntity = {
@@ -144666,7 +144920,7 @@ var htmlEntity = {
144666
144920
  function isValidCharacter(character) {
144667
144921
  return hasProperty(htmlEntity, character);
144668
144922
  }
144669
- function doChange16(changes, preferences, sourceFile, start2, useHtmlEntity) {
144923
+ function doChange18(changes, preferences, sourceFile, start2, useHtmlEntity) {
144670
144924
  const character = sourceFile.getText()[start2];
144671
144925
  if (!isValidCharacter(character)) {
144672
144926
  return;
@@ -144678,12 +144932,12 @@ function doChange16(changes, preferences, sourceFile, start2, useHtmlEntity) {
144678
144932
  // src/services/codefixes/fixUnmatchedParameter.ts
144679
144933
  var deleteUnmatchedParameter = "deleteUnmatchedParameter";
144680
144934
  var renameUnmatchedParameter = "renameUnmatchedParameter";
144681
- var errorCodes38 = [
144935
+ var errorCodes39 = [
144682
144936
  Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name.code
144683
144937
  ];
144684
144938
  registerCodeFix({
144685
144939
  fixIds: [deleteUnmatchedParameter, renameUnmatchedParameter],
144686
- errorCodes: errorCodes38,
144940
+ errorCodes: errorCodes39,
144687
144941
  getCodeActions: function getCodeActionsToFixUnmatchedParameter(context) {
144688
144942
  const { sourceFile, span } = context;
144689
144943
  const actions2 = [];
@@ -144698,7 +144952,7 @@ registerCodeFix({
144698
144952
  getAllCodeActions: function getAllCodeActionsToFixUnmatchedParameter(context) {
144699
144953
  const tagsToSignature = /* @__PURE__ */ new Map();
144700
144954
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
144701
- eachDiagnostic(context, errorCodes38, ({ file, start: start2 }) => {
144955
+ eachDiagnostic(context, errorCodes39, ({ file, start: start2 }) => {
144702
144956
  const info = getInfo10(file, start2);
144703
144957
  if (info) {
144704
144958
  tagsToSignature.set(info.signature, append(tagsToSignature.get(info.signature), info.jsDocParameterTag));
@@ -144763,10 +145017,10 @@ function getInfo10(sourceFile, pos) {
144763
145017
  }
144764
145018
 
144765
145019
  // src/services/codefixes/fixUnreferenceableDecoratorMetadata.ts
144766
- var fixId31 = "fixUnreferenceableDecoratorMetadata";
144767
- var errorCodes39 = [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];
145020
+ var fixId32 = "fixUnreferenceableDecoratorMetadata";
145021
+ var 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];
144768
145022
  registerCodeFix({
144769
- errorCodes: errorCodes39,
145023
+ errorCodes: errorCodes40,
144770
145024
  getCodeActions: (context) => {
144771
145025
  const importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start);
144772
145026
  if (!importDeclaration)
@@ -144775,14 +145029,14 @@ registerCodeFix({
144775
145029
  const typeOnlyChanges = ts_textChanges_exports.ChangeTracker.with(context, (t) => doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program));
144776
145030
  let actions2;
144777
145031
  if (namespaceChanges.length) {
144778
- actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId31, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
145032
+ actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, namespaceChanges, Diagnostics.Convert_named_imports_to_namespace_import));
144779
145033
  }
144780
145034
  if (typeOnlyChanges.length) {
144781
- actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId31, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
145035
+ actions2 = append(actions2, createCodeFixActionWithoutFixAll(fixId32, typeOnlyChanges, Diagnostics.Convert_to_type_only_import));
144782
145036
  }
144783
145037
  return actions2;
144784
145038
  },
144785
- fixIds: [fixId31]
145039
+ fixIds: [fixId32]
144786
145040
  });
144787
145041
  function getImportDeclaration(sourceFile, program, start2) {
144788
145042
  const identifier = tryCast(getTokenAtPosition(sourceFile, start2), isIdentifier);
@@ -144821,7 +145075,7 @@ var fixIdPrefix = "unusedIdentifier_prefix";
144821
145075
  var fixIdDelete = "unusedIdentifier_delete";
144822
145076
  var fixIdDeleteImports = "unusedIdentifier_deleteImports";
144823
145077
  var fixIdInfer = "unusedIdentifier_infer";
144824
- var errorCodes40 = [
145078
+ var errorCodes41 = [
144825
145079
  Diagnostics._0_is_declared_but_its_value_is_never_read.code,
144826
145080
  Diagnostics._0_is_declared_but_never_used.code,
144827
145081
  Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code,
@@ -144831,7 +145085,7 @@ var errorCodes40 = [
144831
145085
  Diagnostics.All_type_parameters_are_unused.code
144832
145086
  ];
144833
145087
  registerCodeFix({
144834
- errorCodes: errorCodes40,
145088
+ errorCodes: errorCodes41,
144835
145089
  getCodeActions(context) {
144836
145090
  const { errorCode, sourceFile, program, cancellationToken } = context;
144837
145091
  const checker = program.getTypeChecker();
@@ -144917,7 +145171,7 @@ registerCodeFix({
144917
145171
  const { sourceFile, program, cancellationToken } = context;
144918
145172
  const checker = program.getTypeChecker();
144919
145173
  const sourceFiles = program.getSourceFiles();
144920
- return codeFixAll(context, errorCodes40, (changes, diag2) => {
145174
+ return codeFixAll(context, errorCodes41, (changes, diag2) => {
144921
145175
  const token = getTokenAtPosition(sourceFile, diag2.start);
144922
145176
  switch (context.fixId) {
144923
145177
  case fixIdPrefix:
@@ -145134,21 +145388,21 @@ function mayDeleteExpression(node) {
145134
145388
  }
145135
145389
 
145136
145390
  // src/services/codefixes/fixUnreachableCode.ts
145137
- var fixId32 = "fixUnreachableCode";
145138
- var errorCodes41 = [Diagnostics.Unreachable_code_detected.code];
145391
+ var fixId33 = "fixUnreachableCode";
145392
+ var errorCodes42 = [Diagnostics.Unreachable_code_detected.code];
145139
145393
  registerCodeFix({
145140
- errorCodes: errorCodes41,
145394
+ errorCodes: errorCodes42,
145141
145395
  getCodeActions(context) {
145142
145396
  const syntacticDiagnostics = context.program.getSyntacticDiagnostics(context.sourceFile, context.cancellationToken);
145143
145397
  if (syntacticDiagnostics.length)
145144
145398
  return;
145145
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange17(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
145146
- return [createCodeFixAction(fixId32, changes, Diagnostics.Remove_unreachable_code, fixId32, Diagnostics.Remove_all_unreachable_code)];
145399
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, context.sourceFile, context.span.start, context.span.length, context.errorCode));
145400
+ return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unreachable_code, fixId33, Diagnostics.Remove_all_unreachable_code)];
145147
145401
  },
145148
- fixIds: [fixId32],
145149
- getAllCodeActions: (context) => codeFixAll(context, errorCodes41, (changes, diag2) => doChange17(changes, diag2.file, diag2.start, diag2.length, diag2.code))
145402
+ fixIds: [fixId33],
145403
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange19(changes, diag2.file, diag2.start, diag2.length, diag2.code))
145150
145404
  });
145151
- function doChange17(changes, sourceFile, start2, length2, errorCode) {
145405
+ function doChange19(changes, sourceFile, start2, length2, errorCode) {
145152
145406
  const token = getTokenAtPosition(sourceFile, start2);
145153
145407
  const statement = findAncestor(token, isStatement);
145154
145408
  if (statement.getStart(sourceFile) !== token.getStart(sourceFile)) {
@@ -145198,18 +145452,18 @@ function lastWhere(a, pred) {
145198
145452
  }
145199
145453
 
145200
145454
  // src/services/codefixes/fixUnusedLabel.ts
145201
- var fixId33 = "fixUnusedLabel";
145202
- var errorCodes42 = [Diagnostics.Unused_label.code];
145455
+ var fixId34 = "fixUnusedLabel";
145456
+ var errorCodes43 = [Diagnostics.Unused_label.code];
145203
145457
  registerCodeFix({
145204
- errorCodes: errorCodes42,
145458
+ errorCodes: errorCodes43,
145205
145459
  getCodeActions(context) {
145206
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange18(t, context.sourceFile, context.span.start));
145207
- return [createCodeFixAction(fixId33, changes, Diagnostics.Remove_unused_label, fixId33, Diagnostics.Remove_all_unused_labels)];
145460
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, context.span.start));
145461
+ return [createCodeFixAction(fixId34, changes, Diagnostics.Remove_unused_label, fixId34, Diagnostics.Remove_all_unused_labels)];
145208
145462
  },
145209
- fixIds: [fixId33],
145210
- getAllCodeActions: (context) => codeFixAll(context, errorCodes42, (changes, diag2) => doChange18(changes, diag2.file, diag2.start))
145463
+ fixIds: [fixId34],
145464
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes43, (changes, diag2) => doChange20(changes, diag2.file, diag2.start))
145211
145465
  });
145212
- function doChange18(changes, sourceFile, start2) {
145466
+ function doChange20(changes, sourceFile, start2) {
145213
145467
  const token = getTokenAtPosition(sourceFile, start2);
145214
145468
  const labeledStatement = cast(token.parent, isLabeledStatement);
145215
145469
  const pos = token.getStart(sourceFile);
@@ -145226,13 +145480,13 @@ function doChange18(changes, sourceFile, start2) {
145226
145480
  // src/services/codefixes/fixJSDocTypes.ts
145227
145481
  var fixIdPlain = "fixJSDocTypes_plain";
145228
145482
  var fixIdNullable = "fixJSDocTypes_nullable";
145229
- var errorCodes43 = [
145483
+ var errorCodes44 = [
145230
145484
  Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code,
145231
145485
  Diagnostics._0_at_the_end_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code,
145232
145486
  Diagnostics._0_at_the_start_of_a_type_is_not_valid_TypeScript_syntax_Did_you_mean_to_write_1.code
145233
145487
  ];
145234
145488
  registerCodeFix({
145235
- errorCodes: errorCodes43,
145489
+ errorCodes: errorCodes44,
145236
145490
  getCodeActions(context) {
145237
145491
  const { sourceFile } = context;
145238
145492
  const checker = context.program.getTypeChecker();
@@ -145246,26 +145500,26 @@ registerCodeFix({
145246
145500
  actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
145247
145501
  }
145248
145502
  return actions2;
145249
- function fix(type2, fixId51, fixAllDescription) {
145250
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange19(t, sourceFile, typeNode, type2, checker));
145251
- return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId51, fixAllDescription);
145503
+ function fix(type2, fixId52, fixAllDescription) {
145504
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, typeNode, type2, checker));
145505
+ return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId52, fixAllDescription);
145252
145506
  }
145253
145507
  },
145254
145508
  fixIds: [fixIdPlain, fixIdNullable],
145255
145509
  getAllCodeActions(context) {
145256
- const { fixId: fixId51, program, sourceFile } = context;
145510
+ const { fixId: fixId52, program, sourceFile } = context;
145257
145511
  const checker = program.getTypeChecker();
145258
- return codeFixAll(context, errorCodes43, (changes, err) => {
145512
+ return codeFixAll(context, errorCodes44, (changes, err) => {
145259
145513
  const info = getInfo11(err.file, err.start, checker);
145260
145514
  if (!info)
145261
145515
  return;
145262
145516
  const { typeNode, type } = info;
145263
- const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId51 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
145264
- doChange19(changes, sourceFile, typeNode, fixedType, checker);
145517
+ const fixedType = typeNode.kind === 317 /* JSDocNullableType */ && fixId52 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
145518
+ doChange21(changes, sourceFile, typeNode, fixedType, checker);
145265
145519
  });
145266
145520
  }
145267
145521
  });
145268
- function doChange19(changes, sourceFile, oldTypeNode, newType, checker) {
145522
+ function doChange21(changes, sourceFile, oldTypeNode, newType, checker) {
145269
145523
  changes.replaceNode(sourceFile, oldTypeNode, checker.typeToTypeNode(
145270
145524
  newType,
145271
145525
  /*enclosingDeclaration*/
@@ -145316,28 +145570,28 @@ function getType(checker, node) {
145316
145570
  }
145317
145571
 
145318
145572
  // src/services/codefixes/fixMissingCallParentheses.ts
145319
- var fixId34 = "fixMissingCallParentheses";
145320
- var errorCodes44 = [
145573
+ var fixId35 = "fixMissingCallParentheses";
145574
+ var errorCodes45 = [
145321
145575
  Diagnostics.This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_instead.code
145322
145576
  ];
145323
145577
  registerCodeFix({
145324
- errorCodes: errorCodes44,
145325
- fixIds: [fixId34],
145578
+ errorCodes: errorCodes45,
145579
+ fixIds: [fixId35],
145326
145580
  getCodeActions(context) {
145327
145581
  const { sourceFile, span } = context;
145328
145582
  const callName = getCallName(sourceFile, span.start);
145329
145583
  if (!callName)
145330
145584
  return;
145331
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange20(t, context.sourceFile, callName));
145332
- return [createCodeFixAction(fixId34, changes, Diagnostics.Add_missing_call_parentheses, fixId34, Diagnostics.Add_all_missing_call_parentheses)];
145585
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange22(t, context.sourceFile, callName));
145586
+ return [createCodeFixAction(fixId35, changes, Diagnostics.Add_missing_call_parentheses, fixId35, Diagnostics.Add_all_missing_call_parentheses)];
145333
145587
  },
145334
- getAllCodeActions: (context) => codeFixAll(context, errorCodes44, (changes, diag2) => {
145588
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes45, (changes, diag2) => {
145335
145589
  const callName = getCallName(diag2.file, diag2.start);
145336
145590
  if (callName)
145337
- doChange20(changes, diag2.file, callName);
145591
+ doChange22(changes, diag2.file, callName);
145338
145592
  })
145339
145593
  });
145340
- function doChange20(changes, sourceFile, name) {
145594
+ function doChange22(changes, sourceFile, name) {
145341
145595
  changes.replaceNodeWithText(sourceFile, name, `${name.text}()`);
145342
145596
  }
145343
145597
  function getCallName(sourceFile, start2) {
@@ -145356,30 +145610,30 @@ function getCallName(sourceFile, start2) {
145356
145610
  }
145357
145611
 
145358
145612
  // src/services/codefixes/fixAwaitInSyncFunction.ts
145359
- var fixId35 = "fixAwaitInSyncFunction";
145360
- var errorCodes45 = [
145613
+ var fixId36 = "fixAwaitInSyncFunction";
145614
+ var errorCodes46 = [
145361
145615
  Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
145362
145616
  Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
145363
145617
  Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function.code
145364
145618
  ];
145365
145619
  registerCodeFix({
145366
- errorCodes: errorCodes45,
145620
+ errorCodes: errorCodes46,
145367
145621
  getCodeActions(context) {
145368
145622
  const { sourceFile, span } = context;
145369
145623
  const nodes = getNodes3(sourceFile, span.start);
145370
145624
  if (!nodes)
145371
145625
  return void 0;
145372
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange21(t, sourceFile, nodes));
145373
- return [createCodeFixAction(fixId35, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId35, Diagnostics.Add_all_missing_async_modifiers)];
145626
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange23(t, sourceFile, nodes));
145627
+ return [createCodeFixAction(fixId36, changes, Diagnostics.Add_async_modifier_to_containing_function, fixId36, Diagnostics.Add_all_missing_async_modifiers)];
145374
145628
  },
145375
- fixIds: [fixId35],
145629
+ fixIds: [fixId36],
145376
145630
  getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
145377
145631
  const seen = /* @__PURE__ */ new Map();
145378
- return codeFixAll(context, errorCodes45, (changes, diag2) => {
145632
+ return codeFixAll(context, errorCodes46, (changes, diag2) => {
145379
145633
  const nodes = getNodes3(diag2.file, diag2.start);
145380
145634
  if (!nodes || !addToSeen(seen, getNodeId(nodes.insertBefore)))
145381
145635
  return;
145382
- doChange21(changes, context.sourceFile, nodes);
145636
+ doChange23(changes, context.sourceFile, nodes);
145383
145637
  });
145384
145638
  }
145385
145639
  });
@@ -145418,7 +145672,7 @@ function getNodes3(sourceFile, start2) {
145418
145672
  returnType: getReturnType(containingFunction)
145419
145673
  };
145420
145674
  }
145421
- function doChange21(changes, sourceFile, { insertBefore, returnType }) {
145675
+ function doChange23(changes, sourceFile, { insertBefore, returnType }) {
145422
145676
  if (returnType) {
145423
145677
  const entityName = getEntityNameFromTypeNode(returnType);
145424
145678
  if (!entityName || entityName.kind !== 79 /* Identifier */ || entityName.text !== "Promise") {
@@ -145429,22 +145683,22 @@ function doChange21(changes, sourceFile, { insertBefore, returnType }) {
145429
145683
  }
145430
145684
 
145431
145685
  // src/services/codefixes/fixPropertyOverrideAccessor.ts
145432
- var errorCodes46 = [
145686
+ var errorCodes47 = [
145433
145687
  Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code,
145434
145688
  Diagnostics._0_is_defined_as_a_property_in_class_1_but_is_overridden_here_in_2_as_an_accessor.code
145435
145689
  ];
145436
- var fixId36 = "fixPropertyOverrideAccessor";
145690
+ var fixId37 = "fixPropertyOverrideAccessor";
145437
145691
  registerCodeFix({
145438
- errorCodes: errorCodes46,
145692
+ errorCodes: errorCodes47,
145439
145693
  getCodeActions(context) {
145440
- const edits = doChange22(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
145694
+ const edits = doChange24(context.sourceFile, context.span.start, context.span.length, context.errorCode, context);
145441
145695
  if (edits) {
145442
- return [createCodeFixAction(fixId36, edits, Diagnostics.Generate_get_and_set_accessors, fixId36, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
145696
+ return [createCodeFixAction(fixId37, edits, Diagnostics.Generate_get_and_set_accessors, fixId37, Diagnostics.Generate_get_and_set_accessors_for_all_overriding_properties)];
145443
145697
  }
145444
145698
  },
145445
- fixIds: [fixId36],
145446
- getAllCodeActions: (context) => codeFixAll(context, errorCodes46, (changes, diag2) => {
145447
- const edits = doChange22(diag2.file, diag2.start, diag2.length, diag2.code, context);
145699
+ fixIds: [fixId37],
145700
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes47, (changes, diag2) => {
145701
+ const edits = doChange24(diag2.file, diag2.start, diag2.length, diag2.code, context);
145448
145702
  if (edits) {
145449
145703
  for (const edit of edits) {
145450
145704
  changes.pushRaw(context.sourceFile, edit);
@@ -145452,7 +145706,7 @@ registerCodeFix({
145452
145706
  }
145453
145707
  })
145454
145708
  });
145455
- function doChange22(file, start2, length2, code, context) {
145709
+ function doChange24(file, start2, length2, code, context) {
145456
145710
  let startPosition;
145457
145711
  let endPosition;
145458
145712
  if (code === Diagnostics._0_is_defined_as_an_accessor_in_class_1_but_is_overridden_here_in_2_as_an_instance_property.code) {
@@ -145481,8 +145735,8 @@ function doChange22(file, start2, length2, code, context) {
145481
145735
  }
145482
145736
 
145483
145737
  // src/services/codefixes/inferFromUsage.ts
145484
- var fixId37 = "inferFromUsage";
145485
- var errorCodes47 = [
145738
+ var fixId38 = "inferFromUsage";
145739
+ var errorCodes48 = [
145486
145740
  // Variable declarations
145487
145741
  Diagnostics.Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined.code,
145488
145742
  // Variable uses
@@ -145516,13 +145770,13 @@ var errorCodes47 = [
145516
145770
  Diagnostics.this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation.code
145517
145771
  ];
145518
145772
  registerCodeFix({
145519
- errorCodes: errorCodes47,
145773
+ errorCodes: errorCodes48,
145520
145774
  getCodeActions(context) {
145521
145775
  const { sourceFile, program, span: { start: start2 }, errorCode, cancellationToken, host, preferences } = context;
145522
145776
  const token = getTokenAtPosition(sourceFile, start2);
145523
145777
  let declaration;
145524
145778
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => {
145525
- declaration = doChange23(
145779
+ declaration = doChange25(
145526
145780
  changes2,
145527
145781
  sourceFile,
145528
145782
  token,
@@ -145536,14 +145790,14 @@ registerCodeFix({
145536
145790
  );
145537
145791
  });
145538
145792
  const name = declaration && getNameOfDeclaration(declaration);
145539
- return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId37, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId37, Diagnostics.Infer_all_types_from_usage)];
145793
+ return !name || changes.length === 0 ? void 0 : [createCodeFixAction(fixId38, changes, [getDiagnostic(errorCode, token), getTextOfNode(name)], fixId38, Diagnostics.Infer_all_types_from_usage)];
145540
145794
  },
145541
- fixIds: [fixId37],
145795
+ fixIds: [fixId38],
145542
145796
  getAllCodeActions(context) {
145543
145797
  const { sourceFile, program, cancellationToken, host, preferences } = context;
145544
145798
  const markSeen = nodeSeenTracker();
145545
- return codeFixAll(context, errorCodes47, (changes, err) => {
145546
- doChange23(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
145799
+ return codeFixAll(context, errorCodes48, (changes, err) => {
145800
+ doChange25(changes, sourceFile, getTokenAtPosition(err.file, err.start), err.code, program, cancellationToken, markSeen, host, preferences);
145547
145801
  });
145548
145802
  }
145549
145803
  });
@@ -145582,7 +145836,7 @@ function mapSuggestionDiagnostic(errorCode) {
145582
145836
  }
145583
145837
  return errorCode;
145584
145838
  }
145585
- function doChange23(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
145839
+ function doChange25(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host, preferences) {
145586
145840
  if (!isParameterPropertyModifier(token.kind) && token.kind !== 79 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 108 /* ThisKeyword */) {
145587
145841
  return void 0;
145588
145842
  }
@@ -146246,7 +146500,7 @@ function inferTypeFromReferences(program, references, cancellationToken) {
146246
146500
  const props = createMultiMap();
146247
146501
  for (const anon2 of anons) {
146248
146502
  for (const p of checker.getPropertiesOfType(anon2)) {
146249
- props.add(p.name, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
146503
+ props.add(p.escapedName, p.valueDeclaration ? checker.getTypeOfSymbolAtLocation(p, p.valueDeclaration) : checker.getAnyType());
146250
146504
  }
146251
146505
  calls.push(...checker.getSignaturesOfType(anon2, 0 /* Call */));
146252
146506
  constructs.push(...checker.getSignaturesOfType(anon2, 1 /* Construct */));
@@ -146478,13 +146732,13 @@ function inferTypeFromReferences(program, references, cancellationToken) {
146478
146732
  }
146479
146733
 
146480
146734
  // src/services/codefixes/fixReturnTypeInAsyncFunction.ts
146481
- var fixId38 = "fixReturnTypeInAsyncFunction";
146482
- var errorCodes48 = [
146735
+ var fixId39 = "fixReturnTypeInAsyncFunction";
146736
+ var errorCodes49 = [
146483
146737
  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
146484
146738
  ];
146485
146739
  registerCodeFix({
146486
- errorCodes: errorCodes48,
146487
- fixIds: [fixId38],
146740
+ errorCodes: errorCodes49,
146741
+ fixIds: [fixId39],
146488
146742
  getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
146489
146743
  const { sourceFile, program, span } = context;
146490
146744
  const checker = program.getTypeChecker();
@@ -146493,23 +146747,23 @@ registerCodeFix({
146493
146747
  return void 0;
146494
146748
  }
146495
146749
  const { returnTypeNode, returnType, promisedTypeNode, promisedType } = info;
146496
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange24(t, sourceFile, returnTypeNode, promisedTypeNode));
146750
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, returnTypeNode, promisedTypeNode));
146497
146751
  return [createCodeFixAction(
146498
- fixId38,
146752
+ fixId39,
146499
146753
  changes,
146500
146754
  [
146501
146755
  Diagnostics.Replace_0_with_Promise_1,
146502
146756
  checker.typeToString(returnType),
146503
146757
  checker.typeToString(promisedType)
146504
146758
  ],
146505
- fixId38,
146759
+ fixId39,
146506
146760
  Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions
146507
146761
  )];
146508
146762
  },
146509
- getAllCodeActions: (context) => codeFixAll(context, errorCodes48, (changes, diag2) => {
146763
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes49, (changes, diag2) => {
146510
146764
  const info = getInfo12(diag2.file, context.program.getTypeChecker(), diag2.start);
146511
146765
  if (info) {
146512
- doChange24(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
146766
+ doChange26(changes, diag2.file, info.returnTypeNode, info.promisedTypeNode);
146513
146767
  }
146514
146768
  })
146515
146769
  });
@@ -146536,19 +146790,19 @@ function getInfo12(sourceFile, checker, pos) {
146536
146790
  return { returnTypeNode, returnType, promisedTypeNode, promisedType };
146537
146791
  }
146538
146792
  }
146539
- function doChange24(changes, sourceFile, returnTypeNode, promisedTypeNode) {
146793
+ function doChange26(changes, sourceFile, returnTypeNode, promisedTypeNode) {
146540
146794
  changes.replaceNode(sourceFile, returnTypeNode, factory.createTypeReferenceNode("Promise", [promisedTypeNode]));
146541
146795
  }
146542
146796
 
146543
146797
  // src/services/codefixes/disableJsDiagnostics.ts
146544
146798
  var fixName4 = "disableJsDiagnostics";
146545
- var fixId39 = "disableJsDiagnostics";
146546
- var errorCodes49 = mapDefined(Object.keys(Diagnostics), (key) => {
146799
+ var fixId40 = "disableJsDiagnostics";
146800
+ var errorCodes50 = mapDefined(Object.keys(Diagnostics), (key) => {
146547
146801
  const diag2 = Diagnostics[key];
146548
146802
  return diag2.category === 1 /* Error */ ? diag2.code : void 0;
146549
146803
  });
146550
146804
  registerCodeFix({
146551
- errorCodes: errorCodes49,
146805
+ errorCodes: errorCodes50,
146552
146806
  getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
146553
146807
  const { sourceFile, program, span, host, formatContext } = context;
146554
146808
  if (!isInJSFile(sourceFile) || !isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
@@ -146566,14 +146820,14 @@ registerCodeFix({
146566
146820
  )
146567
146821
  ];
146568
146822
  if (ts_textChanges_exports.isValidLocationToAddComment(sourceFile, span.start)) {
146569
- fixes.unshift(createCodeFixAction(fixName4, ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange8(t, sourceFile, span.start)), Diagnostics.Ignore_this_error_message, fixId39, Diagnostics.Add_ts_ignore_to_all_error_messages));
146823
+ 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));
146570
146824
  }
146571
146825
  return fixes;
146572
146826
  },
146573
- fixIds: [fixId39],
146827
+ fixIds: [fixId40],
146574
146828
  getAllCodeActions: (context) => {
146575
146829
  const seenLines = /* @__PURE__ */ new Set();
146576
- return codeFixAll(context, errorCodes49, (changes, diag2) => {
146830
+ return codeFixAll(context, errorCodes50, (changes, diag2) => {
146577
146831
  if (ts_textChanges_exports.isValidLocationToAddComment(diag2.file, diag2.start)) {
146578
146832
  makeChange8(changes, diag2.file, diag2.start, seenLines);
146579
146833
  }
@@ -147553,9 +147807,9 @@ var fixName6 = "strictClassInitialization";
147553
147807
  var fixIdAddDefiniteAssignmentAssertions = "addMissingPropertyDefiniteAssignmentAssertions";
147554
147808
  var fixIdAddUndefinedType = "addMissingPropertyUndefinedType";
147555
147809
  var fixIdAddInitializer = "addMissingPropertyInitializer";
147556
- var errorCodes50 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
147810
+ var errorCodes51 = [Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
147557
147811
  registerCodeFix({
147558
- errorCodes: errorCodes50,
147812
+ errorCodes: errorCodes51,
147559
147813
  getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
147560
147814
  const info = getInfo13(context.sourceFile, context.span.start);
147561
147815
  if (!info)
@@ -147568,7 +147822,7 @@ registerCodeFix({
147568
147822
  },
147569
147823
  fixIds: [fixIdAddDefiniteAssignmentAssertions, fixIdAddUndefinedType, fixIdAddInitializer],
147570
147824
  getAllCodeActions: (context) => {
147571
- return codeFixAll(context, errorCodes50, (changes, diag2) => {
147825
+ return codeFixAll(context, errorCodes51, (changes, diag2) => {
147572
147826
  const info = getInfo13(diag2.file, diag2.start);
147573
147827
  if (!info)
147574
147828
  return;
@@ -147698,27 +147952,27 @@ function getDefaultValueFromType(checker, type) {
147698
147952
  }
147699
147953
 
147700
147954
  // src/services/codefixes/requireInTs.ts
147701
- var fixId40 = "requireInTs";
147702
- var errorCodes51 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
147955
+ var fixId41 = "requireInTs";
147956
+ var errorCodes52 = [Diagnostics.require_call_may_be_converted_to_an_import.code];
147703
147957
  registerCodeFix({
147704
- errorCodes: errorCodes51,
147958
+ errorCodes: errorCodes52,
147705
147959
  getCodeActions(context) {
147706
147960
  const info = getInfo14(context.sourceFile, context.program, context.span.start);
147707
147961
  if (!info) {
147708
147962
  return void 0;
147709
147963
  }
147710
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange25(t, context.sourceFile, info));
147711
- return [createCodeFixAction(fixId40, changes, Diagnostics.Convert_require_to_import, fixId40, Diagnostics.Convert_all_require_to_import)];
147964
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, context.sourceFile, info));
147965
+ return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_require_to_import, fixId41, Diagnostics.Convert_all_require_to_import)];
147712
147966
  },
147713
- fixIds: [fixId40],
147714
- getAllCodeActions: (context) => codeFixAll(context, errorCodes51, (changes, diag2) => {
147967
+ fixIds: [fixId41],
147968
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
147715
147969
  const info = getInfo14(diag2.file, context.program, diag2.start);
147716
147970
  if (info) {
147717
- doChange25(changes, context.sourceFile, info);
147971
+ doChange27(changes, context.sourceFile, info);
147718
147972
  }
147719
147973
  })
147720
147974
  });
147721
- function doChange25(changes, sourceFile, info) {
147975
+ function doChange27(changes, sourceFile, info) {
147722
147976
  const { allowSyntheticDefaults, defaultImportName, namedImports, statement, required } = info;
147723
147977
  changes.replaceNode(sourceFile, statement, defaultImportName && !allowSyntheticDefaults ? factory.createImportEqualsDeclaration(
147724
147978
  /*modifiers*/
@@ -147782,23 +148036,23 @@ function tryCreateNamedImportsFromObjectBindingPattern(node) {
147782
148036
  }
147783
148037
 
147784
148038
  // src/services/codefixes/useDefaultImport.ts
147785
- var fixId41 = "useDefaultImport";
147786
- var errorCodes52 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
148039
+ var fixId42 = "useDefaultImport";
148040
+ var errorCodes53 = [Diagnostics.Import_may_be_converted_to_a_default_import.code];
147787
148041
  registerCodeFix({
147788
- errorCodes: errorCodes52,
148042
+ errorCodes: errorCodes53,
147789
148043
  getCodeActions(context) {
147790
148044
  const { sourceFile, span: { start: start2 } } = context;
147791
148045
  const info = getInfo15(sourceFile, start2);
147792
148046
  if (!info)
147793
148047
  return void 0;
147794
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange26(t, sourceFile, info, context.preferences));
147795
- return [createCodeFixAction(fixId41, changes, Diagnostics.Convert_to_default_import, fixId41, Diagnostics.Convert_all_to_default_imports)];
148048
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, info, context.preferences));
148049
+ return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_default_import, fixId42, Diagnostics.Convert_all_to_default_imports)];
147796
148050
  },
147797
- fixIds: [fixId41],
147798
- getAllCodeActions: (context) => codeFixAll(context, errorCodes52, (changes, diag2) => {
148051
+ fixIds: [fixId42],
148052
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes53, (changes, diag2) => {
147799
148053
  const info = getInfo15(diag2.file, diag2.start);
147800
148054
  if (info)
147801
- doChange26(changes, diag2.file, info, context.preferences);
148055
+ doChange28(changes, diag2.file, info, context.preferences);
147802
148056
  })
147803
148057
  });
147804
148058
  function getInfo15(sourceFile, pos) {
@@ -147813,7 +148067,7 @@ function getInfo15(sourceFile, pos) {
147813
148067
  return { importNode, name, moduleSpecifier: importNode.moduleSpecifier };
147814
148068
  }
147815
148069
  }
147816
- function doChange26(changes, sourceFile, info, preferences) {
148070
+ function doChange28(changes, sourceFile, info, preferences) {
147817
148071
  changes.replaceNode(sourceFile, info.importNode, makeImport(
147818
148072
  info.name,
147819
148073
  /*namedImports*/
@@ -147824,21 +148078,21 @@ function doChange26(changes, sourceFile, info, preferences) {
147824
148078
  }
147825
148079
 
147826
148080
  // src/services/codefixes/useBigintLiteral.ts
147827
- var fixId42 = "useBigintLiteral";
147828
- var errorCodes53 = [
148081
+ var fixId43 = "useBigintLiteral";
148082
+ var errorCodes54 = [
147829
148083
  Diagnostics.Numeric_literals_with_absolute_values_equal_to_2_53_or_greater_are_too_large_to_be_represented_accurately_as_integers.code
147830
148084
  ];
147831
148085
  registerCodeFix({
147832
- errorCodes: errorCodes53,
148086
+ errorCodes: errorCodes54,
147833
148087
  getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
147834
148088
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange9(t, context.sourceFile, context.span));
147835
148089
  if (changes.length > 0) {
147836
- return [createCodeFixAction(fixId42, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId42, Diagnostics.Convert_all_to_bigint_numeric_literals)];
148090
+ return [createCodeFixAction(fixId43, changes, Diagnostics.Convert_to_a_bigint_numeric_literal, fixId43, Diagnostics.Convert_all_to_bigint_numeric_literals)];
147837
148091
  }
147838
148092
  },
147839
- fixIds: [fixId42],
148093
+ fixIds: [fixId43],
147840
148094
  getAllCodeActions: (context) => {
147841
- return codeFixAll(context, errorCodes53, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
148095
+ return codeFixAll(context, errorCodes54, (changes, diag2) => makeChange9(changes, diag2.file, diag2));
147842
148096
  }
147843
148097
  });
147844
148098
  function makeChange9(changeTracker, sourceFile, span) {
@@ -147852,18 +148106,18 @@ function makeChange9(changeTracker, sourceFile, span) {
147852
148106
 
147853
148107
  // src/services/codefixes/fixAddModuleReferTypeMissingTypeof.ts
147854
148108
  var fixIdAddMissingTypeof = "fixAddModuleReferTypeMissingTypeof";
147855
- var fixId43 = fixIdAddMissingTypeof;
147856
- var errorCodes54 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
148109
+ var fixId44 = fixIdAddMissingTypeof;
148110
+ var errorCodes55 = [Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
147857
148111
  registerCodeFix({
147858
- errorCodes: errorCodes54,
148112
+ errorCodes: errorCodes55,
147859
148113
  getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
147860
148114
  const { sourceFile, span } = context;
147861
148115
  const importType = getImportTypeNode(sourceFile, span.start);
147862
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange27(t, sourceFile, importType));
147863
- return [createCodeFixAction(fixId43, changes, Diagnostics.Add_missing_typeof, fixId43, Diagnostics.Add_missing_typeof)];
148116
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, importType));
148117
+ return [createCodeFixAction(fixId44, changes, Diagnostics.Add_missing_typeof, fixId44, Diagnostics.Add_missing_typeof)];
147864
148118
  },
147865
- fixIds: [fixId43],
147866
- getAllCodeActions: (context) => codeFixAll(context, errorCodes54, (changes, diag2) => doChange27(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
148119
+ fixIds: [fixId44],
148120
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => doChange29(changes, context.sourceFile, getImportTypeNode(diag2.file, diag2.start)))
147867
148121
  });
147868
148122
  function getImportTypeNode(sourceFile, pos) {
147869
148123
  const token = getTokenAtPosition(sourceFile, pos);
@@ -147871,7 +148125,7 @@ function getImportTypeNode(sourceFile, pos) {
147871
148125
  Debug.assert(token.parent.kind === 202 /* ImportType */, "Token parent should be an ImportType");
147872
148126
  return token.parent;
147873
148127
  }
147874
- function doChange27(changes, sourceFile, importType) {
148128
+ function doChange29(changes, sourceFile, importType) {
147875
148129
  const newTypeNode = factory.updateImportTypeNode(
147876
148130
  importType,
147877
148131
  importType.argument,
@@ -147886,23 +148140,23 @@ function doChange27(changes, sourceFile, importType) {
147886
148140
 
147887
148141
  // src/services/codefixes/wrapJsxInFragment.ts
147888
148142
  var fixID2 = "wrapJsxInFragment";
147889
- var errorCodes55 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
148143
+ var errorCodes56 = [Diagnostics.JSX_expressions_must_have_one_parent_element.code];
147890
148144
  registerCodeFix({
147891
- errorCodes: errorCodes55,
148145
+ errorCodes: errorCodes56,
147892
148146
  getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
147893
148147
  const { sourceFile, span } = context;
147894
148148
  const node = findNodeToFix(sourceFile, span.start);
147895
148149
  if (!node)
147896
148150
  return void 0;
147897
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange28(t, sourceFile, node));
148151
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, node));
147898
148152
  return [createCodeFixAction(fixID2, changes, Diagnostics.Wrap_in_JSX_fragment, fixID2, Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)];
147899
148153
  },
147900
148154
  fixIds: [fixID2],
147901
- getAllCodeActions: (context) => codeFixAll(context, errorCodes55, (changes, diag2) => {
148155
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
147902
148156
  const node = findNodeToFix(context.sourceFile, diag2.start);
147903
148157
  if (!node)
147904
148158
  return void 0;
147905
- doChange28(changes, context.sourceFile, node);
148159
+ doChange30(changes, context.sourceFile, node);
147906
148160
  })
147907
148161
  });
147908
148162
  function findNodeToFix(sourceFile, pos) {
@@ -147918,7 +148172,7 @@ function findNodeToFix(sourceFile, pos) {
147918
148172
  return void 0;
147919
148173
  return binaryExpr;
147920
148174
  }
147921
- function doChange28(changeTracker, sf, node) {
148175
+ function doChange30(changeTracker, sf, node) {
147922
148176
  const jsx = flattenInvalidBinaryExpr(node);
147923
148177
  if (jsx)
147924
148178
  changeTracker.replaceNode(sf, node, factory.createJsxFragment(factory.createJsxOpeningFragment(), jsx, factory.createJsxJsxClosingFragment()));
@@ -147943,24 +148197,24 @@ function flattenInvalidBinaryExpr(node) {
147943
148197
  }
147944
148198
 
147945
148199
  // src/services/codefixes/convertToMappedObjectType.ts
147946
- var fixId44 = "fixConvertToMappedObjectType";
147947
- var errorCodes56 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
148200
+ var fixId45 = "fixConvertToMappedObjectType";
148201
+ var errorCodes57 = [Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
147948
148202
  registerCodeFix({
147949
- errorCodes: errorCodes56,
148203
+ errorCodes: errorCodes57,
147950
148204
  getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
147951
148205
  const { sourceFile, span } = context;
147952
148206
  const info = getInfo16(sourceFile, span.start);
147953
148207
  if (!info)
147954
148208
  return void 0;
147955
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, info));
148209
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
147956
148210
  const name = idText(info.container.name);
147957
- return [createCodeFixAction(fixId44, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId44, [Diagnostics.Convert_0_to_mapped_object_type, name])];
148211
+ return [createCodeFixAction(fixId45, changes, [Diagnostics.Convert_0_to_mapped_object_type, name], fixId45, [Diagnostics.Convert_0_to_mapped_object_type, name])];
147958
148212
  },
147959
- fixIds: [fixId44],
147960
- getAllCodeActions: (context) => codeFixAll(context, errorCodes56, (changes, diag2) => {
148213
+ fixIds: [fixId45],
148214
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes57, (changes, diag2) => {
147961
148215
  const info = getInfo16(diag2.file, diag2.start);
147962
148216
  if (info)
147963
- doChange29(changes, diag2.file, info);
148217
+ doChange31(changes, diag2.file, info);
147964
148218
  })
147965
148219
  });
147966
148220
  function getInfo16(sourceFile, pos) {
@@ -147976,7 +148230,7 @@ function getInfo16(sourceFile, pos) {
147976
148230
  function createTypeAliasFromInterface(declaration, type) {
147977
148231
  return factory.createTypeAliasDeclaration(declaration.modifiers, declaration.name, declaration.typeParameters, type);
147978
148232
  }
147979
- function doChange29(changes, sourceFile, { indexSignature, container }) {
148233
+ function doChange31(changes, sourceFile, { indexSignature, container }) {
147980
148234
  const members = isInterfaceDeclaration(container) ? container.members : container.type.members;
147981
148235
  const otherMembers = members.filter((member) => !isIndexSignatureDeclaration(member));
147982
148236
  const parameter = first(indexSignature.parameters);
@@ -148005,12 +148259,12 @@ function doChange29(changes, sourceFile, { indexSignature, container }) {
148005
148259
  }
148006
148260
 
148007
148261
  // src/services/codefixes/removeAccidentalCallParentheses.ts
148008
- var fixId45 = "removeAccidentalCallParentheses";
148009
- var errorCodes57 = [
148262
+ var fixId46 = "removeAccidentalCallParentheses";
148263
+ var errorCodes58 = [
148010
148264
  Diagnostics.This_expression_is_not_callable_because_it_is_a_get_accessor_Did_you_mean_to_use_it_without.code
148011
148265
  ];
148012
148266
  registerCodeFix({
148013
- errorCodes: errorCodes57,
148267
+ errorCodes: errorCodes58,
148014
148268
  getCodeActions(context) {
148015
148269
  const callExpression = findAncestor(getTokenAtPosition(context.sourceFile, context.span.start), isCallExpression);
148016
148270
  if (!callExpression) {
@@ -148019,27 +148273,27 @@ registerCodeFix({
148019
148273
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
148020
148274
  t.deleteRange(context.sourceFile, { pos: callExpression.expression.end, end: callExpression.end });
148021
148275
  });
148022
- return [createCodeFixActionWithoutFixAll(fixId45, changes, Diagnostics.Remove_parentheses)];
148276
+ return [createCodeFixActionWithoutFixAll(fixId46, changes, Diagnostics.Remove_parentheses)];
148023
148277
  },
148024
- fixIds: [fixId45]
148278
+ fixIds: [fixId46]
148025
148279
  });
148026
148280
 
148027
148281
  // src/services/codefixes/removeUnnecessaryAwait.ts
148028
- var fixId46 = "removeUnnecessaryAwait";
148029
- var errorCodes58 = [
148282
+ var fixId47 = "removeUnnecessaryAwait";
148283
+ var errorCodes59 = [
148030
148284
  Diagnostics.await_has_no_effect_on_the_type_of_this_expression.code
148031
148285
  ];
148032
148286
  registerCodeFix({
148033
- errorCodes: errorCodes58,
148287
+ errorCodes: errorCodes59,
148034
148288
  getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
148035
148289
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange10(t, context.sourceFile, context.span));
148036
148290
  if (changes.length > 0) {
148037
- return [createCodeFixAction(fixId46, changes, Diagnostics.Remove_unnecessary_await, fixId46, Diagnostics.Remove_all_unnecessary_uses_of_await)];
148291
+ return [createCodeFixAction(fixId47, changes, Diagnostics.Remove_unnecessary_await, fixId47, Diagnostics.Remove_all_unnecessary_uses_of_await)];
148038
148292
  }
148039
148293
  },
148040
- fixIds: [fixId46],
148294
+ fixIds: [fixId47],
148041
148295
  getAllCodeActions: (context) => {
148042
- return codeFixAll(context, errorCodes58, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
148296
+ return codeFixAll(context, errorCodes59, (changes, diag2) => makeChange10(changes, diag2.file, diag2));
148043
148297
  }
148044
148298
  });
148045
148299
  function makeChange10(changeTracker, sourceFile, span) {
@@ -148067,20 +148321,20 @@ function makeChange10(changeTracker, sourceFile, span) {
148067
148321
  }
148068
148322
 
148069
148323
  // src/services/codefixes/splitTypeOnlyImport.ts
148070
- var errorCodes59 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
148071
- var fixId47 = "splitTypeOnlyImport";
148324
+ var errorCodes60 = [Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both.code];
148325
+ var fixId48 = "splitTypeOnlyImport";
148072
148326
  registerCodeFix({
148073
- errorCodes: errorCodes59,
148074
- fixIds: [fixId47],
148327
+ errorCodes: errorCodes60,
148328
+ fixIds: [fixId48],
148075
148329
  getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
148076
148330
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => {
148077
148331
  return splitTypeOnlyImport(t, getImportDeclaration2(context.sourceFile, context.span), context);
148078
148332
  });
148079
148333
  if (changes.length) {
148080
- return [createCodeFixAction(fixId47, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId47, Diagnostics.Split_all_invalid_type_only_imports)];
148334
+ return [createCodeFixAction(fixId48, changes, Diagnostics.Split_into_two_separate_import_declarations, fixId48, Diagnostics.Split_all_invalid_type_only_imports)];
148081
148335
  }
148082
148336
  },
148083
- getAllCodeActions: (context) => codeFixAll(context, errorCodes59, (changes, error) => {
148337
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes60, (changes, error) => {
148084
148338
  splitTypeOnlyImport(changes, getImportDeclaration2(context.sourceFile, error), context);
148085
148339
  })
148086
148340
  });
@@ -148121,34 +148375,34 @@ function splitTypeOnlyImport(changes, importDeclaration, context) {
148121
148375
  }
148122
148376
 
148123
148377
  // src/services/codefixes/convertConstToLet.ts
148124
- var fixId48 = "fixConvertConstToLet";
148125
- var errorCodes60 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
148378
+ var fixId49 = "fixConvertConstToLet";
148379
+ var errorCodes61 = [Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
148126
148380
  registerCodeFix({
148127
- errorCodes: errorCodes60,
148381
+ errorCodes: errorCodes61,
148128
148382
  getCodeActions: function getCodeActionsToConvertConstToLet(context) {
148129
148383
  const { sourceFile, span, program } = context;
148130
148384
  const info = getInfo17(sourceFile, span.start, program);
148131
148385
  if (info === void 0)
148132
148386
  return;
148133
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange30(t, sourceFile, info.token));
148134
- return [createCodeFixActionMaybeFixAll(fixId48, changes, Diagnostics.Convert_const_to_let, fixId48, Diagnostics.Convert_all_const_to_let)];
148387
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(t, sourceFile, info.token));
148388
+ return [createCodeFixActionMaybeFixAll(fixId49, changes, Diagnostics.Convert_const_to_let, fixId49, Diagnostics.Convert_all_const_to_let)];
148135
148389
  },
148136
148390
  getAllCodeActions: (context) => {
148137
148391
  const { program } = context;
148138
148392
  const seen = /* @__PURE__ */ new Map();
148139
148393
  return createCombinedCodeActions(ts_textChanges_exports.ChangeTracker.with(context, (changes) => {
148140
- eachDiagnostic(context, errorCodes60, (diag2) => {
148394
+ eachDiagnostic(context, errorCodes61, (diag2) => {
148141
148395
  const info = getInfo17(diag2.file, diag2.start, program);
148142
148396
  if (info) {
148143
148397
  if (addToSeen(seen, getSymbolId(info.symbol))) {
148144
- return doChange30(changes, diag2.file, info.token);
148398
+ return doChange32(changes, diag2.file, info.token);
148145
148399
  }
148146
148400
  }
148147
148401
  return void 0;
148148
148402
  });
148149
148403
  }));
148150
148404
  },
148151
- fixIds: [fixId48]
148405
+ fixIds: [fixId49]
148152
148406
  });
148153
148407
  function getInfo17(sourceFile, pos, program) {
148154
148408
  var _a2;
@@ -148164,64 +148418,64 @@ function getInfo17(sourceFile, pos, program) {
148164
148418
  return;
148165
148419
  return { symbol, token: constToken };
148166
148420
  }
148167
- function doChange30(changes, sourceFile, token) {
148421
+ function doChange32(changes, sourceFile, token) {
148168
148422
  changes.replaceNode(sourceFile, token, factory.createToken(119 /* LetKeyword */));
148169
148423
  }
148170
148424
 
148171
148425
  // src/services/codefixes/fixExpectedComma.ts
148172
- var fixId49 = "fixExpectedComma";
148426
+ var fixId50 = "fixExpectedComma";
148173
148427
  var expectedErrorCode = Diagnostics._0_expected.code;
148174
- var errorCodes61 = [expectedErrorCode];
148428
+ var errorCodes62 = [expectedErrorCode];
148175
148429
  registerCodeFix({
148176
- errorCodes: errorCodes61,
148430
+ errorCodes: errorCodes62,
148177
148431
  getCodeActions(context) {
148178
148432
  const { sourceFile } = context;
148179
148433
  const info = getInfo18(sourceFile, context.span.start, context.errorCode);
148180
148434
  if (!info)
148181
148435
  return void 0;
148182
- const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange31(t, sourceFile, info));
148436
+ const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(t, sourceFile, info));
148183
148437
  return [createCodeFixAction(
148184
- fixId49,
148438
+ fixId50,
148185
148439
  changes,
148186
148440
  [Diagnostics.Change_0_to_1, ";", ","],
148187
- fixId49,
148441
+ fixId50,
148188
148442
  [Diagnostics.Change_0_to_1, ";", ","]
148189
148443
  )];
148190
148444
  },
148191
- fixIds: [fixId49],
148192
- getAllCodeActions: (context) => codeFixAll(context, errorCodes61, (changes, diag2) => {
148445
+ fixIds: [fixId50],
148446
+ getAllCodeActions: (context) => codeFixAll(context, errorCodes62, (changes, diag2) => {
148193
148447
  const info = getInfo18(diag2.file, diag2.start, diag2.code);
148194
148448
  if (info)
148195
- doChange31(changes, context.sourceFile, info);
148449
+ doChange33(changes, context.sourceFile, info);
148196
148450
  })
148197
148451
  });
148198
148452
  function getInfo18(sourceFile, pos, _) {
148199
148453
  const node = getTokenAtPosition(sourceFile, pos);
148200
148454
  return node.kind === 26 /* SemicolonToken */ && node.parent && (isObjectLiteralExpression(node.parent) || isArrayLiteralExpression(node.parent)) ? { node } : void 0;
148201
148455
  }
148202
- function doChange31(changes, sourceFile, { node }) {
148456
+ function doChange33(changes, sourceFile, { node }) {
148203
148457
  const newNode = factory.createToken(27 /* CommaToken */);
148204
148458
  changes.replaceNode(sourceFile, node, newNode);
148205
148459
  }
148206
148460
 
148207
148461
  // src/services/codefixes/fixAddVoidToPromise.ts
148208
148462
  var fixName7 = "addVoidToPromise";
148209
- var fixId50 = "addVoidToPromise";
148210
- var errorCodes62 = [
148463
+ var fixId51 = "addVoidToPromise";
148464
+ var errorCodes63 = [
148211
148465
  Diagnostics.Expected_1_argument_but_got_0_new_Promise_needs_a_JSDoc_hint_to_produce_a_resolve_that_can_be_called_without_arguments.code,
148212
148466
  Diagnostics.Expected_0_arguments_but_got_1_Did_you_forget_to_include_void_in_your_type_argument_to_Promise.code
148213
148467
  ];
148214
148468
  registerCodeFix({
148215
- errorCodes: errorCodes62,
148216
- fixIds: [fixId50],
148469
+ errorCodes: errorCodes63,
148470
+ fixIds: [fixId51],
148217
148471
  getCodeActions(context) {
148218
148472
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => makeChange11(t, context.sourceFile, context.span, context.program));
148219
148473
  if (changes.length > 0) {
148220
- return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId50, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
148474
+ return [createCodeFixAction(fixName7, changes, Diagnostics.Add_void_to_Promise_resolved_without_a_value, fixId51, Diagnostics.Add_void_to_all_Promises_resolved_without_a_value)];
148221
148475
  }
148222
148476
  },
148223
148477
  getAllCodeActions(context) {
148224
- return codeFixAll(context, errorCodes62, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
148478
+ return codeFixAll(context, errorCodes63, (changes, diag2) => makeChange11(changes, diag2.file, diag2, context.program, /* @__PURE__ */ new Set()));
148225
148479
  }
148226
148480
  });
148227
148481
  function makeChange11(changes, sourceFile, span, program, seen) {
@@ -150110,7 +150364,8 @@ function getCompletionData(program, log, sourceFile, compilerOptions, position,
150110
150364
  }
150111
150365
  log("getCompletionData: Semantic work: " + (timestamp() - semanticStart));
150112
150366
  const contextualType = previousToken && getContextualType(previousToken, position, sourceFile, typeChecker);
150113
- const literals = mapDefined(
150367
+ const isLiteralExpected = !tryCast(previousToken, isStringLiteralLike) && !isJsxIdentifierExpected;
150368
+ const literals = !isLiteralExpected ? [] : mapDefined(
150114
150369
  contextualType && (contextualType.isUnion() ? contextualType.types : [contextualType]),
150115
150370
  (t) => t.isLiteral() && !(t.flags & 1024 /* EnumLiteral */) ? t.value : void 0
150116
150371
  );
@@ -156578,8 +156833,7 @@ function compareModuleSpecifiers2(m1, m2, ignoreCase) {
156578
156833
  function compareModuleSpecifiersWorker(m1, m2, comparer) {
156579
156834
  const name1 = m1 === void 0 ? void 0 : getExternalModuleName2(m1);
156580
156835
  const name2 = m2 === void 0 ? void 0 : getExternalModuleName2(m2);
156581
- return compareBooleans(name1 === void 0, name2 === void 0) || compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
156582
- comparer(name1, name2);
156836
+ return compareBooleans(name1 === void 0, name2 === void 0) || compareBooleans(isExternalModuleNameRelative(name1), isExternalModuleNameRelative(name2)) || comparer(name1, name2);
156583
156837
  }
156584
156838
  function getModuleSpecifierExpression(declaration) {
156585
156839
  var _a2;
@@ -157256,7 +157510,7 @@ registerRefactor(refactorName, {
157256
157510
  Debug.assert(actionName2 === defaultToNamedAction.name || actionName2 === namedToDefaultAction.name, "Unexpected action name");
157257
157511
  const info = getInfo19(context);
157258
157512
  Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
157259
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange32(context.file, context.program, info, t, context.cancellationToken));
157513
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, info, t, context.cancellationToken));
157260
157514
  return { edits, renameFilename: void 0, renameLocation: void 0 };
157261
157515
  }
157262
157516
  });
@@ -157309,7 +157563,7 @@ function getInfo19(context, considerPartialSpans = true) {
157309
157563
  return void 0;
157310
157564
  }
157311
157565
  }
157312
- function doChange32(exportingSourceFile, program, info, changes, cancellationToken) {
157566
+ function doChange34(exportingSourceFile, program, info, changes, cancellationToken) {
157313
157567
  changeExport(exportingSourceFile, info, changes, program.getTypeChecker());
157314
157568
  changeImports(program, info, changes, cancellationToken);
157315
157569
  }
@@ -157504,7 +157758,7 @@ registerRefactor(refactorName2, {
157504
157758
  Debug.assert(some(getOwnValues(actions), (action) => action.name === actionName2), "Unexpected action name");
157505
157759
  const info = getImportConversionInfo(context);
157506
157760
  Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
157507
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange33(context.file, context.program, t, info));
157761
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(context.file, context.program, t, info));
157508
157762
  return { edits, renameFilename: void 0, renameLocation: void 0 };
157509
157763
  }
157510
157764
  });
@@ -157535,7 +157789,7 @@ function getImportConversionInfo(context, considerPartialSpans = true) {
157535
157789
  function getShouldUseDefault(program, importClause) {
157536
157790
  return getAllowSyntheticDefaultImports(program.getCompilerOptions()) && isExportEqualsModule(importClause.parent.moduleSpecifier, program.getTypeChecker());
157537
157791
  }
157538
- function doChange33(sourceFile, program, changes, info) {
157792
+ function doChange35(sourceFile, program, changes, info) {
157539
157793
  const checker = program.getTypeChecker();
157540
157794
  if (info.convertTo === 0 /* Named */) {
157541
157795
  doChangeNamespaceToNamed(sourceFile, checker, changes, info.import, getAllowSyntheticDefaultImports(program.getCompilerOptions()));
@@ -158008,7 +158262,7 @@ registerRefactor(refactorName4, {
158008
158262
  getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
158009
158263
  Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
158010
158264
  const statements = Debug.checkDefined(getStatementsToMove(context));
158011
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange34(context.file, context.program, statements, t, context.host, context.preferences));
158265
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange36(context.file, context.program, statements, t, context.host, context.preferences));
158012
158266
  return { edits, renameFilename: void 0, renameLocation: void 0 };
158013
158267
  }
158014
158268
  });
@@ -158033,7 +158287,7 @@ function getRangeToMove(context) {
158033
158287
  afterLast: afterEndNodeIndex === -1 ? void 0 : statements[afterEndNodeIndex]
158034
158288
  };
158035
158289
  }
158036
- function doChange34(oldFile, program, toMove, changes, host, preferences) {
158290
+ function doChange36(oldFile, program, toMove, changes, host, preferences) {
158037
158291
  const checker = program.getTypeChecker();
158038
158292
  const usage = getUsageInfo(oldFile, toMove.all, checker);
158039
158293
  const currentDirectory = getDirectoryPath(oldFile.fileName);
@@ -159405,12 +159659,12 @@ function getRefactorEditsToConvertParametersToDestructuredObject(context, action
159405
159659
  return void 0;
159406
159660
  const groupedReferences = getGroupedReferences(functionDeclaration, program, cancellationToken);
159407
159661
  if (groupedReferences.valid) {
159408
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange35(file, program, host, t, functionDeclaration, groupedReferences));
159662
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(file, program, host, t, functionDeclaration, groupedReferences));
159409
159663
  return { renameFilename: void 0, renameLocation: void 0, edits };
159410
159664
  }
159411
159665
  return { edits: [] };
159412
159666
  }
159413
- function doChange35(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
159667
+ function doChange37(sourceFile, program, host, changes, functionDeclaration, groupedReferences) {
159414
159668
  const signature = groupedReferences.signature;
159415
159669
  const newFunctionDeclarationParams = map(createNewParameters(functionDeclaration, program, host), (param) => getSynthesizedDeepClone(param));
159416
159670
  if (signature) {
@@ -160174,7 +160428,7 @@ function getRefactorEditsToConvertToOptionalChain(context, actionName2) {
160174
160428
  Debug.assert(info && !isRefactorErrorInfo(info), "Expected applicable refactor info");
160175
160429
  const edits = ts_textChanges_exports.ChangeTracker.with(
160176
160430
  context,
160177
- (t) => doChange36(context.file, context.program.getTypeChecker(), t, info, actionName2)
160431
+ (t) => doChange38(context.file, context.program.getTypeChecker(), t, info, actionName2)
160178
160432
  );
160179
160433
  return { edits, renameFilename: void 0, renameLocation: void 0 };
160180
160434
  }
@@ -160330,7 +160584,7 @@ function convertOccurrences(checker, toConvert, occurrences) {
160330
160584
  }
160331
160585
  return toConvert;
160332
160586
  }
160333
- function doChange36(sourceFile, checker, changes, info, _actionName) {
160587
+ function doChange38(sourceFile, checker, changes, info, _actionName) {
160334
160588
  const { finalExpression, occurrences, expression } = info;
160335
160589
  const firstOccurrence = occurrences[occurrences.length - 1];
160336
160590
  const convertedChain = convertOccurrences(checker, finalExpression, occurrences);
@@ -162025,7 +162279,7 @@ registerRefactor(refactorName12, {
162025
162279
  function getRefactorEditsToInferReturnType(context) {
162026
162280
  const info = getInfo21(context);
162027
162281
  if (info && !isRefactorErrorInfo(info)) {
162028
- const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange37(context.file, t, info.declaration, info.returnTypeNode));
162282
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange39(context.file, t, info.declaration, info.returnTypeNode));
162029
162283
  return { renameFilename: void 0, renameLocation: void 0, edits };
162030
162284
  }
162031
162285
  return void 0;
@@ -162050,7 +162304,7 @@ function getRefactorActionsToInferReturnType(context) {
162050
162304
  }
162051
162305
  return emptyArray;
162052
162306
  }
162053
- function doChange37(sourceFile, changes, declaration, typeNode) {
162307
+ function doChange39(sourceFile, changes, declaration, typeNode) {
162054
162308
  const closeParen = findChildOfKind(declaration, 21 /* CloseParenToken */, sourceFile);
162055
162309
  const needParens = isArrowFunction(declaration) && closeParen === void 0;
162056
162310
  const endNode2 = needParens ? first(declaration.parameters) : closeParen;
@@ -168103,7 +168357,6 @@ __export(ts_exports3, {
168103
168357
  createTypeChecker: () => createTypeChecker,
168104
168358
  createTypeReferenceDirectiveResolutionCache: () => createTypeReferenceDirectiveResolutionCache,
168105
168359
  createTypeReferenceResolutionLoader: () => createTypeReferenceResolutionLoader,
168106
- createUnderscoreEscapedMultiMap: () => createUnderscoreEscapedMultiMap,
168107
168360
  createUnparsedSourceFile: () => createUnparsedSourceFile,
168108
168361
  createWatchCompilerHost: () => createWatchCompilerHost2,
168109
168362
  createWatchCompilerHostOfConfigFile: () => createWatchCompilerHostOfConfigFile,
@@ -169514,7 +169767,6 @@ __export(ts_exports3, {
169514
169767
  nodeToDisplayParts: () => nodeToDisplayParts,
169515
169768
  noop: () => noop,
169516
169769
  noopFileWatcher: () => noopFileWatcher,
169517
- noopPush: () => noopPush,
169518
169770
  normalizePath: () => normalizePath,
169519
169771
  normalizeSlashes: () => normalizeSlashes,
169520
169772
  not: () => not,
@@ -170391,7 +170643,6 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
170391
170643
  CommandTypes2["NavtoFull"] = "navto-full";
170392
170644
  CommandTypes2["NavTree"] = "navtree";
170393
170645
  CommandTypes2["NavTreeFull"] = "navtree-full";
170394
- CommandTypes2["Occurrences"] = "occurrences";
170395
170646
  CommandTypes2["DocumentHighlights"] = "documentHighlights";
170396
170647
  CommandTypes2["DocumentHighlightsFull"] = "documentHighlights-full";
170397
170648
  CommandTypes2["Open"] = "open";
@@ -170596,17 +170847,14 @@ var TextStorage = class {
170596
170847
  * True when reloading contents of file from the disk is pending
170597
170848
  */
170598
170849
  this.pendingReloadFromDisk = false;
170599
- this.version = initialVersion || { svc: 0, text: 0 };
170850
+ this.version = initialVersion || 0;
170600
170851
  }
170601
170852
  getVersion() {
170602
- return this.svc ? `SVC-${this.version.svc}-${this.svc.getSnapshotVersion()}` : `Text-${this.version.text}`;
170853
+ return this.svc ? `SVC-${this.version}-${this.svc.getSnapshotVersion()}` : `Text-${this.version}`;
170603
170854
  }
170604
170855
  hasScriptVersionCache_TestOnly() {
170605
170856
  return this.svc !== void 0;
170606
170857
  }
170607
- useScriptVersionCache_TestOnly() {
170608
- this.switchToScriptVersionCache();
170609
- }
170610
170858
  resetSourceMapInfo() {
170611
170859
  this.info.sourceFileLike = void 0;
170612
170860
  this.info.closeSourceMapFileWatcher();
@@ -170619,15 +170867,17 @@ var TextStorage = class {
170619
170867
  useText(newText) {
170620
170868
  this.svc = void 0;
170621
170869
  this.text = newText;
170870
+ this.textSnapshot = void 0;
170622
170871
  this.lineMap = void 0;
170623
170872
  this.fileSize = void 0;
170624
170873
  this.resetSourceMapInfo();
170625
- this.version.text++;
170874
+ this.version++;
170626
170875
  }
170627
170876
  edit(start2, end, newText) {
170628
170877
  this.switchToScriptVersionCache().edit(start2, end - start2, newText);
170629
170878
  this.ownFileText = false;
170630
170879
  this.text = void 0;
170880
+ this.textSnapshot = void 0;
170631
170881
  this.lineMap = void 0;
170632
170882
  this.fileSize = void 0;
170633
170883
  this.resetSourceMapInfo();
@@ -170639,6 +170889,9 @@ var TextStorage = class {
170639
170889
  reload(newText) {
170640
170890
  Debug.assert(newText !== void 0);
170641
170891
  this.pendingReloadFromDisk = false;
170892
+ if (!this.text && this.svc) {
170893
+ this.text = getSnapshotText(this.svc.getSnapshot());
170894
+ }
170642
170895
  if (this.text !== newText) {
170643
170896
  this.useText(newText);
170644
170897
  this.ownFileText = false;
@@ -170651,21 +170904,18 @@ var TextStorage = class {
170651
170904
  * returns true if text changed
170652
170905
  */
170653
170906
  reloadWithFileText(tempFileName) {
170654
- const { text: newText, fileSize } = this.getFileTextAndSize(tempFileName);
170907
+ const { text: newText, fileSize } = tempFileName || !this.info.isDynamicOrHasMixedContent() ? this.getFileTextAndSize(tempFileName) : { text: "", fileSize: void 0 };
170655
170908
  const reloaded = this.reload(newText);
170656
170909
  this.fileSize = fileSize;
170657
170910
  this.ownFileText = !tempFileName || tempFileName === this.info.fileName;
170658
170911
  return reloaded;
170659
170912
  }
170660
170913
  /**
170661
- * Reloads the contents from the file if there is no pending reload from disk or the contents of file are same as file text
170662
- * returns true if text changed
170914
+ * Schedule reload from the disk if its not already scheduled and its not own text
170915
+ * returns true when scheduling reload
170663
170916
  */
170664
- reloadFromDisk() {
170665
- if (!this.pendingReloadFromDisk && !this.ownFileText) {
170666
- return this.reloadWithFileText();
170667
- }
170668
- return false;
170917
+ scheduleReloadIfNeeded() {
170918
+ return !this.pendingReloadFromDisk && !this.ownFileText ? this.pendingReloadFromDisk = true : false;
170669
170919
  }
170670
170920
  delayReloadFromFileIntoText() {
170671
170921
  this.pendingReloadFromDisk = true;
@@ -170681,39 +170931,48 @@ var TextStorage = class {
170681
170931
  return !!this.fileSize ? this.fileSize : !!this.text ? this.text.length : !!this.svc ? this.svc.getSnapshot().getLength() : this.getSnapshot().getLength();
170682
170932
  }
170683
170933
  getSnapshot() {
170684
- return this.useScriptVersionCacheIfValidOrOpen() ? this.svc.getSnapshot() : ScriptSnapshot.fromString(this.getOrLoadText());
170934
+ var _a2, _b;
170935
+ return ((_a2 = this.tryUseScriptVersionCache()) == null ? void 0 : _a2.getSnapshot()) || ((_b = this.textSnapshot) != null ? _b : this.textSnapshot = ScriptSnapshot.fromString(Debug.checkDefined(this.text)));
170685
170936
  }
170686
- getAbsolutePositionAndLineText(line) {
170687
- return this.switchToScriptVersionCache().getAbsolutePositionAndLineText(line);
170937
+ getAbsolutePositionAndLineText(oneBasedLine) {
170938
+ const svc = this.tryUseScriptVersionCache();
170939
+ if (svc)
170940
+ return svc.getAbsolutePositionAndLineText(oneBasedLine);
170941
+ const lineMap = this.getLineMap();
170942
+ return oneBasedLine <= lineMap.length ? {
170943
+ absolutePosition: lineMap[oneBasedLine - 1],
170944
+ lineText: this.text.substring(lineMap[oneBasedLine - 1], lineMap[oneBasedLine])
170945
+ } : {
170946
+ absolutePosition: this.text.length,
170947
+ lineText: void 0
170948
+ };
170688
170949
  }
170689
170950
  /**
170690
170951
  * @param line 0 based index
170691
170952
  */
170692
170953
  lineToTextSpan(line) {
170693
- if (!this.useScriptVersionCacheIfValidOrOpen()) {
170694
- const lineMap = this.getLineMap();
170695
- const start2 = lineMap[line];
170696
- const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
170697
- return createTextSpanFromBounds(start2, end);
170698
- }
170699
- return this.svc.lineToTextSpan(line);
170954
+ const svc = this.tryUseScriptVersionCache();
170955
+ if (svc)
170956
+ return svc.lineToTextSpan(line);
170957
+ const lineMap = this.getLineMap();
170958
+ const start2 = lineMap[line];
170959
+ const end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length;
170960
+ return createTextSpanFromBounds(start2, end);
170700
170961
  }
170701
170962
  /**
170702
170963
  * @param line 1 based index
170703
170964
  * @param offset 1 based index
170704
170965
  */
170705
170966
  lineOffsetToPosition(line, offset, allowEdits) {
170706
- if (!this.useScriptVersionCacheIfValidOrOpen()) {
170707
- return computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
170708
- }
170709
- return this.svc.lineOffsetToPosition(line, offset);
170967
+ const svc = this.tryUseScriptVersionCache();
170968
+ return svc ? svc.lineOffsetToPosition(line, offset) : computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text, allowEdits);
170710
170969
  }
170711
170970
  positionToLineOffset(position) {
170712
- if (!this.useScriptVersionCacheIfValidOrOpen()) {
170713
- const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
170714
- return { line: line + 1, offset: character + 1 };
170715
- }
170716
- return this.svc.positionToLineOffset(position);
170971
+ const svc = this.tryUseScriptVersionCache();
170972
+ if (svc)
170973
+ return svc.positionToLineOffset(position);
170974
+ const { line, character } = computeLineAndCharacterOfPosition(this.getLineMap(), position);
170975
+ return { line: line + 1, offset: character + 1 };
170717
170976
  }
170718
170977
  getFileTextAndSize(tempFileName) {
170719
170978
  let text;
@@ -170731,19 +170990,25 @@ var TextStorage = class {
170731
170990
  }
170732
170991
  return { text: getText() };
170733
170992
  }
170993
+ /** @internal */
170734
170994
  switchToScriptVersionCache() {
170735
170995
  if (!this.svc || this.pendingReloadFromDisk) {
170736
170996
  this.svc = ScriptVersionCache.fromString(this.getOrLoadText());
170737
- this.version.svc++;
170997
+ this.textSnapshot = void 0;
170998
+ this.version++;
170738
170999
  }
170739
171000
  return this.svc;
170740
171001
  }
170741
- useScriptVersionCacheIfValidOrOpen() {
170742
- if (this.isOpen) {
170743
- return this.switchToScriptVersionCache();
171002
+ tryUseScriptVersionCache() {
171003
+ if (!this.svc || this.pendingReloadFromDisk) {
171004
+ this.getOrLoadText();
170744
171005
  }
170745
- if (this.pendingReloadFromDisk) {
170746
- this.reloadWithFileText();
171006
+ if (this.isOpen) {
171007
+ if (!this.svc && !this.textSnapshot) {
171008
+ this.svc = ScriptVersionCache.fromString(Debug.checkDefined(this.text));
171009
+ this.textSnapshot = void 0;
171010
+ }
171011
+ return this.svc;
170747
171012
  }
170748
171013
  return this.svc;
170749
171014
  }
@@ -170756,13 +171021,14 @@ var TextStorage = class {
170756
171021
  }
170757
171022
  getLineMap() {
170758
171023
  Debug.assert(!this.svc, "ScriptVersionCache should not be set");
170759
- return this.lineMap || (this.lineMap = computeLineStarts(this.getOrLoadText()));
171024
+ return this.lineMap || (this.lineMap = computeLineStarts(Debug.checkDefined(this.text)));
170760
171025
  }
170761
171026
  getLineInfo() {
170762
- if (this.svc) {
171027
+ const svc = this.tryUseScriptVersionCache();
171028
+ if (svc) {
170763
171029
  return {
170764
- getLineCount: () => this.svc.getLineCount(),
170765
- getLineText: (line) => this.svc.getAbsolutePositionAndLineText(line + 1).lineText
171030
+ getLineCount: () => svc.getLineCount(),
171031
+ getLineText: (line) => svc.getAbsolutePositionAndLineText(line + 1).lineText
170766
171032
  };
170767
171033
  }
170768
171034
  const lineMap = this.getLineMap();
@@ -170786,20 +171052,11 @@ var ScriptInfo = class {
170786
171052
  this.isDynamic = isDynamicFileName(fileName);
170787
171053
  this.textStorage = new TextStorage(host, this, initialVersion);
170788
171054
  if (hasMixedContent || this.isDynamic) {
170789
- this.textStorage.reload("");
170790
171055
  this.realpath = this.path;
170791
171056
  }
170792
171057
  this.scriptKind = scriptKind ? scriptKind : getScriptKindFromFileName(fileName);
170793
171058
  }
170794
171059
  /** @internal */
170795
- getVersion() {
170796
- return this.textStorage.version;
170797
- }
170798
- /** @internal */
170799
- getTelemetryFileSize() {
170800
- return this.textStorage.getTelemetryFileSize();
170801
- }
170802
- /** @internal */
170803
171060
  isDynamicOrHasMixedContent() {
170804
171061
  return this.hasMixedContent || this.isDynamic;
170805
171062
  }
@@ -170814,11 +171071,7 @@ var ScriptInfo = class {
170814
171071
  }
170815
171072
  close(fileExists = true) {
170816
171073
  this.textStorage.isOpen = false;
170817
- if (this.isDynamicOrHasMixedContent() || !fileExists) {
170818
- if (this.textStorage.reload("")) {
170819
- this.markContainingProjectsAsDirty();
170820
- }
170821
- } else if (this.textStorage.reloadFromDisk()) {
171074
+ if (fileExists && this.textStorage.scheduleReloadIfNeeded()) {
170822
171075
  this.markContainingProjectsAsDirty();
170823
171076
  }
170824
171077
  }
@@ -170998,22 +171251,12 @@ var ScriptInfo = class {
170998
171251
  this.markContainingProjectsAsDirty();
170999
171252
  }
171000
171253
  reloadFromFile(tempFileName) {
171001
- if (this.isDynamicOrHasMixedContent()) {
171002
- this.textStorage.reload("");
171254
+ if (this.textStorage.reloadWithFileText(tempFileName)) {
171003
171255
  this.markContainingProjectsAsDirty();
171004
171256
  return true;
171005
- } else {
171006
- if (this.textStorage.reloadWithFileText(tempFileName)) {
171007
- this.markContainingProjectsAsDirty();
171008
- return true;
171009
- }
171010
171257
  }
171011
171258
  return false;
171012
171259
  }
171013
- /** @internal */
171014
- getAbsolutePositionAndLineText(line) {
171015
- return this.textStorage.getAbsolutePositionAndLineText(line);
171016
- }
171017
171260
  editContent(start2, end, newText) {
171018
171261
  this.textStorage.edit(start2, end, newText);
171019
171262
  this.markContainingProjectsAsDirty();
@@ -171053,10 +171296,6 @@ var ScriptInfo = class {
171053
171296
  return this.scriptKind === 1 /* JS */ || this.scriptKind === 2 /* JSX */;
171054
171297
  }
171055
171298
  /** @internal */
171056
- getLineInfo() {
171057
- return this.textStorage.getLineInfo();
171058
- }
171059
- /** @internal */
171060
171299
  closeSourceMapFileWatcher() {
171061
171300
  if (this.sourceMapFilePath && !isString(this.sourceMapFilePath)) {
171062
171301
  closeFileWatcherOf(this.sourceMapFilePath);
@@ -171201,7 +171440,7 @@ function countEachFileTypes(infos, includeSizes = false) {
171201
171440
  deferredSize: 0
171202
171441
  };
171203
171442
  for (const info of infos) {
171204
- const fileSize = includeSizes ? info.getTelemetryFileSize() : 0;
171443
+ const fileSize = includeSizes ? info.textStorage.getTelemetryFileSize() : 0;
171205
171444
  switch (info.scriptKind) {
171206
171445
  case 1 /* JS */:
171207
171446
  result.js += 1;
@@ -172185,10 +172424,26 @@ var Project3 = class {
172185
172424
  const elapsed = timestamp() - start2;
172186
172425
  this.sendPerformanceEvent("UpdateGraph", elapsed);
172187
172426
  this.writeLog(`Finishing updateGraphWorker: Project: ${this.getProjectName()} Version: ${this.getProjectVersion()} structureChanged: ${hasNewProgram}${this.program ? ` structureIsReused:: ${StructureIsReused[this.program.structureIsReused]}` : ""} Elapsed: ${elapsed}ms`);
172188
- if (this.hasAddedorRemovedFiles) {
172427
+ if (this.projectService.logger.isTestLogger) {
172428
+ if (this.program !== oldProgram) {
172429
+ this.print(
172430
+ /*writeProjectFileNames*/
172431
+ true,
172432
+ this.hasAddedorRemovedFiles,
172433
+ /*writeFileVersionAndText*/
172434
+ true
172435
+ );
172436
+ } else {
172437
+ this.writeLog(`Same program as before`);
172438
+ }
172439
+ } else if (this.hasAddedorRemovedFiles) {
172189
172440
  this.print(
172190
172441
  /*writeProjectFileNames*/
172191
- true
172442
+ true,
172443
+ /*writeFileExplaination*/
172444
+ true,
172445
+ /*writeFileVersionAndText*/
172446
+ false
172192
172447
  );
172193
172448
  } else if (this.program !== oldProgram) {
172194
172449
  this.writeLog(`Different program with same set of files`);
@@ -172298,6 +172553,16 @@ var Project3 = class {
172298
172553
  return this.projectService.getScriptInfo(uncheckedFileName);
172299
172554
  }
172300
172555
  filesToString(writeProjectFileNames) {
172556
+ return this.filesToStringWorker(
172557
+ writeProjectFileNames,
172558
+ /*writeFileExplaination*/
172559
+ true,
172560
+ /*writeFileVersionAndText*/
172561
+ false
172562
+ );
172563
+ }
172564
+ /** @internal */
172565
+ filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
172301
172566
  if (this.isInitialLoadPending())
172302
172567
  return " Files (0) InitialLoadPending\n";
172303
172568
  if (!this.program)
@@ -172307,23 +172572,33 @@ var Project3 = class {
172307
172572
  `;
172308
172573
  if (writeProjectFileNames) {
172309
172574
  for (const file of sourceFiles) {
172310
- strBuilder += ` ${file.fileName}
172575
+ strBuilder += ` ${file.fileName}${writeFileVersionAndText ? ` ${file.version} ${JSON.stringify(file.text)}` : ""}
172311
172576
  `;
172312
172577
  }
172313
- strBuilder += "\n\n";
172314
- explainFiles(this.program, (s) => strBuilder += ` ${s}
172578
+ if (writeFileExplaination) {
172579
+ strBuilder += "\n\n";
172580
+ explainFiles(this.program, (s) => strBuilder += ` ${s}
172315
172581
  `);
172582
+ }
172316
172583
  }
172317
172584
  return strBuilder;
172318
172585
  }
172319
172586
  /** @internal */
172320
- print(writeProjectFileNames) {
172587
+ print(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
172321
172588
  this.writeLog(`Project '${this.projectName}' (${ProjectKind[this.projectKind]})`);
172322
- this.writeLog(this.filesToString(writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */)));
172589
+ this.writeLog(this.filesToStringWorker(
172590
+ writeProjectFileNames && this.projectService.logger.hasLevel(3 /* verbose */),
172591
+ writeFileExplaination && this.projectService.logger.hasLevel(3 /* verbose */),
172592
+ writeFileVersionAndText && this.projectService.logger.hasLevel(3 /* verbose */)
172593
+ ));
172323
172594
  this.writeLog("-----------------------------------------------");
172324
172595
  if (this.autoImportProviderHost) {
172325
172596
  this.autoImportProviderHost.print(
172326
172597
  /*writeProjectFileNames*/
172598
+ false,
172599
+ /*writeFileExplaination*/
172600
+ false,
172601
+ /*writeFileVersionAndText*/
172327
172602
  false
172328
172603
  );
172329
172604
  }
@@ -173347,7 +173622,7 @@ var ConfiguredProject2 = class extends Project3 {
173347
173622
  return !!this.externalProjectRefCount;
173348
173623
  }
173349
173624
  getEffectiveTypeRoots() {
173350
- return getEffectiveTypeRoots(this.getCompilationSettings(), this.directoryStructureHost) || [];
173625
+ return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
173351
173626
  }
173352
173627
  /** @internal */
173353
173628
  updateErrorOnNoInputFiles(fileNames) {
@@ -174278,7 +174553,11 @@ var _ProjectService = class {
174278
174553
  this.logger.info("`remove Project::");
174279
174554
  project.print(
174280
174555
  /*writeProjectFileNames*/
174281
- true
174556
+ true,
174557
+ /*writeFileExplaination*/
174558
+ true,
174559
+ /*writeFileVersionAndText*/
174560
+ false
174282
174561
  );
174283
174562
  project.close();
174284
174563
  if (Debug.shouldAssert(1 /* Normal */)) {
@@ -174417,7 +174696,7 @@ var _ProjectService = class {
174417
174696
  }
174418
174697
  deleteScriptInfo(info) {
174419
174698
  this.filenameToScriptInfo.delete(info.path);
174420
- this.filenameToScriptInfoVersion.set(info.path, info.getVersion());
174699
+ this.filenameToScriptInfoVersion.set(info.path, info.textStorage.version);
174421
174700
  const realpath = info.getRealpathIfDifferent();
174422
174701
  if (realpath) {
174423
174702
  this.realpathToScriptInfos.remove(realpath, info);
@@ -175501,7 +175780,7 @@ Dynamic files must always be opened with service's current directory or service
175501
175780
  const documentPositionMapper = getDocumentPositionMapper(
175502
175781
  { getCanonicalFileName: this.toCanonicalFileName, log: (s) => this.logger.info(s), getSourceFileLike: (f) => this.getSourceFileLike(f, projectName, declarationInfo) },
175503
175782
  declarationInfo.fileName,
175504
- declarationInfo.getLineInfo(),
175783
+ declarationInfo.textStorage.getLineInfo(),
175505
175784
  readMapFile
175506
175785
  );
175507
175786
  readMapFile = void 0;
@@ -176632,6 +176911,10 @@ function isConfigFile(config) {
176632
176911
  function printProjectWithoutFileNames(project) {
176633
176912
  project.print(
176634
176913
  /*writeProjectFileNames*/
176914
+ false,
176915
+ /*writeFileExplaination*/
176916
+ false,
176917
+ /*writeFileVersionAndText*/
176635
176918
  false
176636
176919
  );
176637
176920
  }
@@ -177270,7 +177553,6 @@ var invalidSyntacticModeCommands = [
177270
177553
  "signatureHelp-full" /* SignatureHelpFull */,
177271
177554
  "navto" /* Navto */,
177272
177555
  "navto-full" /* NavtoFull */,
177273
- "occurrences" /* Occurrences */,
177274
177556
  "documentHighlights" /* DocumentHighlights */,
177275
177557
  "documentHighlights-full" /* DocumentHighlightsFull */
177276
177558
  ];
@@ -177703,9 +177985,6 @@ var Session3 = class {
177703
177985
  false
177704
177986
  ));
177705
177987
  },
177706
- ["occurrences" /* Occurrences */]: (request) => {
177707
- return this.requiredResponse(this.getOccurrences(request.arguments));
177708
- },
177709
177988
  ["documentHighlights" /* DocumentHighlights */]: (request) => {
177710
177989
  return this.requiredResponse(this.getDocumentHighlights(
177711
177990
  request.arguments,
@@ -178668,21 +178947,6 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
178668
178947
  const implementations = this.mapImplementationLocations(project.getLanguageService().getImplementationAtPosition(file, position) || emptyArray2, project);
178669
178948
  return simplifiedResult ? implementations.map(({ fileName, textSpan, contextSpan }) => this.toFileSpanWithContext(fileName, textSpan, contextSpan, project)) : implementations.map(Session3.mapToOriginalLocation);
178670
178949
  }
178671
- getOccurrences(args) {
178672
- const { file, project } = this.getFileAndProject(args);
178673
- const position = this.getPositionInFile(args, file);
178674
- const occurrences = project.getLanguageService().getOccurrencesAtPosition(file, position);
178675
- return occurrences ? occurrences.map((occurrence) => {
178676
- const { fileName, isWriteAccess: isWriteAccess2, textSpan, isInString: isInString2, contextSpan } = occurrence;
178677
- const scriptInfo = project.getScriptInfo(fileName);
178678
- return {
178679
- ...toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo),
178680
- file: fileName,
178681
- isWriteAccess: isWriteAccess2,
178682
- ...isInString2 ? { isInString: isInString2 } : void 0
178683
- };
178684
- }) : emptyArray2;
178685
- }
178686
178950
  getSyntacticDiagnosticsSync(args) {
178687
178951
  const { configFile } = this.getConfigFileAndProject(args);
178688
178952
  if (configFile) {
@@ -179093,7 +179357,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
179093
179357
  formatOptions
179094
179358
  );
179095
179359
  if (args.key === "\n" && (!edits || edits.length === 0 || allEditsBeforePos(edits, position))) {
179096
- const { lineText, absolutePosition } = scriptInfo.getAbsolutePositionAndLineText(args.line);
179360
+ const { lineText, absolutePosition } = scriptInfo.textStorage.getAbsolutePositionAndLineText(args.line);
179097
179361
  if (lineText && lineText.search("\\S") < 0) {
179098
179362
  const preferredIndent = languageService.getIndentationAtPosition(file, position, formatOptions);
179099
179363
  let hasIndent = 0;
@@ -179318,6 +179582,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
179318
179582
  change(args) {
179319
179583
  const scriptInfo = this.projectService.getScriptInfo(args.file);
179320
179584
  Debug.assert(!!scriptInfo);
179585
+ scriptInfo.textStorage.switchToScriptVersionCache();
179321
179586
  const start2 = scriptInfo.lineOffsetToPosition(args.line, args.offset);
179322
179587
  const end = scriptInfo.lineOffsetToPosition(args.endLine, args.endOffset);
179323
179588
  if (start2 >= 0) {
@@ -179610,10 +179875,10 @@ ${e.message}`;
179610
179875
  }
179611
179876
  return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
179612
179877
  }
179613
- getCombinedCodeFix({ scope, fixId: fixId51 }, simplifiedResult) {
179878
+ getCombinedCodeFix({ scope, fixId: fixId52 }, simplifiedResult) {
179614
179879
  Debug.assert(scope.type === "file");
179615
179880
  const { file, project } = this.getFileAndProject(scope.args);
179616
- const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId51, this.getFormatOptions(file), this.getPreferences(file));
179881
+ const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId52, this.getFormatOptions(file), this.getPreferences(file));
179617
179882
  if (simplifiedResult) {
179618
179883
  return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
179619
179884
  } else {
@@ -179652,8 +179917,8 @@ ${e.message}`;
179652
179917
  mapCodeAction({ description: description2, changes, commands }) {
179653
179918
  return { description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands };
179654
179919
  }
179655
- mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId: fixId51, fixAllDescription }) {
179656
- return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId51, fixAllDescription };
179920
+ mapCodeFixAction({ fixName: fixName8, description: description2, changes, commands, fixId: fixId52, fixAllDescription }) {
179921
+ return { fixName: fixName8, description: description2, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId52, fixAllDescription };
179657
179922
  }
179658
179923
  mapTextChangesToCodeEdits(textChanges2) {
179659
179924
  return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
@@ -182053,7 +182318,6 @@ start(initializeNodeSystem(), require("os").platform());
182053
182318
  createTypeChecker,
182054
182319
  createTypeReferenceDirectiveResolutionCache,
182055
182320
  createTypeReferenceResolutionLoader,
182056
- createUnderscoreEscapedMultiMap,
182057
182321
  createUnparsedSourceFile,
182058
182322
  createWatchCompilerHost,
182059
182323
  createWatchCompilerHostOfConfigFile,
@@ -183464,7 +183728,6 @@ start(initializeNodeSystem(), require("os").platform());
183464
183728
  nodeToDisplayParts,
183465
183729
  noop,
183466
183730
  noopFileWatcher,
183467
- noopPush,
183468
183731
  normalizePath,
183469
183732
  normalizeSlashes,
183470
183733
  not,