@typescript-deploys/pr-build 5.2.0-pr-54507-7 → 5.2.0-pr-54536-13

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-insiders.20230602`;
38
+ version = `${versionMajorMinor}.0-insiders.20230605`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45382,9 +45382,9 @@ ${lanes.join("\n")}
45382
45382
  candidatesOutArray,
45383
45383
  /*argumentCount*/
45384
45384
  void 0,
45385
- 32 /* IsForStringLiteralArgumentCompletions */
45385
+ 64 /* IsForStringLiteralArgumentCompletions */
45386
45386
  )),
45387
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
45387
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
45388
45388
  getExpandedParameters,
45389
45389
  hasEffectiveRestParameter,
45390
45390
  containsArgumentsReference,
@@ -53339,7 +53339,7 @@ ${lanes.join("\n")}
53339
53339
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
53340
53340
  }
53341
53341
  function getTypeForBindingElement(declaration) {
53342
- const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
53342
+ const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
53343
53343
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
53344
53344
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
53345
53345
  }
@@ -55096,19 +55096,13 @@ ${lanes.join("\n")}
55096
55096
  if (getObjectFlags(type) & 4 /* Reference */) {
55097
55097
  const target = type.target;
55098
55098
  const typeArguments = getTypeArguments(type);
55099
- if (length(target.typeParameters) === length(typeArguments)) {
55100
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
55101
- return needApparentType ? getApparentType(ref) : ref;
55102
- }
55099
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
55103
55100
  } else if (type.flags & 2097152 /* Intersection */) {
55104
55101
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
55105
55102
  return types !== type.types ? getIntersectionType(types) : type;
55106
55103
  }
55107
55104
  return needApparentType ? getApparentType(type) : type;
55108
55105
  }
55109
- function getThisArgument(type) {
55110
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
55111
- }
55112
55106
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
55113
55107
  let mapper;
55114
55108
  let members;
@@ -56174,7 +56168,7 @@ ${lanes.join("\n")}
56174
56168
  return type.resolvedBaseConstraint;
56175
56169
  }
56176
56170
  const stack = [];
56177
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
56171
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
56178
56172
  function getImmediateBaseConstraint(t) {
56179
56173
  if (!t.immediateBaseConstraint) {
56180
56174
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -56266,18 +56260,18 @@ ${lanes.join("\n")}
56266
56260
  }
56267
56261
  if (isGenericTupleType(t)) {
56268
56262
  const newElements = map(getElementTypes(t), (v, i) => {
56269
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56270
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56263
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56264
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56271
56265
  });
56272
56266
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
56273
56267
  }
56274
56268
  return t;
56275
56269
  }
56276
56270
  }
56277
- function getApparentTypeOfIntersectionType(type) {
56271
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
56278
56272
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
56279
56273
  type,
56280
- type,
56274
+ thisArgument,
56281
56275
  /*needApparentType*/
56282
56276
  true
56283
56277
  ));
@@ -56328,8 +56322,9 @@ ${lanes.join("\n")}
56328
56322
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
56329
56323
  }
56330
56324
  function getApparentType(type) {
56331
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
56332
- 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;
56325
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
56326
+ const objectFlags = getObjectFlags(t);
56327
+ 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;
56333
56328
  }
56334
56329
  function getReducedApparentType(type) {
56335
56330
  return getReducedType(getApparentType(getReducedType(type)));
@@ -60537,10 +60532,7 @@ ${lanes.join("\n")}
60537
60532
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60538
60533
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60539
60534
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60540
- const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
60541
- if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60542
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
60543
- }
60535
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
60544
60536
  }
60545
60537
  target.instantiations.set(id, result);
60546
60538
  }
@@ -63153,7 +63145,7 @@ ${lanes.join("\n")}
63153
63145
  return 3 /* Maybe */;
63154
63146
  }
63155
63147
  const c = target2;
63156
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63148
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
63157
63149
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63158
63150
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
63159
63151
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -68239,7 +68231,7 @@ ${lanes.join("\n")}
68239
68231
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
68240
68232
  }
68241
68233
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
68242
- 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(
68234
+ 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(
68243
68235
  node,
68244
68236
  /*contextFlags*/
68245
68237
  void 0
@@ -68996,7 +68988,7 @@ ${lanes.join("\n")}
68996
68988
  function getContextualTypeForBindingElement(declaration, contextFlags) {
68997
68989
  const parent2 = declaration.parent.parent;
68998
68990
  const name = declaration.propertyName || declaration.name;
68999
- const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
68991
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
69000
68992
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
69001
68993
  return void 0;
69002
68994
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -70045,7 +70037,9 @@ ${lanes.join("\n")}
70045
70037
  elementTypes.push(undefinedOrMissingType);
70046
70038
  elementFlags.push(2 /* Optional */);
70047
70039
  } else {
70048
- const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
70040
+ const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
70041
+ const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70042
+ const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
70049
70043
  elementTypes.push(addOptionality(
70050
70044
  type,
70051
70045
  /*isProperty*/
@@ -70053,7 +70047,7 @@ ${lanes.join("\n")}
70053
70047
  hasOmittedExpression
70054
70048
  ));
70055
70049
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
70056
- if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
70050
+ if (shouldAddAsIntraExpressionInferenceSite) {
70057
70051
  const inferenceContext = getInferenceContext(node);
70058
70052
  Debug.assert(inferenceContext);
70059
70053
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -70194,11 +70188,13 @@ ${lanes.join("\n")}
70194
70188
  let member = getSymbolOfDeclaration(memberDecl);
70195
70189
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
70196
70190
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
70197
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
70191
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
70192
+ const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70193
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
70198
70194
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
70199
70195
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
70200
70196
  // we don't want to say "could not find 'a'".
70201
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
70197
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
70202
70198
  );
70203
70199
  if (isInJavascript) {
70204
70200
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -70242,7 +70238,7 @@ ${lanes.join("\n")}
70242
70238
  prop.links.target = member;
70243
70239
  member = prop;
70244
70240
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
70245
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
70241
+ if (shouldAddAsIntraExpressionInferenceSite) {
70246
70242
  const inferenceContext = getInferenceContext(node);
70247
70243
  Debug.assert(inferenceContext);
70248
70244
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -70415,7 +70411,9 @@ ${lanes.join("\n")}
70415
70411
  for (const attributeDecl of attributes.properties) {
70416
70412
  const member = attributeDecl.symbol;
70417
70413
  if (isJsxAttribute(attributeDecl)) {
70418
- const exprType = checkJsxAttribute(attributeDecl, checkMode);
70414
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
70415
+ const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70416
+ const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
70419
70417
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
70420
70418
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
70421
70419
  attributeSymbol.declarations = member.declarations;
@@ -70436,7 +70434,7 @@ ${lanes.join("\n")}
70436
70434
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
70437
70435
  }
70438
70436
  }
70439
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
70437
+ if (shouldAddAsIntraExpressionInferenceSite) {
70440
70438
  const inferenceContext = getInferenceContext(attributes);
70441
70439
  Debug.assert(inferenceContext);
70442
70440
  const inferenceNode = attributeDecl.initializer.expression;
@@ -72054,7 +72052,7 @@ ${lanes.join("\n")}
72054
72052
  }
72055
72053
  for (let i = 0; i < argCount; i++) {
72056
72054
  const arg = args[i];
72057
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72055
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72058
72056
  const paramType = getTypeAtPosition(signature, i);
72059
72057
  if (couldContainTypeVariables(paramType)) {
72060
72058
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -72667,12 +72665,12 @@ ${lanes.join("\n")}
72667
72665
  const args = getEffectiveCallArguments(node);
72668
72666
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
72669
72667
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
72670
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72668
+ argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72671
72669
  let candidatesForArgumentError;
72672
72670
  let candidateForArgumentArityError;
72673
72671
  let candidateForTypeArgumentError;
72674
72672
  let result;
72675
- const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72673
+ const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72676
72674
  if (candidates.length > 1) {
72677
72675
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
72678
72676
  }
@@ -72891,7 +72889,7 @@ ${lanes.join("\n")}
72891
72889
  continue;
72892
72890
  }
72893
72891
  if (argCheckMode) {
72894
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72892
+ argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72895
72893
  if (inferenceContext) {
72896
72894
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72897
72895
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -75969,7 +75967,7 @@ ${lanes.join("\n")}
75969
75967
  case 36 /* ExclamationEqualsToken */:
75970
75968
  case 37 /* EqualsEqualsEqualsToken */:
75971
75969
  case 38 /* ExclamationEqualsEqualsToken */:
75972
- if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
75970
+ if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
75973
75971
  if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75974
75972
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75975
75973
  error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
@@ -76628,7 +76626,7 @@ ${lanes.join("\n")}
76628
76626
  }
76629
76627
  }
76630
76628
  const startInvocationCount = flowInvocationCount;
76631
- const type = checkExpression(node, 128 /* TypeOnly */);
76629
+ const type = checkExpression(node, 256 /* TypeOnly */);
76632
76630
  if (flowInvocationCount !== startInvocationCount) {
76633
76631
  const cache = flowTypeCache || (flowTypeCache = []);
76634
76632
  cache[getNodeId(node)] = type;
@@ -79099,7 +79097,7 @@ ${lanes.join("\n")}
79099
79097
  checkComputedPropertyName(node.propertyName);
79100
79098
  }
79101
79099
  const parent2 = node.parent.parent;
79102
- const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
79100
+ const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
79103
79101
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
79104
79102
  const name = node.propertyName || node.name;
79105
79103
  if (parentType && !isBindingPattern(name)) {
@@ -85835,10 +85833,11 @@ ${lanes.join("\n")}
85835
85833
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
85836
85834
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
85837
85835
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
85838
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
85839
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
85840
- CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
85841
- CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
85836
+ CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
85837
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
85838
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
85839
+ CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
85840
+ CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
85842
85841
  return CheckMode3;
85843
85842
  })(CheckMode || {});
85844
85843
  SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -162095,13 +162094,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162095
162094
  if (!signature || !candidates.length) {
162096
162095
  return;
162097
162096
  }
162098
- for (let i = 0; i < args.length; ++i) {
162099
- const originalArg = args[i];
162097
+ let signatureParamPos = 0;
162098
+ for (const originalArg of args) {
162100
162099
  const arg = skipParentheses(originalArg);
162101
162100
  if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
162102
162101
  continue;
162103
162102
  }
162104
- const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i);
162103
+ let spreadArgs = 0;
162104
+ if (isSpreadElement(arg)) {
162105
+ const spreadType = checker.getTypeAtLocation(arg.expression);
162106
+ if (checker.isTupleType(spreadType)) {
162107
+ const { elementFlags, fixedLength } = spreadType.target;
162108
+ if (fixedLength === 0) {
162109
+ continue;
162110
+ }
162111
+ const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
162112
+ const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162113
+ if (requiredArgs > 0) {
162114
+ spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162115
+ }
162116
+ }
162117
+ }
162118
+ const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
162119
+ signatureParamPos = signatureParamPos + (spreadArgs || 1);
162105
162120
  if (identifierNameInfo) {
162106
162121
  const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
162107
162122
  const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
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-insiders.20230602`;
38
+ version = `${versionMajorMinor}.0-insiders.20230605`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -45382,9 +45382,9 @@ ${lanes.join("\n")}
45382
45382
  candidatesOutArray,
45383
45383
  /*argumentCount*/
45384
45384
  void 0,
45385
- 32 /* IsForStringLiteralArgumentCompletions */
45385
+ 64 /* IsForStringLiteralArgumentCompletions */
45386
45386
  )),
45387
- getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */)),
45387
+ getResolvedSignatureForSignatureHelp: (node, candidatesOutArray, argumentCount) => runWithoutResolvedSignatureCaching(node, () => getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 32 /* IsForSignatureHelp */)),
45388
45388
  getExpandedParameters,
45389
45389
  hasEffectiveRestParameter,
45390
45390
  containsArgumentsReference,
@@ -53339,7 +53339,7 @@ ${lanes.join("\n")}
53339
53339
  return type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */) ? "" + type.value : void 0;
53340
53340
  }
53341
53341
  function getTypeForBindingElement(declaration) {
53342
- const checkMode = declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
53342
+ const checkMode = declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
53343
53343
  const parentType = getTypeForBindingElementParent(declaration.parent.parent, checkMode);
53344
53344
  return parentType && getBindingElementTypeFromParentType(declaration, parentType);
53345
53345
  }
@@ -55096,19 +55096,13 @@ ${lanes.join("\n")}
55096
55096
  if (getObjectFlags(type) & 4 /* Reference */) {
55097
55097
  const target = type.target;
55098
55098
  const typeArguments = getTypeArguments(type);
55099
- if (length(target.typeParameters) === length(typeArguments)) {
55100
- const ref = createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType]));
55101
- return needApparentType ? getApparentType(ref) : ref;
55102
- }
55099
+ return length(target.typeParameters) === length(typeArguments) ? createTypeReference(target, concatenate(typeArguments, [thisArgument || target.thisType])) : type;
55103
55100
  } else if (type.flags & 2097152 /* Intersection */) {
55104
55101
  const types = sameMap(type.types, (t) => getTypeWithThisArgument(t, thisArgument, needApparentType));
55105
55102
  return types !== type.types ? getIntersectionType(types) : type;
55106
55103
  }
55107
55104
  return needApparentType ? getApparentType(type) : type;
55108
55105
  }
55109
- function getThisArgument(type) {
55110
- return getObjectFlags(type) & 4 /* Reference */ && length(getTypeArguments(type)) > getTypeReferenceArity(type) ? last(getTypeArguments(type)) : type;
55111
- }
55112
55106
  function resolveObjectTypeMembers(type, source, typeParameters, typeArguments) {
55113
55107
  let mapper;
55114
55108
  let members;
@@ -56174,7 +56168,7 @@ ${lanes.join("\n")}
56174
56168
  return type.resolvedBaseConstraint;
56175
56169
  }
56176
56170
  const stack = [];
56177
- return type.resolvedBaseConstraint = getTypeWithThisArgument(getImmediateBaseConstraint(type), getThisArgument(type));
56171
+ return type.resolvedBaseConstraint = getImmediateBaseConstraint(type);
56178
56172
  function getImmediateBaseConstraint(t) {
56179
56173
  if (!t.immediateBaseConstraint) {
56180
56174
  if (!pushTypeResolution(t, 4 /* ImmediateBaseConstraint */)) {
@@ -56266,18 +56260,18 @@ ${lanes.join("\n")}
56266
56260
  }
56267
56261
  if (isGenericTupleType(t)) {
56268
56262
  const newElements = map(getElementTypes(t), (v, i) => {
56269
- const constraint = t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56270
- return constraint && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56263
+ const constraint = v.flags & 262144 /* TypeParameter */ && t.target.elementFlags[i] & 8 /* Variadic */ && getBaseConstraint(v) || v;
56264
+ return constraint !== v && everyType(constraint, (c) => isArrayOrTupleType(c) && !isGenericTupleType(c)) ? constraint : v;
56271
56265
  });
56272
56266
  return createTupleType(newElements, t.target.elementFlags, t.target.readonly, t.target.labeledElementDeclarations);
56273
56267
  }
56274
56268
  return t;
56275
56269
  }
56276
56270
  }
56277
- function getApparentTypeOfIntersectionType(type) {
56271
+ function getApparentTypeOfIntersectionType(type, thisArgument) {
56278
56272
  return type.resolvedApparentType || (type.resolvedApparentType = getTypeWithThisArgument(
56279
56273
  type,
56280
- type,
56274
+ thisArgument,
56281
56275
  /*needApparentType*/
56282
56276
  true
56283
56277
  ));
@@ -56328,8 +56322,9 @@ ${lanes.join("\n")}
56328
56322
  return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
56329
56323
  }
56330
56324
  function getApparentType(type) {
56331
- const t = !(type.flags & 465829888 /* Instantiable */) ? type : getBaseConstraintOfType(type) || unknownType;
56332
- 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;
56325
+ const t = type.flags & 465829888 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
56326
+ const objectFlags = getObjectFlags(t);
56327
+ 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;
56333
56328
  }
56334
56329
  function getReducedApparentType(type) {
56335
56330
  return getReducedType(getApparentType(getReducedType(type)));
@@ -60537,10 +60532,7 @@ ${lanes.join("\n")}
60537
60532
  const newMapper = createTypeMapper(typeParameters, typeArguments);
60538
60533
  result = target.objectFlags & 4 /* Reference */ ? createDeferredTypeReference(type.target, type.node, newMapper, newAliasSymbol, newAliasTypeArguments) : target.objectFlags & 32 /* Mapped */ ? instantiateMappedType(target, newMapper, newAliasSymbol, newAliasTypeArguments) : instantiateAnonymousType(target, newMapper, newAliasSymbol, newAliasTypeArguments);
60539
60534
  if (result.flags & 138117121 /* ObjectFlagsType */ && !(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60540
- const resultCouldContainTypeVariables = some(typeArguments, couldContainTypeVariables);
60541
- if (!(result.objectFlags & 524288 /* CouldContainTypeVariablesComputed */)) {
60542
- result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (resultCouldContainTypeVariables ? 1048576 /* CouldContainTypeVariables */ : 0);
60543
- }
60535
+ result.objectFlags |= 524288 /* CouldContainTypeVariablesComputed */ | (some(typeArguments, couldContainTypeVariables) ? 1048576 /* CouldContainTypeVariables */ : 0);
60544
60536
  }
60545
60537
  target.instantiations.set(id, result);
60546
60538
  }
@@ -63153,7 +63145,7 @@ ${lanes.join("\n")}
63153
63145
  return 3 /* Maybe */;
63154
63146
  }
63155
63147
  const c = target2;
63156
- if (!c.root.inferTypeParameters && !isDistributionDependent(c.root)) {
63148
+ if (!c.root.inferTypeParameters && !isDistributionDependent(c.root) && !(source2.flags & 16777216 /* Conditional */ && source2.root === c.root)) {
63157
63149
  const skipTrue = !isTypeAssignableTo(getPermissiveInstantiation(c.checkType), getPermissiveInstantiation(c.extendsType));
63158
63150
  const skipFalse = !skipTrue && isTypeAssignableTo(getRestrictiveInstantiation(c.checkType), getRestrictiveInstantiation(c.extendsType));
63159
63151
  if (result2 = skipTrue ? -1 /* True */ : isRelatedTo(
@@ -68239,7 +68231,7 @@ ${lanes.join("\n")}
68239
68231
  return type.flags & 2097152 /* Intersection */ ? some(type.types, isGenericTypeWithoutNullableConstraint) : !!(type.flags & 465829888 /* Instantiable */ && !maybeTypeOfKind(getBaseConstraintOrType(type), 98304 /* Nullable */));
68240
68232
  }
68241
68233
  function hasContextualTypeWithNoGenericTypes(node, checkMode) {
68242
- 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(
68234
+ 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(
68243
68235
  node,
68244
68236
  /*contextFlags*/
68245
68237
  void 0
@@ -68996,7 +68988,7 @@ ${lanes.join("\n")}
68996
68988
  function getContextualTypeForBindingElement(declaration, contextFlags) {
68997
68989
  const parent2 = declaration.parent.parent;
68998
68990
  const name = declaration.propertyName || declaration.name;
68999
- const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */);
68991
+ const parentType = getContextualTypeForVariableLikeDeclaration(parent2, contextFlags) || parent2.kind !== 207 /* BindingElement */ && parent2.initializer && checkDeclarationInitializer(parent2, declaration.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */);
69000
68992
  if (!parentType || isBindingPattern(name) || isComputedNonLiteralName(name))
69001
68993
  return void 0;
69002
68994
  if (parent2.name.kind === 206 /* ArrayBindingPattern */) {
@@ -70045,7 +70037,9 @@ ${lanes.join("\n")}
70045
70037
  elementTypes.push(undefinedOrMissingType);
70046
70038
  elementFlags.push(2 /* Optional */);
70047
70039
  } else {
70048
- const type = checkExpressionForMutableLocation(e, checkMode, forceTuple);
70040
+ const shouldAddAsIntraExpressionInferenceSite = inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(e);
70041
+ const elementCheckMode = (checkMode || 0 /* Normal */) | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70042
+ const type = checkExpressionForMutableLocation(e, elementCheckMode, forceTuple);
70049
70043
  elementTypes.push(addOptionality(
70050
70044
  type,
70051
70045
  /*isProperty*/
@@ -70053,7 +70047,7 @@ ${lanes.join("\n")}
70053
70047
  hasOmittedExpression
70054
70048
  ));
70055
70049
  elementFlags.push(hasOmittedExpression ? 2 /* Optional */ : 1 /* Required */);
70056
- if (inTupleContext && checkMode && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(e)) {
70050
+ if (shouldAddAsIntraExpressionInferenceSite) {
70057
70051
  const inferenceContext = getInferenceContext(node);
70058
70052
  Debug.assert(inferenceContext);
70059
70053
  addIntraExpressionInferenceSite(inferenceContext, e, type);
@@ -70194,11 +70188,13 @@ ${lanes.join("\n")}
70194
70188
  let member = getSymbolOfDeclaration(memberDecl);
70195
70189
  const computedNameType = memberDecl.name && memberDecl.name.kind === 166 /* ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : void 0;
70196
70190
  if (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 303 /* ShorthandPropertyAssignment */ || isObjectLiteralMethod(memberDecl)) {
70197
- let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : (
70191
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl);
70192
+ const propCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70193
+ let type = memberDecl.kind === 302 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, propCheckMode) : (
70198
70194
  // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring
70199
70195
  // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`.
70200
70196
  // we don't want to say "could not find 'a'".
70201
- memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode)
70197
+ memberDecl.kind === 303 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, propCheckMode) : checkObjectLiteralMethod(memberDecl, propCheckMode)
70202
70198
  );
70203
70199
  if (isInJavascript) {
70204
70200
  const jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -70242,7 +70238,7 @@ ${lanes.join("\n")}
70242
70238
  prop.links.target = member;
70243
70239
  member = prop;
70244
70240
  allPropertiesTable == null ? void 0 : allPropertiesTable.set(prop.escapedName, prop);
70245
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && (memberDecl.kind === 302 /* PropertyAssignment */ || memberDecl.kind === 173 /* MethodDeclaration */) && isContextSensitive(memberDecl)) {
70241
+ if (shouldAddAsIntraExpressionInferenceSite) {
70246
70242
  const inferenceContext = getInferenceContext(node);
70247
70243
  Debug.assert(inferenceContext);
70248
70244
  const inferenceNode = memberDecl.kind === 302 /* PropertyAssignment */ ? memberDecl.initializer : memberDecl;
@@ -70415,7 +70411,9 @@ ${lanes.join("\n")}
70415
70411
  for (const attributeDecl of attributes.properties) {
70416
70412
  const member = attributeDecl.symbol;
70417
70413
  if (isJsxAttribute(attributeDecl)) {
70418
- const exprType = checkJsxAttribute(attributeDecl, checkMode);
70414
+ const shouldAddAsIntraExpressionInferenceSite = contextualType && checkMode & 2 /* Inferential */ && !(checkMode & (4 /* SkipContextSensitive */ | 16 /* SkipAddingIntraExpressionSites */)) && isContextSensitive(attributeDecl);
70415
+ const attributeCheckMode = checkMode | (shouldAddAsIntraExpressionInferenceSite ? 16 /* SkipAddingIntraExpressionSites */ : 0);
70416
+ const exprType = checkJsxAttribute(attributeDecl, attributeCheckMode);
70419
70417
  objectFlags |= getObjectFlags(exprType) & 458752 /* PropagatingFlags */;
70420
70418
  const attributeSymbol = createSymbol(4 /* Property */ | member.flags, member.escapedName);
70421
70419
  attributeSymbol.declarations = member.declarations;
@@ -70436,7 +70434,7 @@ ${lanes.join("\n")}
70436
70434
  addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText);
70437
70435
  }
70438
70436
  }
70439
- if (contextualType && checkMode & 2 /* Inferential */ && !(checkMode & 4 /* SkipContextSensitive */) && isContextSensitive(attributeDecl)) {
70437
+ if (shouldAddAsIntraExpressionInferenceSite) {
70440
70438
  const inferenceContext = getInferenceContext(attributes);
70441
70439
  Debug.assert(inferenceContext);
70442
70440
  const inferenceNode = attributeDecl.initializer.expression;
@@ -72054,7 +72052,7 @@ ${lanes.join("\n")}
72054
72052
  }
72055
72053
  for (let i = 0; i < argCount; i++) {
72056
72054
  const arg = args[i];
72057
- if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 32 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72055
+ if (arg.kind !== 231 /* OmittedExpression */ && !(checkMode & 64 /* IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) {
72058
72056
  const paramType = getTypeAtPosition(signature, i);
72059
72057
  if (couldContainTypeVariables(paramType)) {
72060
72058
  const argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
@@ -72667,12 +72665,12 @@ ${lanes.join("\n")}
72667
72665
  const args = getEffectiveCallArguments(node);
72668
72666
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
72669
72667
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
72670
- argCheckMode |= checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72668
+ argCheckMode |= checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72671
72669
  let candidatesForArgumentError;
72672
72670
  let candidateForArgumentArityError;
72673
72671
  let candidateForTypeArgumentError;
72674
72672
  let result;
72675
- const signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72673
+ const signatureHelpTrailingComma = !!(checkMode & 32 /* IsForSignatureHelp */) && node.kind === 212 /* CallExpression */ && node.arguments.hasTrailingComma;
72676
72674
  if (candidates.length > 1) {
72677
72675
  result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma);
72678
72676
  }
@@ -72891,7 +72889,7 @@ ${lanes.join("\n")}
72891
72889
  continue;
72892
72890
  }
72893
72891
  if (argCheckMode) {
72894
- argCheckMode = checkMode & 32 /* IsForStringLiteralArgumentCompletions */;
72892
+ argCheckMode = checkMode & 64 /* IsForStringLiteralArgumentCompletions */;
72895
72893
  if (inferenceContext) {
72896
72894
  const typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
72897
72895
  checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, isInJSFile(candidate.declaration), inferenceContext.inferredTypeParameters);
@@ -75969,7 +75967,7 @@ ${lanes.join("\n")}
75969
75967
  case 36 /* ExclamationEqualsToken */:
75970
75968
  case 37 /* EqualsEqualsEqualsToken */:
75971
75969
  case 38 /* ExclamationEqualsEqualsToken */:
75972
- if (!(checkMode && checkMode & 128 /* TypeOnly */)) {
75970
+ if (!(checkMode && checkMode & 256 /* TypeOnly */)) {
75973
75971
  if (isLiteralExpressionOfObject(left) || isLiteralExpressionOfObject(right)) {
75974
75972
  const eqType = operator === 35 /* EqualsEqualsToken */ || operator === 37 /* EqualsEqualsEqualsToken */;
75975
75973
  error(errorNode, Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true");
@@ -76628,7 +76626,7 @@ ${lanes.join("\n")}
76628
76626
  }
76629
76627
  }
76630
76628
  const startInvocationCount = flowInvocationCount;
76631
- const type = checkExpression(node, 128 /* TypeOnly */);
76629
+ const type = checkExpression(node, 256 /* TypeOnly */);
76632
76630
  if (flowInvocationCount !== startInvocationCount) {
76633
76631
  const cache = flowTypeCache || (flowTypeCache = []);
76634
76632
  cache[getNodeId(node)] = type;
@@ -79099,7 +79097,7 @@ ${lanes.join("\n")}
79099
79097
  checkComputedPropertyName(node.propertyName);
79100
79098
  }
79101
79099
  const parent2 = node.parent.parent;
79102
- const parentCheckMode = node.dotDotDotToken ? 64 /* RestBindingElement */ : 0 /* Normal */;
79100
+ const parentCheckMode = node.dotDotDotToken ? 128 /* RestBindingElement */ : 0 /* Normal */;
79103
79101
  const parentType = getTypeForBindingElementParent(parent2, parentCheckMode);
79104
79102
  const name = node.propertyName || node.name;
79105
79103
  if (parentType && !isBindingPattern(name)) {
@@ -85835,10 +85833,11 @@ ${lanes.join("\n")}
85835
85833
  CheckMode3[CheckMode3["Inferential"] = 2] = "Inferential";
85836
85834
  CheckMode3[CheckMode3["SkipContextSensitive"] = 4] = "SkipContextSensitive";
85837
85835
  CheckMode3[CheckMode3["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
85838
- CheckMode3[CheckMode3["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
85839
- CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 32] = "IsForStringLiteralArgumentCompletions";
85840
- CheckMode3[CheckMode3["RestBindingElement"] = 64] = "RestBindingElement";
85841
- CheckMode3[CheckMode3["TypeOnly"] = 128] = "TypeOnly";
85836
+ CheckMode3[CheckMode3["SkipAddingIntraExpressionSites"] = 16] = "SkipAddingIntraExpressionSites";
85837
+ CheckMode3[CheckMode3["IsForSignatureHelp"] = 32] = "IsForSignatureHelp";
85838
+ CheckMode3[CheckMode3["IsForStringLiteralArgumentCompletions"] = 64] = "IsForStringLiteralArgumentCompletions";
85839
+ CheckMode3[CheckMode3["RestBindingElement"] = 128] = "RestBindingElement";
85840
+ CheckMode3[CheckMode3["TypeOnly"] = 256] = "TypeOnly";
85842
85841
  return CheckMode3;
85843
85842
  })(CheckMode || {});
85844
85843
  SignatureCheckMode = /* @__PURE__ */ ((SignatureCheckMode3) => {
@@ -162110,13 +162109,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
162110
162109
  if (!signature || !candidates.length) {
162111
162110
  return;
162112
162111
  }
162113
- for (let i = 0; i < args.length; ++i) {
162114
- const originalArg = args[i];
162112
+ let signatureParamPos = 0;
162113
+ for (const originalArg of args) {
162115
162114
  const arg = skipParentheses(originalArg);
162116
162115
  if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
162117
162116
  continue;
162118
162117
  }
162119
- const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, i);
162118
+ let spreadArgs = 0;
162119
+ if (isSpreadElement(arg)) {
162120
+ const spreadType = checker.getTypeAtLocation(arg.expression);
162121
+ if (checker.isTupleType(spreadType)) {
162122
+ const { elementFlags, fixedLength } = spreadType.target;
162123
+ if (fixedLength === 0) {
162124
+ continue;
162125
+ }
162126
+ const firstOptionalIndex = findIndex(elementFlags, (f) => !(f & 1 /* Required */));
162127
+ const requiredArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162128
+ if (requiredArgs > 0) {
162129
+ spreadArgs = firstOptionalIndex < 0 ? fixedLength : firstOptionalIndex;
162130
+ }
162131
+ }
162132
+ }
162133
+ const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
162134
+ signatureParamPos = signatureParamPos + (spreadArgs || 1);
162120
162135
  if (identifierNameInfo) {
162121
162136
  const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
162122
162137
  const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);