@typescript-deploys/pr-build 5.2.0-pr-54581-2 → 5.2.0-pr-54281-25

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
@@ -2305,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
2305
2305
 
2306
2306
  // src/compiler/corePublic.ts
2307
2307
  var versionMajorMinor = "5.2";
2308
- var version = `${versionMajorMinor}.0-insiders.20230609`;
2308
+ var version = `${versionMajorMinor}.0-insiders.20230612`;
2309
2309
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2310
2310
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2311
2311
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -11227,6 +11227,9 @@ var Diagnostics = {
11227
11227
  Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
11228
11228
  Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
11229
11229
  Cannot_move_statements_to_the_selected_file: diag(95183, 3 /* Message */, "Cannot_move_statements_to_the_selected_file_95183", "Cannot move statements to the selected file"),
11230
+ Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
11231
+ Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
11232
+ Variables_with_multiple_declarations_cannot_be_inlined: diag(95186, 3 /* Message */, "Variables_with_multiple_declarations_cannot_be_inlined_95186", "Variables with multiple declarations cannot be inlined."),
11230
11233
  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."),
11231
11234
  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'."),
11232
11235
  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?"),
@@ -47322,11 +47325,10 @@ var CheckMode = /* @__PURE__ */ ((CheckMode3) => {
47322
47325
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
47323
47326
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
47324
47327
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
47325
- CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
47326
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
47327
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
47328
- CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
47329
- CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
47328
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
47329
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
47330
+ CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
47331
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
47330
47332
  return CheckMode3;
47331
47333
  })(CheckMode || {});
47332
47334
  var SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -47606,9 +47608,9 @@ function createTypeChecker(host) {
47606
47608
  candidatesOutArray,
47607
47609
  /*argumentCount*/
47608
47610
  void 0,
47609
- 64 /* IsForStringLiteralArgumentCompletions */
47611
+ 32 /* IsForStringLiteralArgumentCompletions */
47610
47612
  )),
47611
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
47613
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
47612
47614
  getExpandedParameters,
47613
47615
  hasEffectiveRestParameter,
47614
47616
  containsArgumentsReference,
@@ -55563,7 +55565,7 @@ function createTypeChecker(host) {
55563
55565
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
55564
55566
  }
55565
55567
  function getTypeForBindingElement(declaration) {
55566
- const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
55568
+ const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
55567
55569
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
55568
55570
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
55569
55571
  }
@@ -70468,7 +70470,7 @@ function createTypeChecker(host) {
70468
70470
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70469
70471
  }
70470
70472
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
70471
- const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 128 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
70473
+ const contextualType = (isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node)) && !((isJsxOpeningElement(node.parent) || isJsxSelfClosingElement(node.parent)) && node.parent.tagName === node) && (checkMode && checkMode & 64 /* RestBindingElement */ ? getContextualType2(node, 8 /* SkipBindingPatterns */) : getContextualType2(
70472
70474
  node,
70473
70475
  /*contextFlags*/
70474
70476
  void 0
@@ -71115,6 +71117,25 @@ function createTypeChecker(host) {
71115
71117
  return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
71116
71118
  });
71117
71119
  }
71120
+ function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
71121
+ let literal = containingLiteral;
71122
+ let type = contextualType;
71123
+ while (type) {
71124
+ const thisType = getThisTypeFromContextualType(type);
71125
+ if (thisType) {
71126
+ return thisType;
71127
+ }
71128
+ if (literal.parent.kind !== 302 /* PropertyAssignment */) {
71129
+ break;
71130
+ }
71131
+ literal = literal.parent.parent;
71132
+ type = getApparentTypeOfContextualType(
71133
+ literal,
71134
+ /*contextFlags*/
71135
+ void 0
71136
+ );
71137
+ }
71138
+ }
71118
71139
  function getContextualThisParameterType(func) {
71119
71140
  if (func.kind === 218 /* ArrowFunction */) {
71120
71141
  return void 0;
@@ -71137,22 +71158,9 @@ function createTypeChecker(host) {
71137
71158
  /*contextFlags*/
71138
71159
  void 0
71139
71160
  );
71140
- let literal = containingLiteral;
71141
- let type = contextualType;
71142
- while (type) {
71143
- const thisType = getThisTypeFromContextualType(type);
71144
- if (thisType) {
71145
- return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
71146
- }
71147
- if (literal.parent.kind !== 302 /* PropertyAssignment */) {
71148
- break;
71149
- }
71150
- literal = literal.parent.parent;
71151
- type = getApparentTypeOfContextualType(
71152
- literal,
71153
- /*contextFlags*/
71154
- void 0
71155
- );
71161
+ const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
71162
+ if (thisType) {
71163
+ return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
71156
71164
  }
71157
71165
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
71158
71166
  }
@@ -71225,7 +71233,7 @@ function createTypeChecker(host) {
71225
71233
  function getContextualTypeForBindingElement(declaration, contextFlags) {
71226
71234
  const parent2 = declaration.parent.parent;
71227
71235
  const name = declaration.propertyName || declaration.name;
71228
- const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
71236
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
71229
71237
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
71230
71238
  return void 0;
71231
71239
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -72274,9 +72282,7 @@ function createTypeChecker(host) {
72274
72282
  elementTypes.push(undefinedOrMissingType);
72275
72283
  elementFlags.push(2 /* Optional */);
72276
72284
  } else {
72277
- const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
72278
- const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72279
- const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
72285
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
72280
72286
  elementTypes.push(addOptionality(
72281
72287
  type,
72282
72288
  /*isProperty*/
@@ -72284,7 +72290,7 @@ function createTypeChecker(host) {
72284
72290
  hasOmittedExpression
72285
72291
  ));
72286
72292
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
72287
- if (shouldAddAsIntraExpressionInferenceSite) {
72293
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
72288
72294
  const inferenceContext = getInferenceContext(node);
72289
72295
  Debug.assert(inferenceContext);
72290
72296
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -72425,13 +72431,11 @@ function createTypeChecker(host) {
72425
72431
  let member = getSymbolOfDeclaration(memberDecl);
72426
72432
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
72427
72433
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
72428
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
72429
- const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72430
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
72434
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
72431
72435
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
72432
72436
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
72433
72437
  // we don't want to say "could not find 'a'".
72434
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
72438
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
72435
72439
  );
72436
72440
  if (isInJavascript) {
72437
72441
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -72475,7 +72479,7 @@ function createTypeChecker(host) {
72475
72479
  prop.links.target = member;
72476
72480
  member = prop;
72477
72481
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
72478
- if (shouldAddAsIntraExpressionInferenceSite) {
72482
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
72479
72483
  const inferenceContext = getInferenceContext(node);
72480
72484
  Debug.assert(inferenceContext);
72481
72485
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -72648,9 +72652,7 @@ function createTypeChecker(host) {
72648
72652
  for (const attributeDecl of attributes.properties) {
72649
72653
  const member = attributeDecl.symbol;
72650
72654
  if (isJsxAttribute(attributeDecl)) {
72651
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
72652
- const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
72653
- const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
72655
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
72654
72656
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
72655
72657
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
72656
72658
  attributeSymbol.declarations = member.declarations;
@@ -72671,7 +72673,7 @@ function createTypeChecker(host) {
72671
72673
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
72672
72674
  }
72673
72675
  }
72674
- if (shouldAddAsIntraExpressionInferenceSite) {
72676
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
72675
72677
  const inferenceContext = getInferenceContext(attributes);
72676
72678
  Debug.assert(inferenceContext);
72677
72679
  const inferenceNode = attributeDecl.initializer.expression;
@@ -74289,7 +74291,7 @@ function createTypeChecker(host) {
74289
74291
  }
74290
74292
  for (let i = 0; i < argCount; i++) {
74291
74293
  const arg = args[i];
74292
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74294
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74293
74295
  const paramType = getTypeAtPosition(signature, i);
74294
74296
  if (couldContainTypeVariables(paramType)) {
74295
74297
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -74902,12 +74904,12 @@ function createTypeChecker(host) {
74902
74904
  const args = getEffectiveCallArguments(node);
74903
74905
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
74904
74906
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
74905
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
74907
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
74906
74908
  let candidatesForArgumentError;
74907
74909
  let candidateForArgumentArityError;
74908
74910
  let candidateForTypeArgumentError;
74909
74911
  let result;
74910
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74912
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74911
74913
  if (candidates.length > 1) {
74912
74914
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
74913
74915
  }
@@ -75126,7 +75128,7 @@ function createTypeChecker(host) {
75126
75128
  continue;
75127
75129
  }
75128
75130
  if (argCheckMode) {
75129
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
75131
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75130
75132
  if (inferenceContext) {
75131
75133
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75132
75134
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -78204,7 +78206,7 @@ function createTypeChecker(host) {
78204
78206
  case 36 /* ExclamationEqualsToken */:
78205
78207
  case 37 /* EqualsEqualsEqualsToken */:
78206
78208
  case 38 /* ExclamationEqualsEqualsToken */:
78207
- if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
78209
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
78208
78210
  if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
78209
78211
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
78210
78212
  error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
@@ -78863,7 +78865,7 @@ function createTypeChecker(host) {
78863
78865
  }
78864
78866
  }
78865
78867
  const startInvocationCount = flowInvocationCount;
78866
- const type = checkExpression(node, 256 /* TypeOnly */);
78868
+ const type = checkExpression(node, 128 /* TypeOnly */);
78867
78869
  if (flowInvocationCount !== startInvocationCount) {
78868
78870
  const cache = flowTypeCache || (flowTypeCache = []);
78869
78871
  cache[getNodeId(node)] = type;
@@ -81334,7 +81336,7 @@ function createTypeChecker(host) {
81334
81336
  checkComputedPropertyName(node.propertyName);
81335
81337
  }
81336
81338
  const parent2 = node.parent.parent;
81337
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
81339
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
81338
81340
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
81339
81341
  const name = node.propertyName || node.name;
81340
81342
  if (parentType && !isBindingPattern(name)) {
@@ -84924,7 +84926,7 @@ function createTypeChecker(host) {
84924
84926
  /*contextFlags*/
84925
84927
  void 0
84926
84928
  );
84927
- const type = contextualType && getThisTypeFromContextualType(contextualType);
84929
+ const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
84928
84930
  return type && !isTypeAny(type);
84929
84931
  }
84930
84932
  }
@@ -135666,8 +135668,8 @@ function getApplicableRefactors(context, includeInteractiveActions) {
135666
135668
  return context.cancellationToken && context.cancellationToken.isCancellationRequested() || !((_a = refactor.kinds) == null ? void 0 : _a.some((kind) => refactorKindBeginsWith(kind, context.kind))) ? void 0 : refactor.getAvailableActions(context, includeInteractiveActions);
135667
135669
  }));
135668
135670
  }
135669
- function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) {
135670
- const refactor = refactors.get(refactorName13);
135671
+ function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
135672
+ const refactor = refactors.get(refactorName14);
135671
135673
  return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
135672
135674
  }
135673
135675
 
@@ -136435,24 +136437,165 @@ function refactorKindBeginsWith(known, requested) {
136435
136437
  return known.substr(0, requested.length) === requested;
136436
136438
  }
136437
136439
 
136440
+ // src/services/refactors/inlineVariable.ts
136441
+ var refactorName4 = "Inline variable";
136442
+ var refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
136443
+ var inlineVariableAction = {
136444
+ name: refactorName4,
136445
+ description: refactorDescription,
136446
+ kind: "refactor.inline.variable"
136447
+ };
136448
+ registerRefactor(refactorName4, {
136449
+ kinds: [inlineVariableAction.kind],
136450
+ getAvailableActions(context) {
136451
+ const {
136452
+ file,
136453
+ program,
136454
+ preferences,
136455
+ startPosition,
136456
+ triggerReason
136457
+ } = context;
136458
+ const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
136459
+ if (!info) {
136460
+ return emptyArray;
136461
+ }
136462
+ if (ts_refactor_exports.isRefactorErrorInfo(info) && preferences.provideRefactorNotApplicableReason) {
136463
+ return [{
136464
+ name: refactorName4,
136465
+ description: refactorDescription,
136466
+ actions: [{
136467
+ ...inlineVariableAction,
136468
+ notApplicableReason: info.error
136469
+ }]
136470
+ }];
136471
+ }
136472
+ if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
136473
+ return [{
136474
+ name: refactorName4,
136475
+ description: refactorDescription,
136476
+ actions: [inlineVariableAction]
136477
+ }];
136478
+ }
136479
+ return emptyArray;
136480
+ },
136481
+ getEditsForAction(context, actionName2) {
136482
+ Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
136483
+ const { file, program, startPosition } = context;
136484
+ const info = getInliningInfo(
136485
+ file,
136486
+ startPosition,
136487
+ /*tryWithReferenceToken*/
136488
+ true,
136489
+ program
136490
+ );
136491
+ if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
136492
+ return void 0;
136493
+ }
136494
+ const { references, declaration, replacement } = info;
136495
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
136496
+ for (const node of references) {
136497
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
136498
+ }
136499
+ tracker.delete(file, declaration);
136500
+ });
136501
+ return { edits };
136502
+ }
136503
+ });
136504
+ function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
136505
+ var _a, _b;
136506
+ const checker = program.getTypeChecker();
136507
+ const token = getTokenAtPosition(file, startPosition);
136508
+ const parent2 = token.parent;
136509
+ if (!isIdentifier(token)) {
136510
+ return void 0;
136511
+ }
136512
+ if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2)) {
136513
+ if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) {
136514
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
136515
+ }
136516
+ if (isDeclarationExported(parent2)) {
136517
+ return void 0;
136518
+ }
136519
+ const references = getReferenceNodes(parent2, checker, file);
136520
+ return references && { references, declaration: parent2, replacement: parent2.initializer };
136521
+ }
136522
+ if (tryWithReferenceToken) {
136523
+ let definition = checker.resolveName(
136524
+ token.text,
136525
+ token,
136526
+ 111551 /* Value */,
136527
+ /*excludeGlobals*/
136528
+ false
136529
+ );
136530
+ definition = definition && checker.getMergedSymbol(definition);
136531
+ if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
136532
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
136533
+ }
136534
+ const declaration = definition.declarations[0];
136535
+ if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
136536
+ return void 0;
136537
+ }
136538
+ if (isDeclarationExported(declaration)) {
136539
+ return void 0;
136540
+ }
136541
+ const references = getReferenceNodes(declaration, checker, file);
136542
+ return references && { references, declaration, replacement: declaration.initializer };
136543
+ }
136544
+ return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
136545
+ }
136546
+ function isDeclarationExported(declaration) {
136547
+ const variableStatement = cast(declaration.parent.parent, isVariableStatement);
136548
+ return some(variableStatement.modifiers, isExportModifier);
136549
+ }
136550
+ function getReferenceNodes(declaration, checker, file) {
136551
+ const references = [];
136552
+ const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
136553
+ if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
136554
+ return true;
136555
+ }
136556
+ if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
136557
+ return true;
136558
+ }
136559
+ if (isTypeQueryNode(ref.parent)) {
136560
+ return true;
136561
+ }
136562
+ if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
136563
+ return true;
136564
+ }
136565
+ references.push(ref);
136566
+ });
136567
+ return references.length === 0 || cannotInline ? void 0 : references;
136568
+ }
136569
+ function getReplacementExpression(reference, replacement) {
136570
+ replacement = getSynthesizedDeepClone(replacement);
136571
+ const { parent: parent2 } = reference;
136572
+ if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
136573
+ return factory.createParenthesizedExpression(replacement);
136574
+ }
136575
+ if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
136576
+ return factory.createParenthesizedExpression(replacement);
136577
+ }
136578
+ return replacement;
136579
+ }
136580
+
136438
136581
  // src/services/refactors/moveToNewFile.ts
136439
- var refactorName4 = "Move to a new file";
136582
+ var refactorName5 = "Move to a new file";
136440
136583
  var description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
136441
136584
  var moveToNewFileAction = {
136442
- name: refactorName4,
136585
+ name: refactorName5,
136443
136586
  description,
136444
136587
  kind: "refactor.move.newFile"
136445
136588
  };
136446
- registerRefactor(refactorName4, {
136589
+ registerRefactor(refactorName5, {
136447
136590
  kinds: [moveToNewFileAction.kind],
136448
136591
  getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
136449
136592
  const statements = getStatementsToMove(context);
136450
136593
  if (context.preferences.allowTextChangesInNewFiles && statements) {
136451
- return [{ name: refactorName4, description, actions: [moveToNewFileAction] }];
136594
+ return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
136452
136595
  }
136453
136596
  if (context.preferences.provideRefactorNotApplicableReason) {
136454
136597
  return [{
136455
- name: refactorName4,
136598
+ name: refactorName5,
136456
136599
  description,
136457
136600
  actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
136458
136601
  }];
@@ -136460,7 +136603,7 @@ registerRefactor(refactorName4, {
136460
136603
  return emptyArray;
136461
136604
  },
136462
136605
  getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
136463
- Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
136606
+ Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
136464
136607
  const statements = Debug.checkDefined(getStatementsToMove(context));
136465
136608
  const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
136466
136609
  return { edits, renameFilename: void 0, renameLocation: void 0 };
@@ -137444,14 +137587,14 @@ function getOverloadRangeToMove(sourceFile, statement) {
137444
137587
  var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
137445
137588
 
137446
137589
  // src/services/refactors/convertOverloadListToSingleSignature.ts
137447
- var refactorName5 = "Convert overload list to single signature";
137448
- var refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
137590
+ var refactorName6 = "Convert overload list to single signature";
137591
+ var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
137449
137592
  var functionOverloadAction = {
137450
- name: refactorName5,
137451
- description: refactorDescription,
137593
+ name: refactorName6,
137594
+ description: refactorDescription2,
137452
137595
  kind: "refactor.rewrite.function.overloadList"
137453
137596
  };
137454
- registerRefactor(refactorName5, {
137597
+ registerRefactor(refactorName6, {
137455
137598
  kinds: [functionOverloadAction.kind],
137456
137599
  getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
137457
137600
  getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
@@ -137462,8 +137605,8 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context) {
137462
137605
  if (!info)
137463
137606
  return emptyArray;
137464
137607
  return [{
137465
- name: refactorName5,
137466
- description: refactorDescription,
137608
+ name: refactorName6,
137609
+ description: refactorDescription2,
137467
137610
  actions: [functionOverloadAction]
137468
137611
  }];
137469
137612
  }
@@ -137656,8 +137799,8 @@ function getConvertableOverloadListAtPosition(file, startPosition, program) {
137656
137799
  }
137657
137800
 
137658
137801
  // src/services/refactors/addOrRemoveBracesToArrowFunction.ts
137659
- var refactorName6 = "Add or remove braces in an arrow function";
137660
- var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
137802
+ var refactorName7 = "Add or remove braces in an arrow function";
137803
+ var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
137661
137804
  var addBracesAction = {
137662
137805
  name: "Add braces to arrow function",
137663
137806
  description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
@@ -137668,7 +137811,7 @@ var removeBracesAction = {
137668
137811
  description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
137669
137812
  kind: "refactor.rewrite.arrow.braces.remove"
137670
137813
  };
137671
- registerRefactor(refactorName6, {
137814
+ registerRefactor(refactorName7, {
137672
137815
  kinds: [removeBracesAction.kind],
137673
137816
  getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
137674
137817
  getAvailableActions: getRefactorActionsToRemoveFunctionBraces
@@ -137680,8 +137823,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
137680
137823
  return emptyArray;
137681
137824
  if (!isRefactorErrorInfo(info)) {
137682
137825
  return [{
137683
- name: refactorName6,
137684
- description: refactorDescription2,
137826
+ name: refactorName7,
137827
+ description: refactorDescription3,
137685
137828
  actions: [
137686
137829
  info.addBraces ? addBracesAction : removeBracesAction
137687
137830
  ]
@@ -137689,8 +137832,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
137689
137832
  }
137690
137833
  if (context.preferences.provideRefactorNotApplicableReason) {
137691
137834
  return [{
137692
- name: refactorName6,
137693
- description: refactorDescription2,
137835
+ name: refactorName7,
137836
+ description: refactorDescription3,
137694
137837
  actions: [
137695
137838
  { ...addBracesAction, notApplicableReason: info.error },
137696
137839
  { ...removeBracesAction, notApplicableReason: info.error }
@@ -137786,8 +137929,8 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
137786
137929
  var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {};
137787
137930
 
137788
137931
  // src/services/refactors/convertArrowFunctionOrFunctionExpression.ts
137789
- var refactorName7 = "Convert arrow function or function expression";
137790
- var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
137932
+ var refactorName8 = "Convert arrow function or function expression";
137933
+ var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
137791
137934
  var toAnonymousFunctionAction = {
137792
137935
  name: "Convert to anonymous function",
137793
137936
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
@@ -137803,7 +137946,7 @@ var toArrowFunctionAction = {
137803
137946
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
137804
137947
  kind: "refactor.rewrite.function.arrow"
137805
137948
  };
137806
- registerRefactor(refactorName7, {
137949
+ registerRefactor(refactorName8, {
137807
137950
  kinds: [
137808
137951
  toAnonymousFunctionAction.kind,
137809
137952
  toNamedFunctionAction.kind,
@@ -137845,8 +137988,8 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
137845
137988
  }
137846
137989
  }
137847
137990
  return [{
137848
- name: refactorName7,
137849
- description: refactorDescription3,
137991
+ name: refactorName8,
137992
+ description: refactorDescription4,
137850
137993
  actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
137851
137994
  }];
137852
137995
  }
@@ -138011,15 +138154,15 @@ function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
138011
138154
  var ts_refactor_convertParamsToDestructuredObject_exports = {};
138012
138155
 
138013
138156
  // src/services/refactors/convertParamsToDestructuredObject.ts
138014
- var refactorName8 = "Convert parameters to destructured object";
138157
+ var refactorName9 = "Convert parameters to destructured object";
138015
138158
  var minimumParameterLength = 1;
138016
- var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
138159
+ var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
138017
138160
  var toDestructuredAction = {
138018
- name: refactorName8,
138019
- description: refactorDescription4,
138161
+ name: refactorName9,
138162
+ description: refactorDescription5,
138020
138163
  kind: "refactor.rewrite.parameters.toDestructured"
138021
138164
  };
138022
- registerRefactor(refactorName8, {
138165
+ registerRefactor(refactorName9, {
138023
138166
  kinds: [toDestructuredAction.kind],
138024
138167
  getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
138025
138168
  getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
@@ -138033,13 +138176,13 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context) {
138033
138176
  if (!functionDeclaration)
138034
138177
  return emptyArray;
138035
138178
  return [{
138036
- name: refactorName8,
138037
- description: refactorDescription4,
138179
+ name: refactorName9,
138180
+ description: refactorDescription5,
138038
138181
  actions: [toDestructuredAction]
138039
138182
  }];
138040
138183
  }
138041
138184
  function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
138042
- Debug.assert(actionName2 === refactorName8, "Unexpected action name");
138185
+ Debug.assert(actionName2 === refactorName9, "Unexpected action name");
138043
138186
  const { file, startPosition, program, cancellationToken, host } = context;
138044
138187
  const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
138045
138188
  if (!functionDeclaration || !cancellationToken)
@@ -138554,14 +138697,14 @@ function getFunctionNames(functionDeclaration) {
138554
138697
  var ts_refactor_convertStringOrTemplateLiteral_exports = {};
138555
138698
 
138556
138699
  // src/services/refactors/convertStringOrTemplateLiteral.ts
138557
- var refactorName9 = "Convert to template string";
138558
- var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
138700
+ var refactorName10 = "Convert to template string";
138701
+ var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
138559
138702
  var convertStringAction = {
138560
- name: refactorName9,
138561
- description: refactorDescription5,
138703
+ name: refactorName10,
138704
+ description: refactorDescription6,
138562
138705
  kind: "refactor.rewrite.string"
138563
138706
  };
138564
- registerRefactor(refactorName9, {
138707
+ registerRefactor(refactorName10, {
138565
138708
  kinds: [convertStringAction.kind],
138566
138709
  getEditsForAction: getRefactorEditsToConvertToTemplateString,
138567
138710
  getAvailableActions: getRefactorActionsToConvertToTemplateString
@@ -138570,7 +138713,7 @@ function getRefactorActionsToConvertToTemplateString(context) {
138570
138713
  const { file, startPosition } = context;
138571
138714
  const node = getNodeOrParentOfParentheses(file, startPosition);
138572
138715
  const maybeBinary = getParentBinaryExpression(node);
138573
- const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] };
138716
+ const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
138574
138717
  if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
138575
138718
  refactorInfo.actions.push(convertStringAction);
138576
138719
  return [refactorInfo];
@@ -138596,7 +138739,7 @@ function getRefactorEditsToConvertToTemplateString(context, actionName2) {
138596
138739
  const { file, startPosition } = context;
138597
138740
  const node = getNodeOrParentOfParentheses(file, startPosition);
138598
138741
  switch (actionName2) {
138599
- case refactorDescription5:
138742
+ case refactorDescription6:
138600
138743
  return { edits: getEditsForToTemplateLiteral(context, node) };
138601
138744
  default:
138602
138745
  return Debug.fail("invalid action");
@@ -138778,14 +138921,14 @@ function getExpressionFromParenthesesOrExpression(node) {
138778
138921
  var ts_refactor_convertToOptionalChainExpression_exports = {};
138779
138922
 
138780
138923
  // src/services/refactors/convertToOptionalChainExpression.ts
138781
- var refactorName10 = "Convert to optional chain expression";
138924
+ var refactorName11 = "Convert to optional chain expression";
138782
138925
  var convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
138783
138926
  var toOptionalChainAction = {
138784
- name: refactorName10,
138927
+ name: refactorName11,
138785
138928
  description: convertToOptionalChainExpressionMessage,
138786
138929
  kind: "refactor.rewrite.expression.optionalChain"
138787
138930
  };
138788
- registerRefactor(refactorName10, {
138931
+ registerRefactor(refactorName11, {
138789
138932
  kinds: [toOptionalChainAction.kind],
138790
138933
  getEditsForAction: getRefactorEditsToConvertToOptionalChain,
138791
138934
  getAvailableActions: getRefactorActionsToConvertToOptionalChain
@@ -138796,14 +138939,14 @@ function getRefactorActionsToConvertToOptionalChain(context) {
138796
138939
  return emptyArray;
138797
138940
  if (!isRefactorErrorInfo(info)) {
138798
138941
  return [{
138799
- name: refactorName10,
138942
+ name: refactorName11,
138800
138943
  description: convertToOptionalChainExpressionMessage,
138801
138944
  actions: [toOptionalChainAction]
138802
138945
  }];
138803
138946
  }
138804
138947
  if (context.preferences.provideRefactorNotApplicableReason) {
138805
138948
  return [{
138806
- name: refactorName10,
138949
+ name: refactorName11,
138807
138950
  description: convertToOptionalChainExpressionMessage,
138808
138951
  actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
138809
138952
  }];
@@ -138999,7 +139142,7 @@ __export(ts_refactor_extractSymbol_exports, {
138999
139142
  });
139000
139143
 
139001
139144
  // src/services/refactors/extractSymbol.ts
139002
- var refactorName11 = "Extract Symbol";
139145
+ var refactorName12 = "Extract Symbol";
139003
139146
  var extractConstantAction = {
139004
139147
  name: "Extract Constant",
139005
139148
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
@@ -139010,7 +139153,7 @@ var extractFunctionAction = {
139010
139153
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139011
139154
  kind: "refactor.extract.function"
139012
139155
  };
139013
- registerRefactor(refactorName11, {
139156
+ registerRefactor(refactorName12, {
139014
139157
  kinds: [
139015
139158
  extractConstantAction.kind,
139016
139159
  extractFunctionAction.kind
@@ -139029,14 +139172,14 @@ function getRefactorActionsToExtractSymbol(context) {
139029
139172
  const errors = [];
139030
139173
  if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
139031
139174
  errors.push({
139032
- name: refactorName11,
139175
+ name: refactorName12,
139033
139176
  description: extractFunctionAction.description,
139034
139177
  actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
139035
139178
  });
139036
139179
  }
139037
139180
  if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
139038
139181
  errors.push({
139039
- name: refactorName11,
139182
+ name: refactorName12,
139040
139183
  description: extractConstantAction.description,
139041
139184
  actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
139042
139185
  });
@@ -139100,26 +139243,26 @@ function getRefactorActionsToExtractSymbol(context) {
139100
139243
  const infos = [];
139101
139244
  if (functionActions.length) {
139102
139245
  infos.push({
139103
- name: refactorName11,
139246
+ name: refactorName12,
139104
139247
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139105
139248
  actions: functionActions
139106
139249
  });
139107
139250
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
139108
139251
  infos.push({
139109
- name: refactorName11,
139252
+ name: refactorName12,
139110
139253
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139111
139254
  actions: [innermostErrorFunctionAction]
139112
139255
  });
139113
139256
  }
139114
139257
  if (constantActions.length) {
139115
139258
  infos.push({
139116
- name: refactorName11,
139259
+ name: refactorName12,
139117
139260
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
139118
139261
  actions: constantActions
139119
139262
  });
139120
139263
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
139121
139264
  infos.push({
139122
- name: refactorName11,
139265
+ name: refactorName12,
139123
139266
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
139124
139267
  actions: [innermostErrorConstantAction]
139125
139268
  });
@@ -140651,14 +140794,14 @@ registerRefactor(actionName, {
140651
140794
  var ts_refactor_inferFunctionReturnType_exports = {};
140652
140795
 
140653
140796
  // src/services/refactors/inferFunctionReturnType.ts
140654
- var refactorName12 = "Infer function return type";
140655
- var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
140797
+ var refactorName13 = "Infer function return type";
140798
+ var refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
140656
140799
  var inferReturnTypeAction = {
140657
- name: refactorName12,
140658
- description: refactorDescription6,
140800
+ name: refactorName13,
140801
+ description: refactorDescription7,
140659
140802
  kind: "refactor.rewrite.function.returnType"
140660
140803
  };
140661
- registerRefactor(refactorName12, {
140804
+ registerRefactor(refactorName13, {
140662
140805
  kinds: [inferReturnTypeAction.kind],
140663
140806
  getEditsForAction: getRefactorEditsToInferReturnType,
140664
140807
  getAvailableActions: getRefactorActionsToInferReturnType
@@ -140677,15 +140820,15 @@ function getRefactorActionsToInferReturnType(context) {
140677
140820
  return emptyArray;
140678
140821
  if (!isRefactorErrorInfo(info)) {
140679
140822
  return [{
140680
- name: refactorName12,
140681
- description: refactorDescription6,
140823
+ name: refactorName13,
140824
+ description: refactorDescription7,
140682
140825
  actions: [inferReturnTypeAction]
140683
140826
  }];
140684
140827
  }
140685
140828
  if (context.preferences.provideRefactorNotApplicableReason) {
140686
140829
  return [{
140687
- name: refactorName12,
140688
- description: refactorDescription6,
140830
+ name: refactorName13,
140831
+ description: refactorDescription7,
140689
140832
  actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
140690
140833
  }];
140691
140834
  }
@@ -142929,10 +143072,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
142929
143072
  const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
142930
143073
  return { newFileName, files };
142931
143074
  }
142932
- function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
143075
+ function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
142933
143076
  synchronizeHostData();
142934
143077
  const file = getValidSourceFile(fileName);
142935
- return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments);
143078
+ return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
142936
143079
  }
142937
143080
  function toLineColumnOffset(fileName, position) {
142938
143081
  if (position === 0) {
@@ -158975,7 +159118,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
158975
159118
  case 290 /* JsxAttribute */:
158976
159119
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158977
159120
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158978
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
159121
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158979
159122
  }
158980
159123
  case 271 /* ImportDeclaration */:
158981
159124
  case 277 /* ExportDeclaration */:
@@ -159659,6 +159802,7 @@ __export(ts_FindAllReferences_exports, {
159659
159802
  getTextSpanOfEntry: () => getTextSpanOfEntry,
159660
159803
  isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
159661
159804
  isDeclarationOfSymbol: () => isDeclarationOfSymbol,
159805
+ isWriteAccessForReference: () => isWriteAccessForReference,
159662
159806
  nodeEntry: () => nodeEntry,
159663
159807
  toContextSpan: () => toContextSpan,
159664
159808
  toHighlightSpan: () => toHighlightSpan,
@@ -172323,9 +172467,9 @@ function buildOverload(name) {
172323
172467
 
172324
172468
  // src/deprecatedCompat/5.0/identifierProperties.ts
172325
172469
  addObjectAllocatorPatcher((objectAllocator2) => {
172326
- const Identifier74 = objectAllocator2.getIdentifierConstructor();
172327
- if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) {
172328
- Object.defineProperty(Identifier74.prototype, "originalKeywordKind", {
172470
+ const Identifier75 = objectAllocator2.getIdentifierConstructor();
172471
+ if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
172472
+ Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
172329
172473
  get: deprecate(function() {
172330
172474
  return identifierToKeywordKind(this);
172331
172475
  }, {
@@ -172337,8 +172481,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
172337
172481
  })
172338
172482
  });
172339
172483
  }
172340
- if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) {
172341
- Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", {
172484
+ if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
172485
+ Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
172342
172486
  get: deprecate(function() {
172343
172487
  return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
172344
172488
  }, {