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.
@@ -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
  }
@@ -134036,8 +134036,8 @@ ${lanes.join("\n")}
134036
134036
  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);
134037
134037
  }));
134038
134038
  }
134039
- function getEditsForRefactor(context, refactorName13, actionName2, interactiveRefactorArguments) {
134040
- const refactor = refactors.get(refactorName13);
134039
+ function getEditsForRefactor(context, refactorName14, actionName2, interactiveRefactorArguments) {
134040
+ const refactor = refactors.get(refactorName14);
134041
134041
  return refactor && refactor.getEditsForAction(context, actionName2, interactiveRefactorArguments);
134042
134042
  }
134043
134043
  var refactors;
@@ -134843,6 +134843,155 @@ ${lanes.join("\n")}
134843
134843
  }
134844
134844
  });
134845
134845
 
134846
+ // src/services/refactors/inlineVariable.ts
134847
+ function getInliningInfo(file, startPosition, tryWithReferenceToken, program) {
134848
+ var _a, _b;
134849
+ const checker = program.getTypeChecker();
134850
+ const token = getTouchingPropertyName(file, startPosition);
134851
+ const parent2 = token.parent;
134852
+ if (!isIdentifier(token)) {
134853
+ return void 0;
134854
+ }
134855
+ if (isInitializedVariable(parent2) && isVariableDeclarationInVariableStatement(parent2)) {
134856
+ if (((_a = checker.getMergedSymbol(parent2.symbol).declarations) == null ? void 0 : _a.length) !== 1) {
134857
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
134858
+ }
134859
+ if (isDeclarationExported(parent2)) {
134860
+ return void 0;
134861
+ }
134862
+ const references = getReferenceNodes(parent2, checker, file);
134863
+ return references && { references, declaration: parent2, replacement: parent2.initializer };
134864
+ }
134865
+ if (tryWithReferenceToken) {
134866
+ let definition = checker.resolveName(
134867
+ token.text,
134868
+ token,
134869
+ 111551 /* Value */,
134870
+ /*excludeGlobals*/
134871
+ false
134872
+ );
134873
+ definition = definition && checker.getMergedSymbol(definition);
134874
+ if (((_b = definition == null ? void 0 : definition.declarations) == null ? void 0 : _b.length) !== 1) {
134875
+ return { error: getLocaleSpecificMessage(Diagnostics.Variables_with_multiple_declarations_cannot_be_inlined) };
134876
+ }
134877
+ const declaration = definition.declarations[0];
134878
+ if (!isInitializedVariable(declaration) || !isVariableDeclarationInVariableStatement(declaration) || !isIdentifier(declaration.name)) {
134879
+ return void 0;
134880
+ }
134881
+ if (isDeclarationExported(declaration)) {
134882
+ return void 0;
134883
+ }
134884
+ const references = getReferenceNodes(declaration, checker, file);
134885
+ return references && { references, declaration, replacement: declaration.initializer };
134886
+ }
134887
+ return { error: getLocaleSpecificMessage(Diagnostics.Could_not_find_variable_to_inline) };
134888
+ }
134889
+ function isDeclarationExported(declaration) {
134890
+ const variableStatement = cast(declaration.parent.parent, isVariableStatement);
134891
+ return some(variableStatement.modifiers, isExportModifier);
134892
+ }
134893
+ function getReferenceNodes(declaration, checker, file) {
134894
+ const references = [];
134895
+ const cannotInline = ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(declaration.name, checker, file, (ref) => {
134896
+ if (ts_FindAllReferences_exports.isWriteAccessForReference(ref)) {
134897
+ return true;
134898
+ }
134899
+ if (isExportSpecifier(ref.parent) || isExportAssignment(ref.parent)) {
134900
+ return true;
134901
+ }
134902
+ if (isTypeQueryNode(ref.parent)) {
134903
+ return true;
134904
+ }
134905
+ if (textRangeContainsPositionInclusive(declaration, ref.pos)) {
134906
+ return true;
134907
+ }
134908
+ references.push(ref);
134909
+ });
134910
+ return references.length === 0 || cannotInline ? void 0 : references;
134911
+ }
134912
+ function getReplacementExpression(reference, replacement) {
134913
+ replacement = getSynthesizedDeepClone(replacement);
134914
+ const { parent: parent2 } = reference;
134915
+ if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
134916
+ return factory.createParenthesizedExpression(replacement);
134917
+ }
134918
+ if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
134919
+ return factory.createParenthesizedExpression(replacement);
134920
+ }
134921
+ return replacement;
134922
+ }
134923
+ var refactorName4, refactorDescription, inlineVariableAction;
134924
+ var init_inlineVariable = __esm({
134925
+ "src/services/refactors/inlineVariable.ts"() {
134926
+ "use strict";
134927
+ init_ts4();
134928
+ init_ts_refactor();
134929
+ refactorName4 = "Inline variable";
134930
+ refactorDescription = getLocaleSpecificMessage(Diagnostics.Inline_variable);
134931
+ inlineVariableAction = {
134932
+ name: refactorName4,
134933
+ description: refactorDescription,
134934
+ kind: "refactor.inline.variable"
134935
+ };
134936
+ registerRefactor(refactorName4, {
134937
+ kinds: [inlineVariableAction.kind],
134938
+ getAvailableActions(context) {
134939
+ const {
134940
+ file,
134941
+ program,
134942
+ preferences,
134943
+ startPosition,
134944
+ triggerReason
134945
+ } = context;
134946
+ const info = getInliningInfo(file, startPosition, triggerReason === "invoked", program);
134947
+ if (!info) {
134948
+ return emptyArray;
134949
+ }
134950
+ if (!ts_refactor_exports.isRefactorErrorInfo(info)) {
134951
+ return [{
134952
+ name: refactorName4,
134953
+ description: refactorDescription,
134954
+ actions: [inlineVariableAction]
134955
+ }];
134956
+ }
134957
+ if (preferences.provideRefactorNotApplicableReason) {
134958
+ return [{
134959
+ name: refactorName4,
134960
+ description: refactorDescription,
134961
+ actions: [{
134962
+ ...inlineVariableAction,
134963
+ notApplicableReason: info.error
134964
+ }]
134965
+ }];
134966
+ }
134967
+ return emptyArray;
134968
+ },
134969
+ getEditsForAction(context, actionName2) {
134970
+ Debug.assert(actionName2 === refactorName4, "Unexpected refactor invoked");
134971
+ const { file, program, startPosition } = context;
134972
+ const info = getInliningInfo(
134973
+ file,
134974
+ startPosition,
134975
+ /*tryWithReferenceToken*/
134976
+ true,
134977
+ program
134978
+ );
134979
+ if (!info || ts_refactor_exports.isRefactorErrorInfo(info)) {
134980
+ return void 0;
134981
+ }
134982
+ const { references, declaration, replacement } = info;
134983
+ const edits = ts_textChanges_exports.ChangeTracker.with(context, (tracker) => {
134984
+ for (const node of references) {
134985
+ tracker.replaceNode(file, node, getReplacementExpression(node, replacement));
134986
+ }
134987
+ tracker.delete(file, declaration);
134988
+ });
134989
+ return { edits };
134990
+ }
134991
+ });
134992
+ }
134993
+ });
134994
+
134846
134995
  // src/services/refactors/moveToNewFile.ts
134847
134996
  function doChange3(oldFile, program, toMove, changes, host, preferences, context) {
134848
134997
  const checker = program.getTypeChecker();
@@ -134924,29 +135073,29 @@ ${lanes.join("\n")}
134924
135073
  append(copiedOldImports, makeImportOrRequire(oldFile, oldFileDefault, oldFileNamedImports, getBaseFileName(oldFile.fileName), program, host, useEsModuleSyntax, quotePreference));
134925
135074
  return copiedOldImports;
134926
135075
  }
134927
- var refactorName4, description, moveToNewFileAction;
135076
+ var refactorName5, description, moveToNewFileAction;
134928
135077
  var init_moveToNewFile = __esm({
134929
135078
  "src/services/refactors/moveToNewFile.ts"() {
134930
135079
  "use strict";
134931
135080
  init_ts4();
134932
135081
  init_ts_refactor();
134933
- refactorName4 = "Move to a new file";
135082
+ refactorName5 = "Move to a new file";
134934
135083
  description = getLocaleSpecificMessage(Diagnostics.Move_to_a_new_file);
134935
135084
  moveToNewFileAction = {
134936
- name: refactorName4,
135085
+ name: refactorName5,
134937
135086
  description,
134938
135087
  kind: "refactor.move.newFile"
134939
135088
  };
134940
- registerRefactor(refactorName4, {
135089
+ registerRefactor(refactorName5, {
134941
135090
  kinds: [moveToNewFileAction.kind],
134942
135091
  getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
134943
135092
  const statements = getStatementsToMove(context);
134944
135093
  if (context.preferences.allowTextChangesInNewFiles && statements) {
134945
- return [{ name: refactorName4, description, actions: [moveToNewFileAction] }];
135094
+ return [{ name: refactorName5, description, actions: [moveToNewFileAction] }];
134946
135095
  }
134947
135096
  if (context.preferences.provideRefactorNotApplicableReason) {
134948
135097
  return [{
134949
- name: refactorName4,
135098
+ name: refactorName5,
134950
135099
  description,
134951
135100
  actions: [{ ...moveToNewFileAction, notApplicableReason: getLocaleSpecificMessage(Diagnostics.Selection_is_not_a_valid_statement_or_statements) }]
134952
135101
  }];
@@ -134954,7 +135103,7 @@ ${lanes.join("\n")}
134954
135103
  return emptyArray;
134955
135104
  },
134956
135105
  getEditsForAction: function getRefactorEditsToMoveToNewFile(context, actionName2) {
134957
- Debug.assert(actionName2 === refactorName4, "Wrong refactor invoked");
135106
+ Debug.assert(actionName2 === refactorName5, "Wrong refactor invoked");
134958
135107
  const statements = Debug.checkDefined(getStatementsToMove(context));
134959
135108
  const edits = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange3(context.file, context.program, statements, t, context.host, context.preferences, context));
134960
135109
  return { edits, renameFilename: void 0, renameLocation: void 0 };
@@ -135872,8 +136021,8 @@ ${lanes.join("\n")}
135872
136021
  if (!info)
135873
136022
  return emptyArray;
135874
136023
  return [{
135875
- name: refactorName5,
135876
- description: refactorDescription,
136024
+ name: refactorName6,
136025
+ description: refactorDescription2,
135877
136026
  actions: [functionOverloadAction]
135878
136027
  }];
135879
136028
  }
@@ -136064,20 +136213,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136064
136213
  }
136065
136214
  return signatureDecls;
136066
136215
  }
136067
- var refactorName5, refactorDescription, functionOverloadAction;
136216
+ var refactorName6, refactorDescription2, functionOverloadAction;
136068
136217
  var init_convertOverloadListToSingleSignature = __esm({
136069
136218
  "src/services/refactors/convertOverloadListToSingleSignature.ts"() {
136070
136219
  "use strict";
136071
136220
  init_ts4();
136072
136221
  init_ts_refactor();
136073
- refactorName5 = "Convert overload list to single signature";
136074
- refactorDescription = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
136222
+ refactorName6 = "Convert overload list to single signature";
136223
+ refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Convert_overload_list_to_single_signature);
136075
136224
  functionOverloadAction = {
136076
- name: refactorName5,
136077
- description: refactorDescription,
136225
+ name: refactorName6,
136226
+ description: refactorDescription2,
136078
136227
  kind: "refactor.rewrite.function.overloadList"
136079
136228
  };
136080
- registerRefactor(refactorName5, {
136229
+ registerRefactor(refactorName6, {
136081
136230
  kinds: [functionOverloadAction.kind],
136082
136231
  getEditsForAction: getRefactorEditsToConvertOverloadsToOneSignature,
136083
136232
  getAvailableActions: getRefactorActionsToConvertOverloadsToOneSignature
@@ -136093,8 +136242,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136093
136242
  return emptyArray;
136094
136243
  if (!isRefactorErrorInfo(info)) {
136095
136244
  return [{
136096
- name: refactorName6,
136097
- description: refactorDescription2,
136245
+ name: refactorName7,
136246
+ description: refactorDescription3,
136098
136247
  actions: [
136099
136248
  info.addBraces ? addBracesAction : removeBracesAction
136100
136249
  ]
@@ -136102,8 +136251,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136102
136251
  }
136103
136252
  if (context.preferences.provideRefactorNotApplicableReason) {
136104
136253
  return [{
136105
- name: refactorName6,
136106
- description: refactorDescription2,
136254
+ name: refactorName7,
136255
+ description: refactorDescription3,
136107
136256
  actions: [
136108
136257
  { ...addBracesAction, notApplicableReason: info.error },
136109
136258
  { ...removeBracesAction, notApplicableReason: info.error }
@@ -136194,14 +136343,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136194
136343
  }
136195
136344
  return void 0;
136196
136345
  }
136197
- var refactorName6, refactorDescription2, addBracesAction, removeBracesAction;
136346
+ var refactorName7, refactorDescription3, addBracesAction, removeBracesAction;
136198
136347
  var init_addOrRemoveBracesToArrowFunction = __esm({
136199
136348
  "src/services/refactors/addOrRemoveBracesToArrowFunction.ts"() {
136200
136349
  "use strict";
136201
136350
  init_ts4();
136202
136351
  init_ts_refactor();
136203
- refactorName6 = "Add or remove braces in an arrow function";
136204
- refactorDescription2 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136352
+ refactorName7 = "Add or remove braces in an arrow function";
136353
+ refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Add_or_remove_braces_in_an_arrow_function);
136205
136354
  addBracesAction = {
136206
136355
  name: "Add braces to arrow function",
136207
136356
  description: getLocaleSpecificMessage(Diagnostics.Add_braces_to_arrow_function),
@@ -136212,7 +136361,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136212
136361
  description: getLocaleSpecificMessage(Diagnostics.Remove_braces_from_arrow_function),
136213
136362
  kind: "refactor.rewrite.arrow.braces.remove"
136214
136363
  };
136215
- registerRefactor(refactorName6, {
136364
+ registerRefactor(refactorName7, {
136216
136365
  kinds: [removeBracesAction.kind],
136217
136366
  getEditsForAction: getRefactorEditsToRemoveFunctionBraces,
136218
136367
  getAvailableActions: getRefactorActionsToRemoveFunctionBraces
@@ -136264,8 +136413,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136264
136413
  }
136265
136414
  }
136266
136415
  return [{
136267
- name: refactorName7,
136268
- description: refactorDescription3,
136416
+ name: refactorName8,
136417
+ description: refactorDescription4,
136269
136418
  actions: possibleActions.length === 0 && context.preferences.provideRefactorNotApplicableReason ? errors : possibleActions
136270
136419
  }];
136271
136420
  }
@@ -136425,14 +136574,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136425
136574
  function isFunctionReferencedInFile(sourceFile, typeChecker, node) {
136426
136575
  return !!node.name && ts_FindAllReferences_exports.Core.isSymbolReferencedInFile(node.name, typeChecker, sourceFile);
136427
136576
  }
136428
- var refactorName7, refactorDescription3, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction;
136577
+ var refactorName8, refactorDescription4, toAnonymousFunctionAction, toNamedFunctionAction, toArrowFunctionAction;
136429
136578
  var init_convertArrowFunctionOrFunctionExpression = __esm({
136430
136579
  "src/services/refactors/convertArrowFunctionOrFunctionExpression.ts"() {
136431
136580
  "use strict";
136432
136581
  init_ts4();
136433
136582
  init_ts_refactor();
136434
- refactorName7 = "Convert arrow function or function expression";
136435
- refactorDescription3 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
136583
+ refactorName8 = "Convert arrow function or function expression";
136584
+ refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_arrow_function_or_function_expression);
136436
136585
  toAnonymousFunctionAction = {
136437
136586
  name: "Convert to anonymous function",
136438
136587
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_anonymous_function),
@@ -136448,7 +136597,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136448
136597
  description: getLocaleSpecificMessage(Diagnostics.Convert_to_arrow_function),
136449
136598
  kind: "refactor.rewrite.function.arrow"
136450
136599
  };
136451
- registerRefactor(refactorName7, {
136600
+ registerRefactor(refactorName8, {
136452
136601
  kinds: [
136453
136602
  toAnonymousFunctionAction.kind,
136454
136603
  toNamedFunctionAction.kind,
@@ -136479,13 +136628,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136479
136628
  if (!functionDeclaration)
136480
136629
  return emptyArray;
136481
136630
  return [{
136482
- name: refactorName8,
136483
- description: refactorDescription4,
136631
+ name: refactorName9,
136632
+ description: refactorDescription5,
136484
136633
  actions: [toDestructuredAction]
136485
136634
  }];
136486
136635
  }
136487
136636
  function getRefactorEditsToConvertParametersToDestructuredObject(context, actionName2) {
136488
- Debug.assert(actionName2 === refactorName8, "Unexpected action name");
136637
+ Debug.assert(actionName2 === refactorName9, "Unexpected action name");
136489
136638
  const { file, startPosition, program, cancellationToken, host } = context;
136490
136639
  const functionDeclaration = getFunctionDeclarationAtPosition(file, startPosition, program.getTypeChecker());
136491
136640
  if (!functionDeclaration || !cancellationToken)
@@ -136995,21 +137144,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
136995
137144
  return Debug.assertNever(functionDeclaration, `Unexpected function declaration kind ${functionDeclaration.kind}`);
136996
137145
  }
136997
137146
  }
136998
- var refactorName8, minimumParameterLength, refactorDescription4, toDestructuredAction;
137147
+ var refactorName9, minimumParameterLength, refactorDescription5, toDestructuredAction;
136999
137148
  var init_convertParamsToDestructuredObject = __esm({
137000
137149
  "src/services/refactors/convertParamsToDestructuredObject.ts"() {
137001
137150
  "use strict";
137002
137151
  init_ts4();
137003
137152
  init_ts_refactor();
137004
- refactorName8 = "Convert parameters to destructured object";
137153
+ refactorName9 = "Convert parameters to destructured object";
137005
137154
  minimumParameterLength = 1;
137006
- refactorDescription4 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
137155
+ refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_parameters_to_destructured_object);
137007
137156
  toDestructuredAction = {
137008
- name: refactorName8,
137009
- description: refactorDescription4,
137157
+ name: refactorName9,
137158
+ description: refactorDescription5,
137010
137159
  kind: "refactor.rewrite.parameters.toDestructured"
137011
137160
  };
137012
- registerRefactor(refactorName8, {
137161
+ registerRefactor(refactorName9, {
137013
137162
  kinds: [toDestructuredAction.kind],
137014
137163
  getEditsForAction: getRefactorEditsToConvertParametersToDestructuredObject,
137015
137164
  getAvailableActions: getRefactorActionsToConvertParametersToDestructuredObject
@@ -137031,7 +137180,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137031
137180
  const { file, startPosition } = context;
137032
137181
  const node = getNodeOrParentOfParentheses(file, startPosition);
137033
137182
  const maybeBinary = getParentBinaryExpression(node);
137034
- const refactorInfo = { name: refactorName9, description: refactorDescription5, actions: [] };
137183
+ const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
137035
137184
  if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137036
137185
  refactorInfo.actions.push(convertStringAction);
137037
137186
  return [refactorInfo];
@@ -137057,7 +137206,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137057
137206
  const { file, startPosition } = context;
137058
137207
  const node = getNodeOrParentOfParentheses(file, startPosition);
137059
137208
  switch (actionName2) {
137060
- case refactorDescription5:
137209
+ case refactorDescription6:
137061
137210
  return { edits: getEditsForToTemplateLiteral(context, node) };
137062
137211
  default:
137063
137212
  return Debug.fail("invalid action");
@@ -137208,20 +137357,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137208
137357
  }
137209
137358
  return node;
137210
137359
  }
137211
- var refactorName9, refactorDescription5, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode;
137360
+ var refactorName10, refactorDescription6, convertStringAction, copyTrailingOperatorComments, copyCommentFromMultiNode;
137212
137361
  var init_convertStringOrTemplateLiteral = __esm({
137213
137362
  "src/services/refactors/convertStringOrTemplateLiteral.ts"() {
137214
137363
  "use strict";
137215
137364
  init_ts4();
137216
137365
  init_ts_refactor();
137217
- refactorName9 = "Convert to template string";
137218
- refactorDescription5 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
137366
+ refactorName10 = "Convert to template string";
137367
+ refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Convert_to_template_string);
137219
137368
  convertStringAction = {
137220
- name: refactorName9,
137221
- description: refactorDescription5,
137369
+ name: refactorName10,
137370
+ description: refactorDescription6,
137222
137371
  kind: "refactor.rewrite.string"
137223
137372
  };
137224
- registerRefactor(refactorName9, {
137373
+ registerRefactor(refactorName10, {
137225
137374
  kinds: [convertStringAction.kind],
137226
137375
  getEditsForAction: getRefactorEditsToConvertToTemplateString,
137227
137376
  getAvailableActions: getRefactorActionsToConvertToTemplateString
@@ -137271,14 +137420,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137271
137420
  return emptyArray;
137272
137421
  if (!isRefactorErrorInfo(info)) {
137273
137422
  return [{
137274
- name: refactorName10,
137423
+ name: refactorName11,
137275
137424
  description: convertToOptionalChainExpressionMessage,
137276
137425
  actions: [toOptionalChainAction]
137277
137426
  }];
137278
137427
  }
137279
137428
  if (context.preferences.provideRefactorNotApplicableReason) {
137280
137429
  return [{
137281
- name: refactorName10,
137430
+ name: refactorName11,
137282
137431
  description: convertToOptionalChainExpressionMessage,
137283
137432
  actions: [{ ...toOptionalChainAction, notApplicableReason: info.error }]
137284
137433
  }];
@@ -137462,20 +137611,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137462
137611
  }
137463
137612
  }
137464
137613
  }
137465
- var refactorName10, convertToOptionalChainExpressionMessage, toOptionalChainAction;
137614
+ var refactorName11, convertToOptionalChainExpressionMessage, toOptionalChainAction;
137466
137615
  var init_convertToOptionalChainExpression = __esm({
137467
137616
  "src/services/refactors/convertToOptionalChainExpression.ts"() {
137468
137617
  "use strict";
137469
137618
  init_ts4();
137470
137619
  init_ts_refactor();
137471
- refactorName10 = "Convert to optional chain expression";
137620
+ refactorName11 = "Convert to optional chain expression";
137472
137621
  convertToOptionalChainExpressionMessage = getLocaleSpecificMessage(Diagnostics.Convert_to_optional_chain_expression);
137473
137622
  toOptionalChainAction = {
137474
- name: refactorName10,
137623
+ name: refactorName11,
137475
137624
  description: convertToOptionalChainExpressionMessage,
137476
137625
  kind: "refactor.rewrite.expression.optionalChain"
137477
137626
  };
137478
- registerRefactor(refactorName10, {
137627
+ registerRefactor(refactorName11, {
137479
137628
  kinds: [toOptionalChainAction.kind],
137480
137629
  getEditsForAction: getRefactorEditsToConvertToOptionalChain,
137481
137630
  getAvailableActions: getRefactorActionsToConvertToOptionalChain
@@ -137504,14 +137653,14 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137504
137653
  const errors = [];
137505
137654
  if (refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) {
137506
137655
  errors.push({
137507
- name: refactorName11,
137656
+ name: refactorName12,
137508
137657
  description: extractFunctionAction.description,
137509
137658
  actions: [{ ...extractFunctionAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
137510
137659
  });
137511
137660
  }
137512
137661
  if (refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) {
137513
137662
  errors.push({
137514
- name: refactorName11,
137663
+ name: refactorName12,
137515
137664
  description: extractConstantAction.description,
137516
137665
  actions: [{ ...extractConstantAction, notApplicableReason: getStringError(rangeToExtract.errors) }]
137517
137666
  });
@@ -137575,26 +137724,26 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137575
137724
  const infos = [];
137576
137725
  if (functionActions.length) {
137577
137726
  infos.push({
137578
- name: refactorName11,
137727
+ name: refactorName12,
137579
137728
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
137580
137729
  actions: functionActions
137581
137730
  });
137582
137731
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorFunctionAction) {
137583
137732
  infos.push({
137584
- name: refactorName11,
137733
+ name: refactorName12,
137585
137734
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
137586
137735
  actions: [innermostErrorFunctionAction]
137587
137736
  });
137588
137737
  }
137589
137738
  if (constantActions.length) {
137590
137739
  infos.push({
137591
- name: refactorName11,
137740
+ name: refactorName12,
137592
137741
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
137593
137742
  actions: constantActions
137594
137743
  });
137595
137744
  } else if (context.preferences.provideRefactorNotApplicableReason && innermostErrorConstantAction) {
137596
137745
  infos.push({
137597
- name: refactorName11,
137746
+ name: refactorName12,
137598
137747
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
137599
137748
  actions: [innermostErrorConstantAction]
137600
137749
  });
@@ -139025,13 +139174,13 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139025
139174
  function isStringLiteralJsxAttribute(node) {
139026
139175
  return isStringLiteral(node) && node.parent && isJsxAttribute(node.parent);
139027
139176
  }
139028
- var refactorName11, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
139177
+ var refactorName12, extractConstantAction, extractFunctionAction, Messages, RangeFacts;
139029
139178
  var init_extractSymbol = __esm({
139030
139179
  "src/services/refactors/extractSymbol.ts"() {
139031
139180
  "use strict";
139032
139181
  init_ts4();
139033
139182
  init_ts_refactor();
139034
- refactorName11 = "Extract Symbol";
139183
+ refactorName12 = "Extract Symbol";
139035
139184
  extractConstantAction = {
139036
139185
  name: "Extract Constant",
139037
139186
  description: getLocaleSpecificMessage(Diagnostics.Extract_constant),
@@ -139042,7 +139191,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139042
139191
  description: getLocaleSpecificMessage(Diagnostics.Extract_function),
139043
139192
  kind: "refactor.extract.function"
139044
139193
  };
139045
- registerRefactor(refactorName11, {
139194
+ registerRefactor(refactorName12, {
139046
139195
  kinds: [
139047
139196
  extractConstantAction.kind,
139048
139197
  extractFunctionAction.kind
@@ -139193,15 +139342,15 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139193
139342
  return emptyArray;
139194
139343
  if (!isRefactorErrorInfo(info)) {
139195
139344
  return [{
139196
- name: refactorName12,
139197
- description: refactorDescription6,
139345
+ name: refactorName13,
139346
+ description: refactorDescription7,
139198
139347
  actions: [inferReturnTypeAction]
139199
139348
  }];
139200
139349
  }
139201
139350
  if (context.preferences.provideRefactorNotApplicableReason) {
139202
139351
  return [{
139203
- name: refactorName12,
139204
- description: refactorDescription6,
139352
+ name: refactorName13,
139353
+ description: refactorDescription7,
139205
139354
  actions: [{ ...inferReturnTypeAction, notApplicableReason: info.error }]
139206
139355
  }];
139207
139356
  }
@@ -139260,20 +139409,20 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139260
139409
  return typeChecker.getReturnTypeOfSignature(signature);
139261
139410
  }
139262
139411
  }
139263
- var refactorName12, refactorDescription6, inferReturnTypeAction;
139412
+ var refactorName13, refactorDescription7, inferReturnTypeAction;
139264
139413
  var init_inferFunctionReturnType = __esm({
139265
139414
  "src/services/refactors/inferFunctionReturnType.ts"() {
139266
139415
  "use strict";
139267
139416
  init_ts4();
139268
139417
  init_ts_refactor();
139269
- refactorName12 = "Infer function return type";
139270
- refactorDescription6 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139418
+ refactorName13 = "Infer function return type";
139419
+ refactorDescription7 = getLocaleSpecificMessage(Diagnostics.Infer_function_return_type);
139271
139420
  inferReturnTypeAction = {
139272
- name: refactorName12,
139273
- description: refactorDescription6,
139421
+ name: refactorName13,
139422
+ description: refactorDescription7,
139274
139423
  kind: "refactor.rewrite.function.returnType"
139275
139424
  };
139276
- registerRefactor(refactorName12, {
139425
+ registerRefactor(refactorName13, {
139277
139426
  kinds: [inferReturnTypeAction.kind],
139278
139427
  getEditsForAction: getRefactorEditsToInferReturnType,
139279
139428
  getAvailableActions: getRefactorActionsToInferReturnType
@@ -139334,6 +139483,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
139334
139483
  init_convertImport();
139335
139484
  init_extractType();
139336
139485
  init_helpers();
139486
+ init_inlineVariable();
139337
139487
  init_moveToNewFile();
139338
139488
  init_moveToFile();
139339
139489
  init_ts_refactor_addOrRemoveBracesToArrowFunction();
@@ -140872,10 +141022,10 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
140872
141022
  const newFileName = createNewFileName(sourceFile, program, getRefactorContext(sourceFile, positionOrRange, preferences, emptyOptions), host);
140873
141023
  return { newFileName, files };
140874
141024
  }
140875
- function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName13, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
141025
+ function getEditsForRefactor2(fileName, formatOptions, positionOrRange, refactorName14, actionName2, preferences = emptyOptions, interactiveRefactorArguments) {
140876
141026
  synchronizeHostData();
140877
141027
  const file = getValidSourceFile(fileName);
140878
- return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName13, actionName2, interactiveRefactorArguments);
141028
+ return ts_refactor_exports.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName14, actionName2, interactiveRefactorArguments);
140879
141029
  }
140880
141030
  function toLineColumnOffset(fileName, position) {
140881
141031
  if (position === 0) {
@@ -158249,7 +158399,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158249
158399
  case 290 /* JsxAttribute */:
158250
158400
  if (!isRequireCallArgument(node) && !isImportCall(parent2)) {
158251
158401
  const argumentInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(parent2.kind === 290 /* JsxAttribute */ ? parent2.parent : node, position, sourceFile);
158252
- return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType();
158402
+ return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(0 /* None */);
158253
158403
  }
158254
158404
  case 271 /* ImportDeclaration */:
158255
158405
  case 277 /* ExportDeclaration */:
@@ -161442,6 +161592,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
161442
161592
  getTextSpanOfEntry: () => getTextSpanOfEntry,
161443
161593
  isContextWithStartAndEndNode: () => isContextWithStartAndEndNode,
161444
161594
  isDeclarationOfSymbol: () => isDeclarationOfSymbol,
161595
+ isWriteAccessForReference: () => isWriteAccessForReference,
161445
161596
  nodeEntry: () => nodeEntry,
161446
161597
  toContextSpan: () => toContextSpan,
161447
161598
  toHighlightSpan: () => toHighlightSpan,
@@ -169648,9 +169799,9 @@ ${options.prefix}` : "\n" : options.prefix
169648
169799
  init_ts5();
169649
169800
  init_deprecate();
169650
169801
  addObjectAllocatorPatcher((objectAllocator2) => {
169651
- const Identifier74 = objectAllocator2.getIdentifierConstructor();
169652
- if (!hasProperty(Identifier74.prototype, "originalKeywordKind")) {
169653
- Object.defineProperty(Identifier74.prototype, "originalKeywordKind", {
169802
+ const Identifier75 = objectAllocator2.getIdentifierConstructor();
169803
+ if (!hasProperty(Identifier75.prototype, "originalKeywordKind")) {
169804
+ Object.defineProperty(Identifier75.prototype, "originalKeywordKind", {
169654
169805
  get: deprecate(function() {
169655
169806
  return identifierToKeywordKind(this);
169656
169807
  }, {
@@ -169662,8 +169813,8 @@ ${options.prefix}` : "\n" : options.prefix
169662
169813
  })
169663
169814
  });
169664
169815
  }
169665
- if (!hasProperty(Identifier74.prototype, "isInJSDocNamespace")) {
169666
- Object.defineProperty(Identifier74.prototype, "isInJSDocNamespace", {
169816
+ if (!hasProperty(Identifier75.prototype, "isInJSDocNamespace")) {
169817
+ Object.defineProperty(Identifier75.prototype, "isInJSDocNamespace", {
169667
169818
  get: deprecate(function() {
169668
169819
  return this.flags & 2048 /* IdentifierIsInJSDocNamespace */ ? true : void 0;
169669
169820
  }, {