typescript 5.2.0-dev.20230611 → 5.2.0-dev.20230613

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-dev.20230611`;
2308
+ var version = `${versionMajorMinor}.0-dev.20230613`;
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
  }
@@ -57320,19 +57322,13 @@ function createTypeChecker(host) {
57320
57322
  if (getObjectFlags(type) & 4 /* Reference */) {
57321
57323
  const target = type.target;
57322
57324
  const typeArguments = getTypeArguments(type);
57323
- if (length(target.typeParameters) === length(typeArguments)) {
57324
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
57325
- return needApparentType ? getApparentType(ref) : ref;
57326
- }
57325
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
57327
57326
  } else if (type.flags & 2097152 /* Intersection */) {
57328
57327
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
57329
57328
  return types !== type.types ? getIntersectionType(types) : type;
57330
57329
  }
57331
57330
  return needApparentType ? getApparentType(type) : type;
57332
57331
  }
57333
- function getThisArgument(type) {
57334
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
57335
- }
57336
57332
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
57337
57333
  let mapper;
57338
57334
  let members;
@@ -58398,7 +58394,7 @@ function createTypeChecker(host) {
58398
58394
  return type.resolvedBaseConstraint;
58399
58395
  }
58400
58396
  const stack = [];
58401
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
58397
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
58402
58398
  function getImmediateBaseConstraint(t) {
58403
58399
  if (!t.immediateBaseConstraint) {
58404
58400
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -58490,18 +58486,18 @@ function createTypeChecker(host) {
58490
58486
  }
58491
58487
  if (isGenericTupleType(t)) {
58492
58488
  const newElements = map(getElementTypes(t), (v, i) => {
58493
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
58494
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
58489
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
58490
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
58495
58491
  });
58496
58492
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
58497
58493
  }
58498
58494
  return t;
58499
58495
  }
58500
58496
  }
58501
- function getApparentTypeOfIntersectionType(type) {
58497
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
58502
58498
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
58503
58499
  type,
58504
- type,
58500
+ thisArgument,
58505
58501
  /*needApparentType*/
58506
58502
  true
58507
58503
  ));
@@ -58552,8 +58548,9 @@ function createTypeChecker(host) {
58552
58548
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
58553
58549
  }
58554
58550
  function getApparentType(type) {
58555
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
58556
- return getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58551
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
58552
+ const objectFlags = getObjectFlags(t);
58553
+ return objectFlags & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) : objectFlags & 4 /* Reference */ && t !== type ? getTypeWithThisArgument(t, type) : t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t, type) : t.flags & 402653316 /* StringLike */ ? globalStringType : t.flags & 296 /* NumberLike */ ? globalNumberType : t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType() : t.flags & 528 /* BooleanLike */ ? globalBooleanType : t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType() : t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType : t.flags & 4194304 /* Index */ ? keyofConstraintType : t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType : t;
58557
58554
  }
58558
58555
  function getReducedApparentType(type) {
58559
58556
  return getReducedType(getApparentType(getReducedType(type)));
@@ -65382,7 +65379,7 @@ function createTypeChecker(host) {
65382
65379
  return 3 /* Maybe */;
65383
65380
  }
65384
65381
  const c = target2;
65385
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
65382
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
65386
65383
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
65387
65384
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
65388
65385
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -70468,7 +70465,7 @@ function createTypeChecker(host) {
70468
70465
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
70469
70466
  }
70470
70467
  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(
70468
+ 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
70469
  node,
70473
70470
  /*contextFlags*/
70474
70471
  void 0
@@ -71115,6 +71112,25 @@ function createTypeChecker(host) {
71115
71112
  return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
71116
71113
  });
71117
71114
  }
71115
+ function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
71116
+ let literal = containingLiteral;
71117
+ let type = contextualType;
71118
+ while (type) {
71119
+ const thisType = getThisTypeFromContextualType(type);
71120
+ if (thisType) {
71121
+ return thisType;
71122
+ }
71123
+ if (literal.parent.kind !== 302 /* PropertyAssignment */) {
71124
+ break;
71125
+ }
71126
+ literal = literal.parent.parent;
71127
+ type = getApparentTypeOfContextualType(
71128
+ literal,
71129
+ /*contextFlags*/
71130
+ void 0
71131
+ );
71132
+ }
71133
+ }
71118
71134
  function getContextualThisParameterType(func) {
71119
71135
  if (func.kind === 218 /* ArrowFunction */) {
71120
71136
  return void 0;
@@ -71137,22 +71153,9 @@ function createTypeChecker(host) {
71137
71153
  /*contextFlags*/
71138
71154
  void 0
71139
71155
  );
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
- );
71156
+ const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
71157
+ if (thisType) {
71158
+ return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
71156
71159
  }
71157
71160
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
71158
71161
  }
@@ -71225,7 +71228,7 @@ function createTypeChecker(host) {
71225
71228
  function getContextualTypeForBindingElement(declaration, contextFlags) {
71226
71229
  const parent2 = declaration.parent.parent;
71227
71230
  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 */);
71231
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
71229
71232
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
71230
71233
  return void 0;
71231
71234
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -72274,9 +72277,7 @@ function createTypeChecker(host) {
72274
72277
  elementTypes.push(undefinedOrMissingType);
72275
72278
  elementFlags.push(2 /* Optional */);
72276
72279
  } 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);
72280
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
72280
72281
  elementTypes.push(addOptionality(
72281
72282
  type,
72282
72283
  /*isProperty*/
@@ -72284,7 +72285,7 @@ function createTypeChecker(host) {
72284
72285
  hasOmittedExpression
72285
72286
  ));
72286
72287
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
72287
- if (shouldAddAsIntraExpressionInferenceSite) {
72288
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
72288
72289
  const inferenceContext = getInferenceContext(node);
72289
72290
  Debug.assert(inferenceContext);
72290
72291
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -72425,13 +72426,11 @@ function createTypeChecker(host) {
72425
72426
  let member = getSymbolOfDeclaration(memberDecl);
72426
72427
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
72427
72428
  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) : (
72429
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
72431
72430
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
72432
72431
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
72433
72432
  // 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)
72433
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
72435
72434
  );
72436
72435
  if (isInJavascript) {
72437
72436
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -72475,7 +72474,7 @@ function createTypeChecker(host) {
72475
72474
  prop.links.target = member;
72476
72475
  member = prop;
72477
72476
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
72478
- if (shouldAddAsIntraExpressionInferenceSite) {
72477
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
72479
72478
  const inferenceContext = getInferenceContext(node);
72480
72479
  Debug.assert(inferenceContext);
72481
72480
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -72648,9 +72647,7 @@ function createTypeChecker(host) {
72648
72647
  for (const attributeDecl of attributes.properties) {
72649
72648
  const member = attributeDecl.symbol;
72650
72649
  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);
72650
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
72654
72651
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
72655
72652
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
72656
72653
  attributeSymbol.declarations = member.declarations;
@@ -72671,7 +72668,7 @@ function createTypeChecker(host) {
72671
72668
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
72672
72669
  }
72673
72670
  }
72674
- if (shouldAddAsIntraExpressionInferenceSite) {
72671
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
72675
72672
  const inferenceContext = getInferenceContext(attributes);
72676
72673
  Debug.assert(inferenceContext);
72677
72674
  const inferenceNode = attributeDecl.initializer.expression;
@@ -74289,7 +74286,7 @@ function createTypeChecker(host) {
74289
74286
  }
74290
74287
  for (let i = 0; i < argCount; i++) {
74291
74288
  const arg = args[i];
74292
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74289
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
74293
74290
  const paramType = getTypeAtPosition(signature, i);
74294
74291
  if (couldContainTypeVariables(paramType)) {
74295
74292
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -74902,12 +74899,12 @@ function createTypeChecker(host) {
74902
74899
  const args = getEffectiveCallArguments(node);
74903
74900
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
74904
74901
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
74905
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
74902
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
74906
74903
  let candidatesForArgumentError;
74907
74904
  let candidateForArgumentArityError;
74908
74905
  let candidateForTypeArgumentError;
74909
74906
  let result;
74910
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74907
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
74911
74908
  if (candidates.length > 1) {
74912
74909
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
74913
74910
  }
@@ -75126,7 +75123,7 @@ function createTypeChecker(host) {
75126
75123
  continue;
75127
75124
  }
75128
75125
  if (argCheckMode) {
75129
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
75126
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
75130
75127
  if (inferenceContext) {
75131
75128
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
75132
75129
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -78204,8 +78201,9 @@ function createTypeChecker(host) {
78204
78201
  case 36 /* ExclamationEqualsToken */:
78205
78202
  case 37 /* EqualsEqualsEqualsToken */:
78206
78203
  case 38 /* ExclamationEqualsEqualsToken */:
78207
- if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
78208
- if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
78204
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
78205
+ if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
78206
+ (!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
78209
78207
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
78210
78208
  error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
78211
78209
  }
@@ -78863,7 +78861,7 @@ function createTypeChecker(host) {
78863
78861
  }
78864
78862
  }
78865
78863
  const startInvocationCount = flowInvocationCount;
78866
- const type = checkExpression(node, 256 /* TypeOnly */);
78864
+ const type = checkExpression(node, 128 /* TypeOnly */);
78867
78865
  if (flowInvocationCount !== startInvocationCount) {
78868
78866
  const cache = flowTypeCache || (flowTypeCache = []);
78869
78867
  cache[getNodeId(node)] = type;
@@ -81334,7 +81332,7 @@ function createTypeChecker(host) {
81334
81332
  checkComputedPropertyName(node.propertyName);
81335
81333
  }
81336
81334
  const parent2 = node.parent.parent;
81337
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
81335
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
81338
81336
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
81339
81337
  const name = node.propertyName || node.name;
81340
81338
  if (parentType && !isBindingPattern(name)) {
@@ -84924,7 +84922,7 @@ function createTypeChecker(host) {
84924
84922
  /*contextFlags*/
84925
84923
  void 0
84926
84924
  );
84927
- const type = contextualType && getThisTypeFromContextualType(contextualType);
84925
+ const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
84928
84926
  return type && !isTypeAny(type);
84929
84927
  }
84930
84928
  }
@@ -118643,7 +118641,9 @@ var plainJSErrors = /* @__PURE__ */ new Set([
118643
118641
  Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
118644
118642
  Diagnostics.Class_constructor_may_not_be_a_generator.code,
118645
118643
  Diagnostics.Class_constructor_may_not_be_an_accessor.code,
118646
- Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
118644
+ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
118645
+ // Type errors
118646
+ Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
118647
118647
  ]);
118648
118648
  function shouldProgramCreateNewSourceFiles(program, newOptions) {
118649
118649
  if (!program)
@@ -135666,8 +135666,8 @@ function getApplicableRefactors(context, includeInteractiveActions) {
135666
135666
  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
135667
  }));
135668
135668
  }
135669
- function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) {
135670
- const refactor = refactors.get(refactorName13);
135669
+ function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
135670
+ const refactor = refactors.get(refactorName14);
135671
135671
  return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
135672
135672
  }
135673
135673
 
@@ -136435,24 +136435,165 @@ function refactorKindBeginsWith(known, requested) {
136435
136435
  return known.substr(0, requested.length) === requested;
136436
136436
  }
136437
136437
 
136438
+ // src/services/refactors/inlineVariable.ts
136439
+ var refactorName4 = "Inline variable";
136440
+ var refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
136441
+ var inlineVariableAction = {
136442
+ name: refactorName4,
136443
+ description: refactorDescription,
136444
+ kind: "refactor.inline.variable"
136445
+ };
136446
+ registerRefactor(refactorName4, {
136447
+ kinds: [inlineVariableAction.kind],
136448
+ getAvailableActions(context) {
136449
+ const {
136450
+ file,
136451
+ program,
136452
+ preferences,
136453
+ startPosition,
136454
+ triggerReason
136455
+ } = context;
136456
+ const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
136457
+ if (!info) {
136458
+ return emptyArray;
136459
+ }
136460
+ if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
136461
+ return [{
136462
+ name: refactorName4,
136463
+ description: refactorDescription,
136464
+ actions: [inlineVariableAction]
136465
+ }];
136466
+ }
136467
+ if (preferences.provideRefactorNotApplicableReason) {
136468
+ return [{
136469
+ name: refactorName4,
136470
+ description: refactorDescription,
136471
+ actions: [{
136472
+ ...inlineVariableAction,
136473
+ notApplicableReason: info.error
136474
+ }]
136475
+ }];
136476
+ }
136477
+ return emptyArray;
136478
+ },
136479
+ getEditsForAction(context, actionName2) {
136480
+ Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
136481
+ const { file, program, startPosition } = context;
136482
+ const info = getInliningInfo(
136483
+ file,
136484
+ startPosition,
136485
+ /*tryWithReferenceToken*/
136486
+ true,
136487
+ program
136488
+ );
136489
+ if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
136490
+ return void 0;
136491
+ }
136492
+ const { references, declaration, replacement } = info;
136493
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
136494
+ for (const node of references) {
136495
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
136496
+ }
136497
+ tracker.delete(file, declaration);
136498
+ });
136499
+ return { edits };
136500
+ }
136501
+ });
136502
+ function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
136503
+ var _a, _b;
136504
+ const checker = program.getTypeChecker();
136505
+ const token = getTouchingPropertyName(file, startPosition);
136506
+ const parent2 = token.parent;
136507
+ if (!isIdentifier(token)) {
136508
+ return void 0;
136509
+ }
136510
+ if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2)) {
136511
+ if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) {
136512
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
136513
+ }
136514
+ if (isDeclarationExported(parent2)) {
136515
+ return void 0;
136516
+ }
136517
+ const references = getReferenceNodes(parent2, checker, file);
136518
+ return references && { references, declaration: parent2, replacement: parent2.initializer };
136519
+ }
136520
+ if (tryWithReferenceToken) {
136521
+ let definition = checker.resolveName(
136522
+ token.text,
136523
+ token,
136524
+ 111551 /* Value */,
136525
+ /*excludeGlobals*/
136526
+ false
136527
+ );
136528
+ definition = definition && checker.getMergedSymbol(definition);
136529
+ if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
136530
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
136531
+ }
136532
+ const declaration = definition.declarations[0];
136533
+ if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
136534
+ return void 0;
136535
+ }
136536
+ if (isDeclarationExported(declaration)) {
136537
+ return void 0;
136538
+ }
136539
+ const references = getReferenceNodes(declaration, checker, file);
136540
+ return references && { references, declaration, replacement: declaration.initializer };
136541
+ }
136542
+ return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
136543
+ }
136544
+ function isDeclarationExported(declaration) {
136545
+ const variableStatement = cast(declaration.parent.parent, isVariableStatement);
136546
+ return some(variableStatement.modifiers, isExportModifier);
136547
+ }
136548
+ function getReferenceNodes(declaration, checker, file) {
136549
+ const references = [];
136550
+ const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
136551
+ if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
136552
+ return true;
136553
+ }
136554
+ if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
136555
+ return true;
136556
+ }
136557
+ if (isTypeQueryNode(ref.parent)) {
136558
+ return true;
136559
+ }
136560
+ if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
136561
+ return true;
136562
+ }
136563
+ references.push(ref);
136564
+ });
136565
+ return references.length === 0 || cannotInline ? void 0 : references;
136566
+ }
136567
+ function getReplacementExpression(reference, replacement) {
136568
+ replacement = getSynthesizedDeepClone(replacement);
136569
+ const { parent: parent2 } = reference;
136570
+ if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
136571
+ return factory.createParenthesizedExpression(replacement);
136572
+ }
136573
+ if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
136574
+ return factory.createParenthesizedExpression(replacement);
136575
+ }
136576
+ return replacement;
136577
+ }
136578
+
136438
136579
  // src/services/refactors/moveToNewFile.ts
136439
- var refactorName4 = "Move to a new file";
136580
+ var refactorName5 = "Move to a new file";
136440
136581
  var description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
136441
136582
  var moveToNewFileAction = {
136442
- name: refactorName4,
136583
+ name: refactorName5,
136443
136584
  description,
136444
136585
  kind: "refactor.move.newFile"
136445
136586
  };
136446
- registerRefactor(refactorName4, {
136587
+ registerRefactor(refactorName5, {
136447
136588
  kinds: [moveToNewFileAction.kind],
136448
136589
  getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
136449
136590
  const statements = getStatementsToMove(context);
136450
136591
  if (context.preferences.allowTextChangesInNewFiles && statements) {
136451
- return [{ name: refactorName4, description, actions: [moveToNewFileAction] }];
136592
+ return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
136452
136593
  }
136453
136594
  if (context.preferences.provideRefactorNotApplicableReason) {
136454
136595
  return [{
136455
- name: refactorName4,
136596
+ name: refactorName5,
136456
136597
  description,
136457
136598
  actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
136458
136599
  }];
@@ -136460,7 +136601,7 @@ registerRefactor(refactorName4, {
136460
136601
  return emptyArray;
136461
136602
  },
136462
136603
  getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
136463
- Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
136604
+ Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
136464
136605
  const statements = Debug.checkDefined(getStatementsToMove(context));
136465
136606
  const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
136466
136607
  return { edits, renameFilename: void 0, renameLocation: void 0 };
@@ -137444,14 +137585,14 @@ function getOverloadRangeToMove(sourceFile, statement) {
137444
137585
  var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
137445
137586
 
137446
137587
  // 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);
137588
+ var refactorName6 = "Convert overload list to single signature";
137589
+ var refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
137449
137590
  var functionOverloadAction = {
137450
- name: refactorName5,
137451
- description: refactorDescription,
137591
+ name: refactorName6,
137592
+ description: refactorDescription2,
137452
137593
  kind: "refactor.rewrite.function.overloadList"
137453
137594
  };
137454
- registerRefactor(refactorName5, {
137595
+ registerRefactor(refactorName6, {
137455
137596
  kinds: [functionOverloadAction.kind],
137456
137597
  getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
137457
137598
  getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
@@ -137462,8 +137603,8 @@ function getRefactorActionsToConvertOverloadsToOneSignature(context) {
137462
137603
  if (!info)
137463
137604
  return emptyArray;
137464
137605
  return [{
137465
- name: refactorName5,
137466
- description: refactorDescription,
137606
+ name: refactorName6,
137607
+ description: refactorDescription2,
137467
137608
  actions: [functionOverloadAction]
137468
137609
  }];
137469
137610
  }
@@ -137656,8 +137797,8 @@ function getConvertableOverloadListAtPosition(file, startPosition, program) {
137656
137797
  }
137657
137798
 
137658
137799
  // 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);
137800
+ var refactorName7 = "Add or remove braces in an arrow function";
137801
+ var refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
137661
137802
  var addBracesAction = {
137662
137803
  name: "Add braces to arrow function",
137663
137804
  description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
@@ -137668,7 +137809,7 @@ var removeBracesAction = {
137668
137809
  description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
137669
137810
  kind: "refactor.rewrite.arrow.braces.remove"
137670
137811
  };
137671
- registerRefactor(refactorName6, {
137812
+ registerRefactor(refactorName7, {
137672
137813
  kinds: [removeBracesAction.kind],
137673
137814
  getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
137674
137815
  getAvailableActions: getRefactorActionsToRemoveFunctionBraces
@@ -137680,8 +137821,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
137680
137821
  return emptyArray;
137681
137822
  if (!isRefactorErrorInfo(info)) {
137682
137823
  return [{
137683
- name: refactorName6,
137684
- description: refactorDescription2,
137824
+ name: refactorName7,
137825
+ description: refactorDescription3,
137685
137826
  actions: [
137686
137827
  info.addBraces ? addBracesAction : removeBracesAction
137687
137828
  ]
@@ -137689,8 +137830,8 @@ function getRefactorActionsToRemoveFunctionBraces(context) {
137689
137830
  }
137690
137831
  if (context.preferences.provideRefactorNotApplicableReason) {
137691
137832
  return [{
137692
- name: refactorName6,
137693
- description: refactorDescription2,
137833
+ name: refactorName7,
137834
+ description: refactorDescription3,
137694
137835
  actions: [
137695
137836
  { ...addBracesAction, notApplicableReason: info.error },
137696
137837
  { ...removeBracesAction, notApplicableReason: info.error }
@@ -137786,8 +137927,8 @@ function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunc
137786
137927
  var ts_refactor_convertArrowFunctionOrFunctionExpression_exports = {};
137787
137928
 
137788
137929
  // 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);
137930
+ var refactorName8 = "Convert arrow function or function expression";
137931
+ var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
137791
137932
  var toAnonymousFunctionAction = {
137792
137933
  name: "Convert to anonymous function",
137793
137934
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
@@ -137803,7 +137944,7 @@ var toArrowFunctionAction = {
137803
137944
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
137804
137945
  kind: "refactor.rewrite.function.arrow"
137805
137946
  };
137806
- registerRefactor(refactorName7, {
137947
+ registerRefactor(refactorName8, {
137807
137948
  kinds: [
137808
137949
  toAnonymousFunctionAction.kind,
137809
137950
  toNamedFunctionAction.kind,
@@ -137845,8 +137986,8 @@ function getRefactorActionsToConvertFunctionExpressions(context) {
137845
137986
  }
137846
137987
  }
137847
137988
  return [{
137848
- name: refactorName7,
137849
- description: refactorDescription3,
137989
+ name: refactorName8,
137990
+ description: refactorDescription4,
137850
137991
  actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
137851
137992
  }];
137852
137993
  }
@@ -138011,15 +138152,15 @@ function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
138011
138152
  var ts_refactor_convertParamsToDestructuredObject_exports = {};
138012
138153
 
138013
138154
  // src/services/refactors/convertParamsToDestructuredObject.ts
138014
- var refactorName8 = "Convert parameters to destructured object";
138155
+ var refactorName9 = "Convert parameters to destructured object";
138015
138156
  var minimumParameterLength = 1;
138016
- var refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
138157
+ var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
138017
138158
  var toDestructuredAction = {
138018
- name: refactorName8,
138019
- description: refactorDescription4,
138159
+ name: refactorName9,
138160
+ description: refactorDescription5,
138020
138161
  kind: "refactor.rewrite.parameters.toDestructured"
138021
138162
  };
138022
- registerRefactor(refactorName8, {
138163
+ registerRefactor(refactorName9, {
138023
138164
  kinds: [toDestructuredAction.kind],
138024
138165
  getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
138025
138166
  getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
@@ -138033,13 +138174,13 @@ function getRefactorActionsToConvertParametersToDestructuredObject(context) {
138033
138174
  if (!functionDeclaration)
138034
138175
  return emptyArray;
138035
138176
  return [{
138036
- name: refactorName8,
138037
- description: refactorDescription4,
138177
+ name: refactorName9,
138178
+ description: refactorDescription5,
138038
138179
  actions: [toDestructuredAction]
138039
138180
  }];
138040
138181
  }
138041
138182
  function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
138042
- Debug.assert(actionName2 === refactorName8, "Unexpected action name");
138183
+ Debug.assert(actionName2 === refactorName9, "Unexpected action name");
138043
138184
  const { file, startPosition, program, cancellationToken, host } = context;
138044
138185
  const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
138045
138186
  if (!functionDeclaration || !cancellationToken)
@@ -138554,14 +138695,14 @@ function getFunctionNames(functionDeclaration) {
138554
138695
  var ts_refactor_convertStringOrTemplateLiteral_exports = {};
138555
138696
 
138556
138697
  // src/services/refactors/convertStringOrTemplateLiteral.ts
138557
- var refactorName9 = "Convert to template string";
138558
- var refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
138698
+ var refactorName10 = "Convert to template string";
138699
+ var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
138559
138700
  var convertStringAction = {
138560
- name: refactorName9,
138561
- description: refactorDescription5,
138701
+ name: refactorName10,
138702
+ description: refactorDescription6,
138562
138703
  kind: "refactor.rewrite.string"
138563
138704
  };
138564
- registerRefactor(refactorName9, {
138705
+ registerRefactor(refactorName10, {
138565
138706
  kinds: [convertStringAction.kind],
138566
138707
  getEditsForAction: getRefactorEditsToConvertToTemplateString,
138567
138708
  getAvailableActions: getRefactorActionsToConvertToTemplateString
@@ -138570,7 +138711,7 @@ function getRefactorActionsToConvertToTemplateString(context) {
138570
138711
  const { file, startPosition } = context;
138571
138712
  const node = getNodeOrParentOfParentheses(file, startPosition);
138572
138713
  const maybeBinary = getParentBinaryExpression(node);
138573
- const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] };
138714
+ const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
138574
138715
  if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
138575
138716
  refactorInfo.actions.push(convertStringAction);
138576
138717
  return [refactorInfo];
@@ -138596,7 +138737,7 @@ function getRefactorEditsToConvertToTemplateString(context, actionName2) {
138596
138737
  const { file, startPosition } = context;
138597
138738
  const node = getNodeOrParentOfParentheses(file, startPosition);
138598
138739
  switch (actionName2) {
138599
- case refactorDescription5:
138740
+ case refactorDescription6:
138600
138741
  return { edits: getEditsForToTemplateLiteral(context, node) };
138601
138742
  default:
138602
138743
  return Debug.fail("invalid action");
@@ -138778,14 +138919,14 @@ function getExpressionFromParenthesesOrExpression(node) {
138778
138919
  var ts_refactor_convertToOptionalChainExpression_exports = {};
138779
138920
 
138780
138921
  // src/services/refactors/convertToOptionalChainExpression.ts
138781
- var refactorName10 = "Convert to optional chain expression";
138922
+ var refactorName11 = "Convert to optional chain expression";
138782
138923
  var convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
138783
138924
  var toOptionalChainAction = {
138784
- name: refactorName10,
138925
+ name: refactorName11,
138785
138926
  description: convertToOptionalChainExpressionMessage,
138786
138927
  kind: "refactor.rewrite.expression.optionalChain"
138787
138928
  };
138788
- registerRefactor(refactorName10, {
138929
+ registerRefactor(refactorName11, {
138789
138930
  kinds: [toOptionalChainAction.kind],
138790
138931
  getEditsForAction: getRefactorEditsToConvertToOptionalChain,
138791
138932
  getAvailableActions: getRefactorActionsToConvertToOptionalChain
@@ -138796,14 +138937,14 @@ function getRefactorActionsToConvertToOptionalChain(context) {
138796
138937
  return emptyArray;
138797
138938
  if (!isRefactorErrorInfo(info)) {
138798
138939
  return [{
138799
- name: refactorName10,
138940
+ name: refactorName11,
138800
138941
  description: convertToOptionalChainExpressionMessage,
138801
138942
  actions: [toOptionalChainAction]
138802
138943
  }];
138803
138944
  }
138804
138945
  if (context.preferences.provideRefactorNotApplicableReason) {
138805
138946
  return [{
138806
- name: refactorName10,
138947
+ name: refactorName11,
138807
138948
  description: convertToOptionalChainExpressionMessage,
138808
138949
  actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
138809
138950
  }];
@@ -138999,7 +139140,7 @@ __export(ts_refactor_extractSymbol_exports, {
138999
139140
  });
139000
139141
 
139001
139142
  // src/services/refactors/extractSymbol.ts
139002
- var refactorName11 = "Extract Symbol";
139143
+ var refactorName12 = "Extract Symbol";
139003
139144
  var extractConstantAction = {
139004
139145
  name: "Extract Constant",
139005
139146
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
@@ -139010,7 +139151,7 @@ var extractFunctionAction = {
139010
139151
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139011
139152
  kind: "refactor.extract.function"
139012
139153
  };
139013
- registerRefactor(refactorName11, {
139154
+ registerRefactor(refactorName12, {
139014
139155
  kinds: [
139015
139156
  extractConstantAction.kind,
139016
139157
  extractFunctionAction.kind
@@ -139029,14 +139170,14 @@ function getRefactorActionsToExtractSymbol(context) {
139029
139170
  const errors = [];
139030
139171
  if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
139031
139172
  errors.push({
139032
- name: refactorName11,
139173
+ name: refactorName12,
139033
139174
  description: extractFunctionAction.description,
139034
139175
  actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
139035
139176
  });
139036
139177
  }
139037
139178
  if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
139038
139179
  errors.push({
139039
- name: refactorName11,
139180
+ name: refactorName12,
139040
139181
  description: extractConstantAction.description,
139041
139182
  actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
139042
139183
  });
@@ -139100,26 +139241,26 @@ function getRefactorActionsToExtractSymbol(context) {
139100
139241
  const infos = [];
139101
139242
  if (functionActions.length) {
139102
139243
  infos.push({
139103
- name: refactorName11,
139244
+ name: refactorName12,
139104
139245
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139105
139246
  actions: functionActions
139106
139247
  });
139107
139248
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
139108
139249
  infos.push({
139109
- name: refactorName11,
139250
+ name: refactorName12,
139110
139251
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139111
139252
  actions: [innermostErrorFunctionAction]
139112
139253
  });
139113
139254
  }
139114
139255
  if (constantActions.length) {
139115
139256
  infos.push({
139116
- name: refactorName11,
139257
+ name: refactorName12,
139117
139258
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
139118
139259
  actions: constantActions
139119
139260
  });
139120
139261
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
139121
139262
  infos.push({
139122
- name: refactorName11,
139263
+ name: refactorName12,
139123
139264
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
139124
139265
  actions: [innermostErrorConstantAction]
139125
139266
  });
@@ -140651,14 +140792,14 @@ registerRefactor(actionName, {
140651
140792
  var ts_refactor_inferFunctionReturnType_exports = {};
140652
140793
 
140653
140794
  // src/services/refactors/inferFunctionReturnType.ts
140654
- var refactorName12 = "Infer function return type";
140655
- var refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
140795
+ var refactorName13 = "Infer function return type";
140796
+ var refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
140656
140797
  var inferReturnTypeAction = {
140657
- name: refactorName12,
140658
- description: refactorDescription6,
140798
+ name: refactorName13,
140799
+ description: refactorDescription7,
140659
140800
  kind: "refactor.rewrite.function.returnType"
140660
140801
  };
140661
- registerRefactor(refactorName12, {
140802
+ registerRefactor(refactorName13, {
140662
140803
  kinds: [inferReturnTypeAction.kind],
140663
140804
  getEditsForAction: getRefactorEditsToInferReturnType,
140664
140805
  getAvailableActions: getRefactorActionsToInferReturnType
@@ -140677,15 +140818,15 @@ function getRefactorActionsToInferReturnType(context) {
140677
140818
  return emptyArray;
140678
140819
  if (!isRefactorErrorInfo(info)) {
140679
140820
  return [{
140680
- name: refactorName12,
140681
- description: refactorDescription6,
140821
+ name: refactorName13,
140822
+ description: refactorDescription7,
140682
140823
  actions: [inferReturnTypeAction]
140683
140824
  }];
140684
140825
  }
140685
140826
  if (context.preferences.provideRefactorNotApplicableReason) {
140686
140827
  return [{
140687
- name: refactorName12,
140688
- description: refactorDescription6,
140828
+ name: refactorName13,
140829
+ description: refactorDescription7,
140689
140830
  actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
140690
140831
  }];
140691
140832
  }
@@ -142929,10 +143070,10 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
142929
143070
  const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
142930
143071
  return { newFileName, files };
142931
143072
  }
142932
- function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
143073
+ function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
142933
143074
  synchronizeHostData();
142934
143075
  const file = getValidSourceFile(fileName);
142935
- return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments);
143076
+ return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
142936
143077
  }
142937
143078
  function toLineColumnOffset(fileName, position) {
142938
143079
  if (position === 0) {
@@ -158975,7 +159116,7 @@ function getStringLiteralCompletionEntries(sourceFile, node, position, typeCheck
158975
159116
  case 290 /* JsxAttribute */:
158976
159117
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158977
159118
  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();
159119
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158979
159120
  }
158980
159121
  case 271 /* ImportDeclaration */:
158981
159122
  case 277 /* ExportDeclaration */:
@@ -159659,6 +159800,7 @@ __export(ts_FindAllReferences_exports, {
159659
159800
  getTextSpanOfEntry: () => getTextSpanOfEntry,
159660
159801
  isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
159661
159802
  isDeclarationOfSymbol: () => isDeclarationOfSymbol,
159803
+ isWriteAccessForReference: () => isWriteAccessForReference,
159662
159804
  nodeEntry: () => nodeEntry,
159663
159805
  toContextSpan: () => toContextSpan,
159664
159806
  toHighlightSpan: () => toHighlightSpan,
@@ -172323,9 +172465,9 @@ function buildOverload(name) {
172323
172465
 
172324
172466
  // src/deprecatedCompat/5.0/identifierProperties.ts
172325
172467
  addObjectAllocatorPatcher((objectAllocator2) => {
172326
- const Identifier74 = objectAllocator2.getIdentifierConstructor();
172327
- if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) {
172328
- Object.defineProperty(Identifier74.prototype, "originalKeywordKind", {
172468
+ const Identifier75 = objectAllocator2.getIdentifierConstructor();
172469
+ if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
172470
+ Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
172329
172471
  get: deprecate(function() {
172330
172472
  return identifierToKeywordKind(this);
172331
172473
  }, {
@@ -172337,8 +172479,8 @@ addObjectAllocatorPatcher((objectAllocator2) => {
172337
172479
  })
172338
172480
  });
172339
172481
  }
172340
- if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) {
172341
- Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", {
172482
+ if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
172483
+ Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
172342
172484
  get: deprecate(function() {
172343
172485
  return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
172344
172486
  }, {