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/typescript.js CHANGED
@@ -35,7 +35,7 @@ var ts = (() => {
35
35
  "src/compiler/corePublic.ts"() {
36
36
  "use strict";
37
37
  versionMajorMinor = "5.2";
38
- version = `${versionMajorMinor}.0-dev.20230611`;
38
+ version = `${versionMajorMinor}.0-dev.20230613`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -9032,6 +9032,9 @@ ${lanes.join("\n")}
9032
9032
  Use_type_0: diag(95181, 3 /* Message */, "Use_type_0_95181", "Use 'type {0}'"),
9033
9033
  Fix_all_with_type_only_imports: diag(95182, 3 /* Message */, "Fix_all_with_type_only_imports_95182", "Fix all with type-only imports"),
9034
9034
  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"),
9035
+ Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
9036
+ Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
9037
+ 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."),
9035
9038
  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."),
9036
9039
  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'."),
9037
9040
  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?"),
@@ -45394,9 +45397,9 @@ ${lanes.join("\n")}
45394
45397
  candidatesOutArray,
45395
45398
  /*argumentCount*/
45396
45399
  void 0,
45397
- 64 /* IsForStringLiteralArgumentCompletions */
45400
+ 32 /* IsForStringLiteralArgumentCompletions */
45398
45401
  )),
45399
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
45402
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
45400
45403
  getExpandedParameters,
45401
45404
  hasEffectiveRestParameter,
45402
45405
  containsArgumentsReference,
@@ -53351,7 +53354,7 @@ ${lanes.join("\n")}
53351
53354
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
53352
53355
  }
53353
53356
  function getTypeForBindingElement(declaration) {
53354
- const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
53357
+ const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
53355
53358
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
53356
53359
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
53357
53360
  }
@@ -55108,19 +55111,13 @@ ${lanes.join("\n")}
55108
55111
  if (getObjectFlags(type) & 4 /* Reference */) {
55109
55112
  const target = type.target;
55110
55113
  const typeArguments = getTypeArguments(type);
55111
- if (length(target.typeParameters) === length(typeArguments)) {
55112
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
55113
- return needApparentType ? getApparentType(ref) : ref;
55114
- }
55114
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
55115
55115
  } else if (type.flags & 2097152 /* Intersection */) {
55116
55116
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
55117
55117
  return types !== type.types ? getIntersectionType(types) : type;
55118
55118
  }
55119
55119
  return needApparentType ? getApparentType(type) : type;
55120
55120
  }
55121
- function getThisArgument(type) {
55122
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
55123
- }
55124
55121
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
55125
55122
  let mapper;
55126
55123
  let members;
@@ -56186,7 +56183,7 @@ ${lanes.join("\n")}
56186
56183
  return type.resolvedBaseConstraint;
56187
56184
  }
56188
56185
  const stack = [];
56189
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
56186
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
56190
56187
  function getImmediateBaseConstraint(t) {
56191
56188
  if (!t.immediateBaseConstraint) {
56192
56189
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -56278,18 +56275,18 @@ ${lanes.join("\n")}
56278
56275
  }
56279
56276
  if (isGenericTupleType(t)) {
56280
56277
  const newElements = map(getElementTypes(t), (v, i) => {
56281
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56282
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56278
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56279
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56283
56280
  });
56284
56281
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
56285
56282
  }
56286
56283
  return t;
56287
56284
  }
56288
56285
  }
56289
- function getApparentTypeOfIntersectionType(type) {
56286
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
56290
56287
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
56291
56288
  type,
56292
- type,
56289
+ thisArgument,
56293
56290
  /*needApparentType*/
56294
56291
  true
56295
56292
  ));
@@ -56340,8 +56337,9 @@ ${lanes.join("\n")}
56340
56337
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
56341
56338
  }
56342
56339
  function getApparentType(type) {
56343
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
56344
- 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;
56340
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
56341
+ const objectFlags = getObjectFlags(t);
56342
+ 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;
56345
56343
  }
56346
56344
  function getReducedApparentType(type) {
56347
56345
  return getReducedType(getApparentType(getReducedType(type)));
@@ -63170,7 +63168,7 @@ ${lanes.join("\n")}
63170
63168
  return 3 /* Maybe */;
63171
63169
  }
63172
63170
  const c = target2;
63173
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63171
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
63174
63172
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63175
63173
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
63176
63174
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -68256,7 +68254,7 @@ ${lanes.join("\n")}
68256
68254
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
68257
68255
  }
68258
68256
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
68259
- 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(
68257
+ 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(
68260
68258
  node,
68261
68259
  /*contextFlags*/
68262
68260
  void 0
@@ -68903,6 +68901,25 @@ ${lanes.join("\n")}
68903
68901
  return t.flags & 2097152 /* Intersection */ ? forEach(t.types, getThisTypeArgument) : getThisTypeArgument(t);
68904
68902
  });
68905
68903
  }
68904
+ function getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType) {
68905
+ let literal = containingLiteral;
68906
+ let type = contextualType;
68907
+ while (type) {
68908
+ const thisType = getThisTypeFromContextualType(type);
68909
+ if (thisType) {
68910
+ return thisType;
68911
+ }
68912
+ if (literal.parent.kind !== 302 /* PropertyAssignment */) {
68913
+ break;
68914
+ }
68915
+ literal = literal.parent.parent;
68916
+ type = getApparentTypeOfContextualType(
68917
+ literal,
68918
+ /*contextFlags*/
68919
+ void 0
68920
+ );
68921
+ }
68922
+ }
68906
68923
  function getContextualThisParameterType(func) {
68907
68924
  if (func.kind === 218 /* ArrowFunction */) {
68908
68925
  return void 0;
@@ -68925,22 +68942,9 @@ ${lanes.join("\n")}
68925
68942
  /*contextFlags*/
68926
68943
  void 0
68927
68944
  );
68928
- let literal = containingLiteral;
68929
- let type = contextualType;
68930
- while (type) {
68931
- const thisType = getThisTypeFromContextualType(type);
68932
- if (thisType) {
68933
- return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
68934
- }
68935
- if (literal.parent.kind !== 302 /* PropertyAssignment */) {
68936
- break;
68937
- }
68938
- literal = literal.parent.parent;
68939
- type = getApparentTypeOfContextualType(
68940
- literal,
68941
- /*contextFlags*/
68942
- void 0
68943
- );
68945
+ const thisType = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
68946
+ if (thisType) {
68947
+ return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
68944
68948
  }
68945
68949
  return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral));
68946
68950
  }
@@ -69013,7 +69017,7 @@ ${lanes.join("\n")}
69013
69017
  function getContextualTypeForBindingElement(declaration, contextFlags) {
69014
69018
  const parent2 = declaration.parent.parent;
69015
69019
  const name = declaration.propertyName || declaration.name;
69016
- const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
69020
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
69017
69021
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
69018
69022
  return void 0;
69019
69023
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -70062,9 +70066,7 @@ ${lanes.join("\n")}
70062
70066
  elementTypes.push(undefinedOrMissingType);
70063
70067
  elementFlags.push(2 /* Optional */);
70064
70068
  } else {
70065
- const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
70066
- const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70067
- const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
70069
+ const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
70068
70070
  elementTypes.push(addOptionality(
70069
70071
  type,
70070
70072
  /*isProperty*/
@@ -70072,7 +70074,7 @@ ${lanes.join("\n")}
70072
70074
  hasOmittedExpression
70073
70075
  ));
70074
70076
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
70075
- if (shouldAddAsIntraExpressionInferenceSite) {
70077
+ if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
70076
70078
  const inferenceContext = getInferenceContext(node);
70077
70079
  Debug.assert(inferenceContext);
70078
70080
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -70213,13 +70215,11 @@ ${lanes.join("\n")}
70213
70215
  let member = getSymbolOfDeclaration(memberDecl);
70214
70216
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
70215
70217
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
70216
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
70217
- const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70218
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
70218
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
70219
70219
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
70220
70220
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
70221
70221
  // we don't want to say "could not find 'a'".
70222
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
70222
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
70223
70223
  );
70224
70224
  if (isInJavascript) {
70225
70225
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -70263,7 +70263,7 @@ ${lanes.join("\n")}
70263
70263
  prop.links.target = member;
70264
70264
  member = prop;
70265
70265
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
70266
- if (shouldAddAsIntraExpressionInferenceSite) {
70266
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
70267
70267
  const inferenceContext = getInferenceContext(node);
70268
70268
  Debug.assert(inferenceContext);
70269
70269
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -70436,9 +70436,7 @@ ${lanes.join("\n")}
70436
70436
  for (const attributeDecl of attributes.properties) {
70437
70437
  const member = attributeDecl.symbol;
70438
70438
  if (isJsxAttribute(attributeDecl)) {
70439
- const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
70440
- const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70441
- const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
70439
+ const exprType = checkJsxAttribute(attributeDecl, checkMode);
70442
70440
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
70443
70441
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
70444
70442
  attributeSymbol.declarations = member.declarations;
@@ -70459,7 +70457,7 @@ ${lanes.join("\n")}
70459
70457
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
70460
70458
  }
70461
70459
  }
70462
- if (shouldAddAsIntraExpressionInferenceSite) {
70460
+ if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
70463
70461
  const inferenceContext = getInferenceContext(attributes);
70464
70462
  Debug.assert(inferenceContext);
70465
70463
  const inferenceNode = attributeDecl.initializer.expression;
@@ -72077,7 +72075,7 @@ ${lanes.join("\n")}
72077
72075
  }
72078
72076
  for (let i = 0; i < argCount; i++) {
72079
72077
  const arg = args[i];
72080
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72078
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72081
72079
  const paramType = getTypeAtPosition(signature, i);
72082
72080
  if (couldContainTypeVariables(paramType)) {
72083
72081
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -72690,12 +72688,12 @@ ${lanes.join("\n")}
72690
72688
  const args = getEffectiveCallArguments(node);
72691
72689
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
72692
72690
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
72693
- argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72691
+ argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72694
72692
  let candidatesForArgumentError;
72695
72693
  let candidateForArgumentArityError;
72696
72694
  let candidateForTypeArgumentError;
72697
72695
  let result;
72698
- const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72696
+ const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72699
72697
  if (candidates.length > 1) {
72700
72698
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
72701
72699
  }
@@ -72914,7 +72912,7 @@ ${lanes.join("\n")}
72914
72912
  continue;
72915
72913
  }
72916
72914
  if (argCheckMode) {
72917
- argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72915
+ argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72918
72916
  if (inferenceContext) {
72919
72917
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72920
72918
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -75992,8 +75990,9 @@ ${lanes.join("\n")}
75992
75990
  case 36 /* ExclamationEqualsToken */:
75993
75991
  case 37 /* EqualsEqualsEqualsToken */:
75994
75992
  case 38 /* ExclamationEqualsEqualsToken */:
75995
- if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
75996
- if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75993
+ if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
75994
+ if ((isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) && // only report for === and !== in JS, not == or !=
75995
+ (!isInJSFile(left) || (operator === 37 /* EqualsEqualsEqualsToken */ || operator === 38 /* ExclamationEqualsEqualsToken */))) {
75997
75996
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75998
75997
  error2(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
75999
75998
  }
@@ -76651,7 +76650,7 @@ ${lanes.join("\n")}
76651
76650
  }
76652
76651
  }
76653
76652
  const startInvocationCount = flowInvocationCount;
76654
- const type = checkExpression(node, 256 /* TypeOnly */);
76653
+ const type = checkExpression(node, 128 /* TypeOnly */);
76655
76654
  if (flowInvocationCount !== startInvocationCount) {
76656
76655
  const cache = flowTypeCache || (flowTypeCache = []);
76657
76656
  cache[getNodeId(node)] = type;
@@ -79122,7 +79121,7 @@ ${lanes.join("\n")}
79122
79121
  checkComputedPropertyName(node.propertyName);
79123
79122
  }
79124
79123
  const parent2 = node.parent.parent;
79125
- const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
79124
+ const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
79126
79125
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
79127
79126
  const name = node.propertyName || node.name;
79128
79127
  if (parentType && !isBindingPattern(name)) {
@@ -82712,7 +82711,7 @@ ${lanes.join("\n")}
82712
82711
  /*contextFlags*/
82713
82712
  void 0
82714
82713
  );
82715
- const type = contextualType && getThisTypeFromContextualType(contextualType);
82714
+ const type = getThisTypeOfObjectLiteralFromContextualType(containingLiteral, contextualType);
82716
82715
  return type && !isTypeAny(type);
82717
82716
  }
82718
82717
  }
@@ -85858,11 +85857,10 @@ ${lanes.join("\n")}
85858
85857
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
85859
85858
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
85860
85859
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
85861
- CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
85862
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
85863
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
85864
- CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
85865
- CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
85860
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
85861
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
85862
+ CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
85863
+ CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
85866
85864
  return CheckMode3;
85867
85865
  })(CheckMode || {});
85868
85866
  SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -120027,7 +120025,9 @@ ${lanes.join("\n")}
120027
120025
  Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations.code,
120028
120026
  Diagnostics.Class_constructor_may_not_be_a_generator.code,
120029
120027
  Diagnostics.Class_constructor_may_not_be_an_accessor.code,
120030
- Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code
120028
+ Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules.code,
120029
+ // Type errors
120030
+ Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value.code
120031
120031
  ]);
120032
120032
  emitSkippedWithNoDiagnostics = { diagnostics: emptyArray, sourceMaps: void 0, emittedFiles: void 0, emitSkipped: true };
120033
120033
  }
@@ -134051,8 +134051,8 @@ ${lanes.join("\n")}
134051
134051
  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);
134052
134052
  }));
134053
134053
  }
134054
- function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) {
134055
- const refactor = refactors.get(refactorName13);
134054
+ function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
134055
+ const refactor = refactors.get(refactorName14);
134056
134056
  return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
134057
134057
  }
134058
134058
  var refactors;
@@ -134858,6 +134858,155 @@ ${lanes.join("\n")}
134858
134858
  }
134859
134859
  });
134860
134860
 
134861
+ // src/services/refactors/inlineVariable.ts
134862
+ function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
134863
+ var _a, _b;
134864
+ const checker = program.getTypeChecker();
134865
+ const token = getTouchingPropertyName(file, startPosition);
134866
+ const parent2 = token.parent;
134867
+ if (!isIdentifier(token)) {
134868
+ return void 0;
134869
+ }
134870
+ if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2)) {
134871
+ if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) {
134872
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
134873
+ }
134874
+ if (isDeclarationExported(parent2)) {
134875
+ return void 0;
134876
+ }
134877
+ const references = getReferenceNodes(parent2, checker, file);
134878
+ return references && { references, declaration: parent2, replacement: parent2.initializer };
134879
+ }
134880
+ if (tryWithReferenceToken) {
134881
+ let definition = checker.resolveName(
134882
+ token.text,
134883
+ token,
134884
+ 111551 /* Value */,
134885
+ /*excludeGlobals*/
134886
+ false
134887
+ );
134888
+ definition = definition && checker.getMergedSymbol(definition);
134889
+ if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
134890
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
134891
+ }
134892
+ const declaration = definition.declarations[0];
134893
+ if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
134894
+ return void 0;
134895
+ }
134896
+ if (isDeclarationExported(declaration)) {
134897
+ return void 0;
134898
+ }
134899
+ const references = getReferenceNodes(declaration, checker, file);
134900
+ return references && { references, declaration, replacement: declaration.initializer };
134901
+ }
134902
+ return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
134903
+ }
134904
+ function isDeclarationExported(declaration) {
134905
+ const variableStatement = cast(declaration.parent.parent, isVariableStatement);
134906
+ return some(variableStatement.modifiers, isExportModifier);
134907
+ }
134908
+ function getReferenceNodes(declaration, checker, file) {
134909
+ const references = [];
134910
+ const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
134911
+ if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
134912
+ return true;
134913
+ }
134914
+ if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
134915
+ return true;
134916
+ }
134917
+ if (isTypeQueryNode(ref.parent)) {
134918
+ return true;
134919
+ }
134920
+ if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
134921
+ return true;
134922
+ }
134923
+ references.push(ref);
134924
+ });
134925
+ return references.length === 0 || cannotInline ? void 0 : references;
134926
+ }
134927
+ function getReplacementExpression(reference, replacement) {
134928
+ replacement = getSynthesizedDeepClone(replacement);
134929
+ const { parent: parent2 } = reference;
134930
+ if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
134931
+ return factory.createParenthesizedExpression(replacement);
134932
+ }
134933
+ if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
134934
+ return factory.createParenthesizedExpression(replacement);
134935
+ }
134936
+ return replacement;
134937
+ }
134938
+ var refactorName4, refactorDescription, inlineVariableAction;
134939
+ var init_inlineVariable = __esm({
134940
+ "src/services/refactors/inlineVariable.ts"() {
134941
+ "use strict";
134942
+ init_ts4();
134943
+ init_ts_refactor();
134944
+ refactorName4 = "Inline variable";
134945
+ refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
134946
+ inlineVariableAction = {
134947
+ name: refactorName4,
134948
+ description: refactorDescription,
134949
+ kind: "refactor.inline.variable"
134950
+ };
134951
+ registerRefactor(refactorName4, {
134952
+ kinds: [inlineVariableAction.kind],
134953
+ getAvailableActions(context) {
134954
+ const {
134955
+ file,
134956
+ program,
134957
+ preferences,
134958
+ startPosition,
134959
+ triggerReason
134960
+ } = context;
134961
+ const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
134962
+ if (!info) {
134963
+ return emptyArray;
134964
+ }
134965
+ if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
134966
+ return [{
134967
+ name: refactorName4,
134968
+ description: refactorDescription,
134969
+ actions: [inlineVariableAction]
134970
+ }];
134971
+ }
134972
+ if (preferences.provideRefactorNotApplicableReason) {
134973
+ return [{
134974
+ name: refactorName4,
134975
+ description: refactorDescription,
134976
+ actions: [{
134977
+ ...inlineVariableAction,
134978
+ notApplicableReason: info.error
134979
+ }]
134980
+ }];
134981
+ }
134982
+ return emptyArray;
134983
+ },
134984
+ getEditsForAction(context, actionName2) {
134985
+ Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
134986
+ const { file, program, startPosition } = context;
134987
+ const info = getInliningInfo(
134988
+ file,
134989
+ startPosition,
134990
+ /*tryWithReferenceToken*/
134991
+ true,
134992
+ program
134993
+ );
134994
+ if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
134995
+ return void 0;
134996
+ }
134997
+ const { references, declaration, replacement } = info;
134998
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
134999
+ for (const node of references) {
135000
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
135001
+ }
135002
+ tracker.delete(file, declaration);
135003
+ });
135004
+ return { edits };
135005
+ }
135006
+ });
135007
+ }
135008
+ });
135009
+
134861
135010
  // src/services/refactors/moveToNewFile.ts
134862
135011
  function doChange3(oldFile, program, toMove, changes, host, preferences, context) {
134863
135012
  const checker = program.getTypeChecker();
@@ -134939,29 +135088,29 @@ ${lanes.join("\n")}
134939
135088
  append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference));
134940
135089
  return copiedOldImports;
134941
135090
  }
134942
- var refactorName4, description, moveToNewFileAction;
135091
+ var refactorName5, description, moveToNewFileAction;
134943
135092
  var init_moveToNewFile = __esm({
134944
135093
  "src/services/refactors/moveToNewFile.ts"() {
134945
135094
  "use strict";
134946
135095
  init_ts4();
134947
135096
  init_ts_refactor();
134948
- refactorName4 = "Move to a new file";
135097
+ refactorName5 = "Move to a new file";
134949
135098
  description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
134950
135099
  moveToNewFileAction = {
134951
- name: refactorName4,
135100
+ name: refactorName5,
134952
135101
  description,
134953
135102
  kind: "refactor.move.newFile"
134954
135103
  };
134955
- registerRefactor(refactorName4, {
135104
+ registerRefactor(refactorName5, {
134956
135105
  kinds: [moveToNewFileAction.kind],
134957
135106
  getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
134958
135107
  const statements = getStatementsToMove(context);
134959
135108
  if (context.preferences.allowTextChangesInNewFiles && statements) {
134960
- return [{ name: refactorName4, description, actions: [moveToNewFileAction] }];
135109
+ return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
134961
135110
  }
134962
135111
  if (context.preferences.provideRefactorNotApplicableReason) {
134963
135112
  return [{
134964
- name: refactorName4,
135113
+ name: refactorName5,
134965
135114
  description,
134966
135115
  actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
134967
135116
  }];
@@ -134969,7 +135118,7 @@ ${lanes.join("\n")}
134969
135118
  return emptyArray;
134970
135119
  },
134971
135120
  getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
134972
- Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
135121
+ Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
134973
135122
  const statements = Debug.checkDefined(getStatementsToMove(context));
134974
135123
  const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
134975
135124
  return { edits, renameFilename: void 0, renameLocation: void 0 };
@@ -135887,8 +136036,8 @@ ${lanes.join("\n")}
135887
136036
  if (!info)
135888
136037
  return emptyArray;
135889
136038
  return [{
135890
- name: refactorName5,
135891
- description: refactorDescription,
136039
+ name: refactorName6,
136040
+ description: refactorDescription2,
135892
136041
  actions: [functionOverloadAction]
135893
136042
  }];
135894
136043
  }
@@ -136079,20 +136228,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136079
136228
  }
136080
136229
  return signatureDecls;
136081
136230
  }
136082
- var refactorName5, refactorDescription, functionOverloadAction;
136231
+ var refactorName6, refactorDescription2, functionOverloadAction;
136083
136232
  var init_convertOverloadListToSingleSignature = __esm({
136084
136233
  "src/services/refactors/convertOverloadListToSingleSignature.ts"() {
136085
136234
  "use strict";
136086
136235
  init_ts4();
136087
136236
  init_ts_refactor();
136088
- refactorName5 = "Convert overload list to single signature";
136089
- refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
136237
+ refactorName6 = "Convert overload list to single signature";
136238
+ refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
136090
136239
  functionOverloadAction = {
136091
- name: refactorName5,
136092
- description: refactorDescription,
136240
+ name: refactorName6,
136241
+ description: refactorDescription2,
136093
136242
  kind: "refactor.rewrite.function.overloadList"
136094
136243
  };
136095
- registerRefactor(refactorName5, {
136244
+ registerRefactor(refactorName6, {
136096
136245
  kinds: [functionOverloadAction.kind],
136097
136246
  getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
136098
136247
  getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
@@ -136108,8 +136257,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136108
136257
  return emptyArray;
136109
136258
  if (!isRefactorErrorInfo(info)) {
136110
136259
  return [{
136111
- name: refactorName6,
136112
- description: refactorDescription2,
136260
+ name: refactorName7,
136261
+ description: refactorDescription3,
136113
136262
  actions: [
136114
136263
  info.addBraces ? addBracesAction : removeBracesAction
136115
136264
  ]
@@ -136117,8 +136266,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136117
136266
  }
136118
136267
  if (context.preferences.provideRefactorNotApplicableReason) {
136119
136268
  return [{
136120
- name: refactorName6,
136121
- description: refactorDescription2,
136269
+ name: refactorName7,
136270
+ description: refactorDescription3,
136122
136271
  actions: [
136123
136272
  { ...addBracesAction, notApplicableReason: info.error },
136124
136273
  { ...removeBracesAction, notApplicableReason: info.error }
@@ -136209,14 +136358,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136209
136358
  }
136210
136359
  return void 0;
136211
136360
  }
136212
- var refactorName6, refactorDescription2, addBracesAction, removeBracesAction;
136361
+ var refactorName7, refactorDescription3, addBracesAction, removeBracesAction;
136213
136362
  var init_addOrRemoveBracesToArrowFunction = __esm({
136214
136363
  "src/services/refactors/addOrRemoveBracesToArrowFunction.ts"() {
136215
136364
  "use strict";
136216
136365
  init_ts4();
136217
136366
  init_ts_refactor();
136218
- refactorName6 = "Add or remove braces in an arrow function";
136219
- refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136367
+ refactorName7 = "Add or remove braces in an arrow function";
136368
+ refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136220
136369
  addBracesAction = {
136221
136370
  name: "Add braces to arrow function",
136222
136371
  description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
@@ -136227,7 +136376,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136227
136376
  description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
136228
136377
  kind: "refactor.rewrite.arrow.braces.remove"
136229
136378
  };
136230
- registerRefactor(refactorName6, {
136379
+ registerRefactor(refactorName7, {
136231
136380
  kinds: [removeBracesAction.kind],
136232
136381
  getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
136233
136382
  getAvailableActions: getRefactorActionsToRemoveFunctionBraces
@@ -136279,8 +136428,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136279
136428
  }
136280
136429
  }
136281
136430
  return [{
136282
- name: refactorName7,
136283
- description: refactorDescription3,
136431
+ name: refactorName8,
136432
+ description: refactorDescription4,
136284
136433
  actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
136285
136434
  }];
136286
136435
  }
@@ -136440,14 +136589,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136440
136589
  function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
136441
136590
  return !!node.name && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile);
136442
136591
  }
136443
- var refactorName7, refactorDescription3, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction;
136592
+ var refactorName8, refactorDescription4, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction;
136444
136593
  var init_convertArrowFunctionOrFunctionExpression = __esm({
136445
136594
  "src/services/refactors/convertArrowFunctionOrFunctionExpression.ts"() {
136446
136595
  "use strict";
136447
136596
  init_ts4();
136448
136597
  init_ts_refactor();
136449
- refactorName7 = "Convert arrow function or function expression";
136450
- refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
136598
+ refactorName8 = "Convert arrow function or function expression";
136599
+ refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
136451
136600
  toAnonymousFunctionAction = {
136452
136601
  name: "Convert to anonymous function",
136453
136602
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
@@ -136463,7 +136612,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136463
136612
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
136464
136613
  kind: "refactor.rewrite.function.arrow"
136465
136614
  };
136466
- registerRefactor(refactorName7, {
136615
+ registerRefactor(refactorName8, {
136467
136616
  kinds: [
136468
136617
  toAnonymousFunctionAction.kind,
136469
136618
  toNamedFunctionAction.kind,
@@ -136494,13 +136643,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136494
136643
  if (!functionDeclaration)
136495
136644
  return emptyArray;
136496
136645
  return [{
136497
- name: refactorName8,
136498
- description: refactorDescription4,
136646
+ name: refactorName9,
136647
+ description: refactorDescription5,
136499
136648
  actions: [toDestructuredAction]
136500
136649
  }];
136501
136650
  }
136502
136651
  function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
136503
- Debug.assert(actionName2 === refactorName8, "Unexpected action name");
136652
+ Debug.assert(actionName2 === refactorName9, "Unexpected action name");
136504
136653
  const { file, startPosition, program, cancellationToken, host } = context;
136505
136654
  const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
136506
136655
  if (!functionDeclaration || !cancellationToken)
@@ -137010,21 +137159,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137010
137159
  return Debug.assertNever(functionDeclaration, `Unexpected function declaration kind ${functionDeclaration.kind}`);
137011
137160
  }
137012
137161
  }
137013
- var refactorName8, minimumParameterLength, refactorDescription4, toDestructuredAction;
137162
+ var refactorName9, minimumParameterLength, refactorDescription5, toDestructuredAction;
137014
137163
  var init_convertParamsToDestructuredObject = __esm({
137015
137164
  "src/services/refactors/convertParamsToDestructuredObject.ts"() {
137016
137165
  "use strict";
137017
137166
  init_ts4();
137018
137167
  init_ts_refactor();
137019
- refactorName8 = "Convert parameters to destructured object";
137168
+ refactorName9 = "Convert parameters to destructured object";
137020
137169
  minimumParameterLength = 1;
137021
- refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
137170
+ refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
137022
137171
  toDestructuredAction = {
137023
- name: refactorName8,
137024
- description: refactorDescription4,
137172
+ name: refactorName9,
137173
+ description: refactorDescription5,
137025
137174
  kind: "refactor.rewrite.parameters.toDestructured"
137026
137175
  };
137027
- registerRefactor(refactorName8, {
137176
+ registerRefactor(refactorName9, {
137028
137177
  kinds: [toDestructuredAction.kind],
137029
137178
  getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
137030
137179
  getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
@@ -137046,7 +137195,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137046
137195
  const { file, startPosition } = context;
137047
137196
  const node = getNodeOrParentOfParentheses(file, startPosition);
137048
137197
  const maybeBinary = getParentBinaryExpression(node);
137049
- const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] };
137198
+ const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
137050
137199
  if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137051
137200
  refactorInfo.actions.push(convertStringAction);
137052
137201
  return [refactorInfo];
@@ -137072,7 +137221,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137072
137221
  const { file, startPosition } = context;
137073
137222
  const node = getNodeOrParentOfParentheses(file, startPosition);
137074
137223
  switch (actionName2) {
137075
- case refactorDescription5:
137224
+ case refactorDescription6:
137076
137225
  return { edits: getEditsForToTemplateLiteral(context, node) };
137077
137226
  default:
137078
137227
  return Debug.fail("invalid action");
@@ -137223,20 +137372,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137223
137372
  }
137224
137373
  return node;
137225
137374
  }
137226
- var refactorName9, refactorDescription5, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode;
137375
+ var refactorName10, refactorDescription6, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode;
137227
137376
  var init_convertStringOrTemplateLiteral = __esm({
137228
137377
  "src/services/refactors/convertStringOrTemplateLiteral.ts"() {
137229
137378
  "use strict";
137230
137379
  init_ts4();
137231
137380
  init_ts_refactor();
137232
- refactorName9 = "Convert to template string";
137233
- refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
137381
+ refactorName10 = "Convert to template string";
137382
+ refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
137234
137383
  convertStringAction = {
137235
- name: refactorName9,
137236
- description: refactorDescription5,
137384
+ name: refactorName10,
137385
+ description: refactorDescription6,
137237
137386
  kind: "refactor.rewrite.string"
137238
137387
  };
137239
- registerRefactor(refactorName9, {
137388
+ registerRefactor(refactorName10, {
137240
137389
  kinds: [convertStringAction.kind],
137241
137390
  getEditsForAction: getRefactorEditsToConvertToTemplateString,
137242
137391
  getAvailableActions: getRefactorActionsToConvertToTemplateString
@@ -137286,14 +137435,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137286
137435
  return emptyArray;
137287
137436
  if (!isRefactorErrorInfo(info)) {
137288
137437
  return [{
137289
- name: refactorName10,
137438
+ name: refactorName11,
137290
137439
  description: convertToOptionalChainExpressionMessage,
137291
137440
  actions: [toOptionalChainAction]
137292
137441
  }];
137293
137442
  }
137294
137443
  if (context.preferences.provideRefactorNotApplicableReason) {
137295
137444
  return [{
137296
- name: refactorName10,
137445
+ name: refactorName11,
137297
137446
  description: convertToOptionalChainExpressionMessage,
137298
137447
  actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
137299
137448
  }];
@@ -137477,20 +137626,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137477
137626
  }
137478
137627
  }
137479
137628
  }
137480
- var refactorName10, convertToOptionalChainExpressionMessage, toOptionalChainAction;
137629
+ var refactorName11, convertToOptionalChainExpressionMessage, toOptionalChainAction;
137481
137630
  var init_convertToOptionalChainExpression = __esm({
137482
137631
  "src/services/refactors/convertToOptionalChainExpression.ts"() {
137483
137632
  "use strict";
137484
137633
  init_ts4();
137485
137634
  init_ts_refactor();
137486
- refactorName10 = "Convert to optional chain expression";
137635
+ refactorName11 = "Convert to optional chain expression";
137487
137636
  convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
137488
137637
  toOptionalChainAction = {
137489
- name: refactorName10,
137638
+ name: refactorName11,
137490
137639
  description: convertToOptionalChainExpressionMessage,
137491
137640
  kind: "refactor.rewrite.expression.optionalChain"
137492
137641
  };
137493
- registerRefactor(refactorName10, {
137642
+ registerRefactor(refactorName11, {
137494
137643
  kinds: [toOptionalChainAction.kind],
137495
137644
  getEditsForAction: getRefactorEditsToConvertToOptionalChain,
137496
137645
  getAvailableActions: getRefactorActionsToConvertToOptionalChain
@@ -137519,14 +137668,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137519
137668
  const errors = [];
137520
137669
  if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
137521
137670
  errors.push({
137522
- name: refactorName11,
137671
+ name: refactorName12,
137523
137672
  description: extractFunctionAction.description,
137524
137673
  actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
137525
137674
  });
137526
137675
  }
137527
137676
  if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
137528
137677
  errors.push({
137529
- name: refactorName11,
137678
+ name: refactorName12,
137530
137679
  description: extractConstantAction.description,
137531
137680
  actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
137532
137681
  });
@@ -137590,26 +137739,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137590
137739
  const infos = [];
137591
137740
  if (functionActions.length) {
137592
137741
  infos.push({
137593
- name: refactorName11,
137742
+ name: refactorName12,
137594
137743
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
137595
137744
  actions: functionActions
137596
137745
  });
137597
137746
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
137598
137747
  infos.push({
137599
- name: refactorName11,
137748
+ name: refactorName12,
137600
137749
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
137601
137750
  actions: [innermostErrorFunctionAction]
137602
137751
  });
137603
137752
  }
137604
137753
  if (constantActions.length) {
137605
137754
  infos.push({
137606
- name: refactorName11,
137755
+ name: refactorName12,
137607
137756
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
137608
137757
  actions: constantActions
137609
137758
  });
137610
137759
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
137611
137760
  infos.push({
137612
- name: refactorName11,
137761
+ name: refactorName12,
137613
137762
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
137614
137763
  actions: [innermostErrorConstantAction]
137615
137764
  });
@@ -139040,13 +139189,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139040
139189
  function isStringLiteralJsxAttribute(node) {
139041
139190
  return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent);
139042
139191
  }
139043
- var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
139192
+ var refactorName12, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
139044
139193
  var init_extractSymbol = __esm({
139045
139194
  "src/services/refactors/extractSymbol.ts"() {
139046
139195
  "use strict";
139047
139196
  init_ts4();
139048
139197
  init_ts_refactor();
139049
- refactorName11 = "Extract Symbol";
139198
+ refactorName12 = "Extract Symbol";
139050
139199
  extractConstantAction = {
139051
139200
  name: "Extract Constant",
139052
139201
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
@@ -139057,7 +139206,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139057
139206
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139058
139207
  kind: "refactor.extract.function"
139059
139208
  };
139060
- registerRefactor(refactorName11, {
139209
+ registerRefactor(refactorName12, {
139061
139210
  kinds: [
139062
139211
  extractConstantAction.kind,
139063
139212
  extractFunctionAction.kind
@@ -139208,15 +139357,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139208
139357
  return emptyArray;
139209
139358
  if (!isRefactorErrorInfo(info)) {
139210
139359
  return [{
139211
- name: refactorName12,
139212
- description: refactorDescription6,
139360
+ name: refactorName13,
139361
+ description: refactorDescription7,
139213
139362
  actions: [inferReturnTypeAction]
139214
139363
  }];
139215
139364
  }
139216
139365
  if (context.preferences.provideRefactorNotApplicableReason) {
139217
139366
  return [{
139218
- name: refactorName12,
139219
- description: refactorDescription6,
139367
+ name: refactorName13,
139368
+ description: refactorDescription7,
139220
139369
  actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
139221
139370
  }];
139222
139371
  }
@@ -139275,20 +139424,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139275
139424
  return typeChecker.getReturnTypeOfSignature(signature);
139276
139425
  }
139277
139426
  }
139278
- var refactorName12, refactorDescription6, inferReturnTypeAction;
139427
+ var refactorName13, refactorDescription7, inferReturnTypeAction;
139279
139428
  var init_inferFunctionReturnType = __esm({
139280
139429
  "src/services/refactors/inferFunctionReturnType.ts"() {
139281
139430
  "use strict";
139282
139431
  init_ts4();
139283
139432
  init_ts_refactor();
139284
- refactorName12 = "Infer function return type";
139285
- refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139433
+ refactorName13 = "Infer function return type";
139434
+ refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139286
139435
  inferReturnTypeAction = {
139287
- name: refactorName12,
139288
- description: refactorDescription6,
139436
+ name: refactorName13,
139437
+ description: refactorDescription7,
139289
139438
  kind: "refactor.rewrite.function.returnType"
139290
139439
  };
139291
- registerRefactor(refactorName12, {
139440
+ registerRefactor(refactorName13, {
139292
139441
  kinds: [inferReturnTypeAction.kind],
139293
139442
  getEditsForAction: getRefactorEditsToInferReturnType,
139294
139443
  getAvailableActions: getRefactorActionsToInferReturnType
@@ -139349,6 +139498,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139349
139498
  init_convertImport();
139350
139499
  init_extractType();
139351
139500
  init_helpers();
139501
+ init_inlineVariable();
139352
139502
  init_moveToNewFile();
139353
139503
  init_moveToFile();
139354
139504
  init_ts_refactor_addOrRemoveBracesToArrowFunction();
@@ -140887,10 +141037,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
140887
141037
  const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
140888
141038
  return { newFileName, files };
140889
141039
  }
140890
- function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
141040
+ function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
140891
141041
  synchronizeHostData();
140892
141042
  const file = getValidSourceFile(fileName);
140893
- return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments);
141043
+ return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
140894
141044
  }
140895
141045
  function toLineColumnOffset(fileName, position) {
140896
141046
  if (position === 0) {
@@ -158264,7 +158414,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158264
158414
  case 290 /* JsxAttribute */:
158265
158415
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158266
158416
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158267
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158417
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158268
158418
  }
158269
158419
  case 271 /* ImportDeclaration */:
158270
158420
  case 277 /* ExportDeclaration */:
@@ -161457,6 +161607,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161457
161607
  getTextSpanOfEntry: () => getTextSpanOfEntry,
161458
161608
  isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
161459
161609
  isDeclarationOfSymbol: () => isDeclarationOfSymbol,
161610
+ isWriteAccessForReference: () => isWriteAccessForReference,
161460
161611
  nodeEntry: () => nodeEntry,
161461
161612
  toContextSpan: () => toContextSpan,
161462
161613
  toHighlightSpan: () => toHighlightSpan,
@@ -169663,9 +169814,9 @@ ${options.prefix}` : "\n" : options.prefix
169663
169814
  init_ts5();
169664
169815
  init_deprecate();
169665
169816
  addObjectAllocatorPatcher((objectAllocator2) => {
169666
- const Identifier74 = objectAllocator2.getIdentifierConstructor();
169667
- if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) {
169668
- Object.defineProperty(Identifier74.prototype, "originalKeywordKind", {
169817
+ const Identifier75 = objectAllocator2.getIdentifierConstructor();
169818
+ if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
169819
+ Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
169669
169820
  get: deprecate(function() {
169670
169821
  return identifierToKeywordKind(this);
169671
169822
  }, {
@@ -169677,8 +169828,8 @@ ${options.prefix}` : "\n" : options.prefix
169677
169828
  })
169678
169829
  });
169679
169830
  }
169680
- if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) {
169681
- Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", {
169831
+ if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
169832
+ Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
169682
169833
  get: deprecate(function() {
169683
169834
  return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
169684
169835
  }, {