typescript 5.2.0-dev.20230626 → 5.2.0-dev.20230627

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.20230626`;
38
+ version = `${versionMajorMinor}.0-dev.20230627`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -7516,7 +7516,6 @@ ${lanes.join("\n")}
7516
7516
  This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_version_of_0: diag(2343, 1 /* Error */, "This_syntax_requires_an_imported_helper_named_1_which_does_not_exist_in_0_Consider_upgrading_your_ve_2343", "This syntax requires an imported helper named '{1}' which does not exist in '{0}'. Consider upgrading your version of '{0}'."),
7517
7517
  Type_0_does_not_satisfy_the_constraint_1: diag(2344, 1 /* Error */, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."),
7518
7518
  Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, 1 /* Error */, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."),
7519
- Call_target_does_not_contain_any_signatures: diag(2346, 1 /* Error */, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."),
7520
7519
  Untyped_function_calls_may_not_accept_type_arguments: diag(2347, 1 /* Error */, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."),
7521
7520
  Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, 1 /* Error */, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"),
7522
7521
  This_expression_is_not_callable: diag(2349, 1 /* Error */, "This_expression_is_not_callable_2349", "This expression is not callable."),
@@ -8126,7 +8125,6 @@ ${lanes.join("\n")}
8126
8125
  Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0: diag(5081, 1 /* Error */, "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081", "Cannot find a tsconfig.json file at the current directory: {0}."),
8127
8126
  _0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1: diag(5082, 1 /* Error */, "_0_could_be_instantiated_with_an_arbitrary_type_which_could_be_unrelated_to_1_5082", "'{0}' could be instantiated with an arbitrary type which could be unrelated to '{1}'."),
8128
8127
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
8129
- Tuple_members_must_all_have_names_or_all_not_have_names: diag(5084, 1 /* Error */, "Tuple_members_must_all_have_names_or_all_not_have_names_5084", "Tuple members must all have names or all not have names."),
8130
8128
  A_tuple_member_cannot_be_both_optional_and_rest: diag(5085, 1 /* Error */, "A_tuple_member_cannot_be_both_optional_and_rest_5085", "A tuple member cannot be both optional and rest."),
8131
8129
  A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type: diag(5086, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_c_5086", "A labeled tuple element is declared as optional with a question mark after the name and before the colon, rather than after the type."),
8132
8130
  A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type: diag(5087, 1 /* Error */, "A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type_5087", "A labeled tuple element is declared as rest with a '...' before the name, rather than before the type."),
@@ -9052,6 +9050,7 @@ ${lanes.join("\n")}
9052
9050
  Inline_variable: diag(95184, 3 /* Message */, "Inline_variable_95184", "Inline variable"),
9053
9051
  Could_not_find_variable_to_inline: diag(95185, 3 /* Message */, "Could_not_find_variable_to_inline_95185", "Could not find variable to inline."),
9054
9052
  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."),
9053
+ Add_missing_comma_for_object_member_completion_0: diag(95187, 3 /* Message */, "Add_missing_comma_for_object_member_completion_0_95187", "Add missing comma for object member completion '{0}'."),
9055
9054
  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."),
9056
9055
  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'."),
9057
9056
  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?"),
@@ -50407,19 +50406,18 @@ ${lanes.join("\n")}
50407
50406
  const arity = getTypeReferenceArity(type2);
50408
50407
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50409
50408
  if (tupleConstituentNodes) {
50410
- if (type2.target.labeledElementDeclarations) {
50411
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
50412
- const flags = type2.target.elementFlags[i];
50409
+ const { labeledElementDeclarations } = type2.target;
50410
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50411
+ const flags = type2.target.elementFlags[i];
50412
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50413
+ if (labeledElementDeclaration) {
50413
50414
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50414
50415
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50415
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50416
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50416
50417
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50417
50418
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50418
50419
  );
50419
- }
50420
- } else {
50421
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50422
- const flags = type2.target.elementFlags[i];
50420
+ } else {
50423
50421
  tupleConstituentNodes[i] = flags & 12 /* Variable */ ? factory.createRestTypeNode(flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]) : flags & 2 /* Optional */ ? factory.createOptionalTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i];
50424
50422
  }
50425
50423
  }
@@ -55531,17 +55529,18 @@ ${lanes.join("\n")}
55531
55529
  function getExpandedParameters(sig, skipUnionExpanding) {
55532
55530
  if (signatureHasRestParameter(sig)) {
55533
55531
  const restIndex = sig.parameters.length - 1;
55532
+ const restName = sig.parameters[restIndex].escapedName;
55534
55533
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55535
55534
  if (isTupleType(restType)) {
55536
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55535
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55537
55536
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55538
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55537
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55539
55538
  }
55540
55539
  }
55541
55540
  return [sig.parameters];
55542
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55543
- const elementTypes = getElementTypes(restType);
55544
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55541
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55542
+ const elementTypes = getTypeArguments(restType);
55543
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55545
55544
  const restParams = map(elementTypes, (t, i) => {
55546
55545
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55547
55546
  const flags = restType.target.elementFlags[i];
@@ -55552,10 +55551,10 @@ ${lanes.join("\n")}
55552
55551
  });
55553
55552
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55554
55553
  }
55555
- function getUniqAssociatedNamesFromTupleType(type) {
55554
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
55556
55555
  const associatedNamesMap = /* @__PURE__ */ new Map();
55557
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
55558
- const name = getTupleElementLabel(labeledElement);
55556
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55557
+ const name = getTupleElementLabel(labeledElement, i, restName);
55559
55558
  const prevCounter = associatedNamesMap.get(name);
55560
55559
  if (prevCounter === void 0) {
55561
55560
  associatedNamesMap.set(name, 1);
@@ -58489,13 +58488,10 @@ ${lanes.join("\n")}
58489
58488
  return readonly ? globalReadonlyArrayType : globalArrayType;
58490
58489
  }
58491
58490
  const elementFlags = map(node.elements, getTupleElementFlags);
58492
- const missingName = some(node.elements, (e) => e.kind !== 202 /* NamedTupleMember */);
58493
- return getTupleTargetType(
58494
- elementFlags,
58495
- readonly,
58496
- /*associatedNames*/
58497
- missingName ? void 0 : node.elements
58498
- );
58491
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58492
+ }
58493
+ function memberIfLabeledElementDeclaration(member) {
58494
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
58499
58495
  }
58500
58496
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58501
58497
  return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 188 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 189 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
@@ -58570,7 +58566,7 @@ ${lanes.join("\n")}
58570
58566
  function isReadonlyTypeOperator(node) {
58571
58567
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58572
58568
  }
58573
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58569
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58574
58570
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58575
58571
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58576
58572
  }
@@ -58578,7 +58574,8 @@ ${lanes.join("\n")}
58578
58574
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58579
58575
  return readonly ? globalReadonlyArrayType : globalArrayType;
58580
58576
  }
58581
- const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : "");
58577
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
58578
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
58582
58579
  let type = tupleTypes.get(key);
58583
58580
  if (!type) {
58584
58581
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58660,7 +58657,7 @@ ${lanes.join("\n")}
58660
58657
  }
58661
58658
  const expandedTypes = [];
58662
58659
  const expandedFlags = [];
58663
- let expandedDeclarations = [];
58660
+ const expandedDeclarations = [];
58664
58661
  let lastRequiredIndex = -1;
58665
58662
  let firstRestIndex = -1;
58666
58663
  let lastOptionalOrRestIndex = -1;
@@ -58698,7 +58695,7 @@ ${lanes.join("\n")}
58698
58695
  ));
58699
58696
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58700
58697
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58701
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58698
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58702
58699
  }
58703
58700
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58704
58701
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58718,11 +58715,7 @@ ${lanes.join("\n")}
58718
58715
  true
58719
58716
  ) : type);
58720
58717
  expandedFlags.push(flags);
58721
- if (expandedDeclarations && declaration) {
58722
- expandedDeclarations.push(declaration);
58723
- } else {
58724
- expandedDeclarations = void 0;
58725
- }
58718
+ expandedDeclarations.push(declaration);
58726
58719
  }
58727
58720
  }
58728
58721
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -63396,7 +63389,6 @@ ${lanes.join("\n")}
63396
63389
  } else if (targetFlags & 8388608 /* IndexedAccess */) {
63397
63390
  if (sourceFlags & 8388608 /* IndexedAccess */) {
63398
63391
  if (result2 = isRelatedTo(source2.objectType, target2.objectType, 3 /* Both */, reportErrors2)) {
63399
- instantiateType(source2.objectType, reportUnreliableMapper);
63400
63392
  result2 &= isRelatedTo(source2.indexType, target2.indexType, 3 /* Both */, reportErrors2);
63401
63393
  }
63402
63394
  if (result2) {
@@ -69081,17 +69073,14 @@ ${lanes.join("\n")}
69081
69073
  }
69082
69074
  }
69083
69075
  function getTypeForThisExpressionFromJSDoc(node) {
69084
- const jsdocType = getJSDocType(node);
69085
- if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
69086
- const jsDocFunctionType = jsdocType;
69087
- if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
69088
- return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
69089
- }
69090
- }
69091
69076
  const thisTag = getJSDocThisTag(node);
69092
69077
  if (thisTag && thisTag.typeExpression) {
69093
69078
  return getTypeFromTypeNode(thisTag.typeExpression);
69094
69079
  }
69080
+ const signature = getSignatureOfTypeTag(node);
69081
+ if (signature) {
69082
+ return getThisTypeOfSignature(signature);
69083
+ }
69095
69084
  }
69096
69085
  function isInConstructorArgumentInitializer(node, constructorDecl) {
69097
69086
  return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
@@ -72993,12 +72982,7 @@ ${lanes.join("\n")}
72993
72982
  }
72994
72983
  const candidates = candidatesOutArray || [];
72995
72984
  reorderCandidates(signatures, candidates, callChainFlags);
72996
- if (!candidates.length) {
72997
- if (reportErrors2) {
72998
- diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
72999
- }
73000
- return resolveErrorCall(node);
73001
- }
72985
+ Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
73002
72986
  const args = getEffectiveCallArguments(node);
73003
72987
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
73004
72988
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
@@ -74450,7 +74434,10 @@ ${lanes.join("\n")}
74450
74434
  }
74451
74435
  return type;
74452
74436
  }
74453
- function getTupleElementLabel(d) {
74437
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
74438
+ if (!d) {
74439
+ return `${restParameterName}_${index}`;
74440
+ }
74454
74441
  Debug.assert(isIdentifier(d.name));
74455
74442
  return d.name.escapedText;
74456
74443
  }
@@ -74464,7 +74451,7 @@ ${lanes.join("\n")}
74464
74451
  if (isTupleType(restType)) {
74465
74452
  const associatedNames = restType.target.labeledElementDeclarations;
74466
74453
  const index = pos - paramCount;
74467
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74454
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74468
74455
  }
74469
74456
  return restParameter.escapedName;
74470
74457
  }
@@ -77819,12 +77806,7 @@ ${lanes.join("\n")}
77819
77806
  const elementTypes = node.elements;
77820
77807
  let seenOptionalElement = false;
77821
77808
  let seenRestElement = false;
77822
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
77823
77809
  for (const e of elementTypes) {
77824
- if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
77825
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
77826
- break;
77827
- }
77828
77810
  const flags = getTupleElementFlags(e);
77829
77811
  if (flags & 8 /* Variadic */) {
77830
77812
  const type = getTypeFromTypeNode(e.type);
@@ -110460,6 +110442,21 @@ ${lanes.join("\n")}
110460
110442
  const modifiers = factory2.createModifiersFromModifierFlags(getEffectiveModifierFlags(statement) & (258047 /* All */ ^ 1 /* Export */));
110461
110443
  return factory2.updateModifiers(statement, modifiers);
110462
110444
  }
110445
+ function updateModuleDeclarationAndKeyword(node, modifiers, name, body) {
110446
+ const updated = factory2.updateModuleDeclaration(node, modifiers, name, body);
110447
+ if (isAmbientModule(updated) || updated.flags & 32 /* Namespace */) {
110448
+ return updated;
110449
+ }
110450
+ const fixed = factory2.createModuleDeclaration(
110451
+ updated.modifiers,
110452
+ updated.name,
110453
+ updated.body,
110454
+ updated.flags | 32 /* Namespace */
110455
+ );
110456
+ setOriginalNode(fixed, updated);
110457
+ setTextRange(fixed, updated);
110458
+ return fixed;
110459
+ }
110463
110460
  function transformTopLevelDeclaration(input) {
110464
110461
  if (lateMarkedStatements) {
110465
110462
  while (orderedRemoveItem(lateMarkedStatements, input))
@@ -110647,7 +110644,7 @@ ${lanes.join("\n")}
110647
110644
  needsScopeFixMarker = oldNeedsScopeFix;
110648
110645
  resultHasScopeMarker = oldHasScopeFix;
110649
110646
  const mods = ensureModifiers(input);
110650
- return cleanup(factory2.updateModuleDeclaration(
110647
+ return cleanup(updateModuleDeclarationAndKeyword(
110651
110648
  input,
110652
110649
  mods,
110653
110650
  isExternalModuleAugmentation(input) ? rewriteModuleSpecifier(input, input.name) : input.name,
@@ -110661,7 +110658,7 @@ ${lanes.join("\n")}
110661
110658
  const id = getOriginalNodeId(inner);
110662
110659
  const body = lateStatementReplacementMap.get(id);
110663
110660
  lateStatementReplacementMap.delete(id);
110664
- return cleanup(factory2.updateModuleDeclaration(
110661
+ return cleanup(updateModuleDeclarationAndKeyword(
110665
110662
  input,
110666
110663
  mods,
110667
110664
  input.name,
@@ -136381,7 +136378,10 @@ ${lanes.join("\n")}
136381
136378
  if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
136382
136379
  return factory.createParenthesizedExpression(replacement);
136383
136380
  }
136384
- if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
136381
+ if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
136382
+ return factory.createParenthesizedExpression(replacement);
136383
+ }
136384
+ if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
136385
136385
  return factory.createParenthesizedExpression(replacement);
136386
136386
  }
136387
136387
  return replacement;
@@ -156772,6 +156772,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
156772
156772
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
156773
156773
  }
156774
156774
  function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, position, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol) {
156775
+ var _a, _b;
156775
156776
  let insertText;
156776
156777
  let filterText;
156777
156778
  let replacementSpan = getReplacementSpanForContextToken(replacementToken);
@@ -156830,6 +156831,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
156830
156831
  if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
156831
156832
  hasAction = true;
156832
156833
  }
156834
+ if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
156835
+ if (isMethodDeclaration(contextToken.parent.parent) || isGetAccessorDeclaration(contextToken.parent.parent) || isSetAccessorDeclaration(contextToken.parent.parent) || isSpreadAssignment(contextToken.parent) || ((_b = findAncestor(contextToken.parent, isPropertyAssignment)) == null ? void 0 : _b.getLastToken(sourceFile)) === contextToken || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line) {
156836
+ source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
156837
+ hasAction = true;
156838
+ }
156839
+ }
156833
156840
  if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
156834
156841
  let importAdder;
156835
156842
  const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
@@ -157393,7 +157400,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157393
157400
  }
157394
157401
  function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, position, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag, includeSymbol = false) {
157395
157402
  const start = timestamp();
157396
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
157403
+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
157397
157404
  const useSemicolons = probablyUsesSemicolons(sourceFile);
157398
157405
  const typeChecker = program.getTypeChecker();
157399
157406
  const uniques = /* @__PURE__ */ new Map();
@@ -157560,7 +157567,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157560
157567
  return firstDefined(symbols, (symbol, index) => {
157561
157568
  const origin = symbolToOriginInfoMap[index];
157562
157569
  const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
157563
- return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
157570
+ return info && info.name === entryId.name && (entryId.source === "ClassMemberSnippet/" /* ClassMemberSnippet */ && symbol.flags & 106500 /* ClassMember */ || entryId.source === "ObjectLiteralMethodSnippet/" /* ObjectLiteralMethodSnippet */ && symbol.flags & (4 /* Property */ | 8192 /* Method */) || getSourceFromOrigin(origin) === entryId.source || entryId.source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */) ? { type: "symbol", symbol, location, origin, contextToken, previousToken, isJsxInitializer, isTypeOnlyLocation } : void 0;
157564
157571
  }) || { type: "none" };
157565
157572
  }
157566
157573
  function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
@@ -157705,6 +157712,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157705
157712
  Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
157706
157713
  return { codeActions: [codeAction2], sourceDisplay: void 0 };
157707
157714
  }
157715
+ if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
157716
+ const changes = ts_textChanges_exports.ChangeTracker.with(
157717
+ { host, formatContext, preferences },
157718
+ (tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
157719
+ );
157720
+ if (changes) {
157721
+ return {
157722
+ sourceDisplay: void 0,
157723
+ codeActions: [{
157724
+ changes,
157725
+ description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
157726
+ }]
157727
+ };
157728
+ }
157729
+ }
157708
157730
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
157709
157731
  return { codeActions: void 0, sourceDisplay: void 0 };
157710
157732
  }
@@ -158602,7 +158624,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158602
158624
  }
158603
158625
  function tryGetObjectLikeCompletionSymbols() {
158604
158626
  const symbolsStartIndex = symbols.length;
158605
- const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
158627
+ const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
158606
158628
  if (!objectLikeContainer)
158607
158629
  return 0 /* Continue */;
158608
158630
  completionKind = 0 /* ObjectPropertyDeclaration */;
@@ -159088,7 +159110,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159088
159110
  return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
159089
159111
  }
159090
159112
  }
159091
- function tryGetObjectLikeCompletionContainer(contextToken) {
159113
+ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
159114
+ var _a;
159092
159115
  if (contextToken) {
159093
159116
  const { parent: parent2 } = contextToken;
159094
159117
  switch (contextToken.kind) {
@@ -159103,7 +159126,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159103
159126
  case 134 /* AsyncKeyword */:
159104
159127
  return tryCast(parent2.parent, isObjectLiteralExpression);
159105
159128
  case 80 /* Identifier */:
159106
- return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
159129
+ if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
159130
+ return contextToken.parent.parent;
159131
+ } else {
159132
+ if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
159133
+ return contextToken.parent.parent;
159134
+ }
159135
+ const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
159136
+ if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
159137
+ return ancestorNode2.parent;
159138
+ }
159139
+ }
159140
+ break;
159141
+ default:
159142
+ if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
159143
+ return parent2.parent.parent;
159144
+ }
159145
+ if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
159146
+ return parent2.parent;
159147
+ }
159148
+ const ancestorNode = findAncestor(parent2, isPropertyAssignment);
159149
+ if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
159150
+ return ancestorNode.parent;
159151
+ }
159107
159152
  }
159108
159153
  }
159109
159154
  return void 0;
@@ -159557,11 +159602,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159557
159602
  return true;
159558
159603
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
159559
159604
  }
159560
- function getVariableOrParameterDeclaration(contextToken) {
159605
+ function getVariableOrParameterDeclaration(contextToken, location) {
159561
159606
  if (!contextToken)
159562
159607
  return;
159563
- const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
159564
- return declaration;
159608
+ const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
159609
+ const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
159610
+ return possiblyParameterDeclaration || possiblyVariableDeclaration;
159565
159611
  }
159566
159612
  function isArrowFunctionBody(node) {
159567
159613
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -159645,6 +159691,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159645
159691
  CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
159646
159692
  CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
159647
159693
  CompletionSource2["SwitchCases"] = "SwitchCases/";
159694
+ CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
159648
159695
  return CompletionSource2;
159649
159696
  })(CompletionSource || {});
159650
159697
  SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
@@ -2898,7 +2898,7 @@ declare namespace ts {
2898
2898
  hasRestElement: boolean;
2899
2899
  combinedFlags: ElementFlags;
2900
2900
  readonly: boolean;
2901
- labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
2901
+ labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
2902
2902
  }
2903
2903
  interface TupleTypeReference extends TypeReference {
2904
2904
  target: TupleType;