@typescript-deploys/pr-build 5.2.0-pr-54781-9 → 5.2.0-pr-52493-8

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.20230626`;
38
+ version = `${versionMajorMinor}.0-insiders.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?"),
@@ -14906,8 +14905,8 @@ ${lanes.join("\n")}
14906
14905
  return forStatement.initializer === node && forStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forStatement.condition === node || forStatement.incrementor === node;
14907
14906
  case 249 /* ForInStatement */:
14908
14907
  case 250 /* ForOfStatement */:
14909
- const forInStatement = parent2;
14910
- return forInStatement.initializer === node && forInStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInStatement.expression === node;
14908
+ const forInOrOfStatement = parent2;
14909
+ return forInOrOfStatement.initializer === node && forInOrOfStatement.initializer.kind !== 261 /* VariableDeclarationList */ || forInOrOfStatement.expression === node;
14911
14910
  case 216 /* TypeAssertionExpression */:
14912
14911
  case 234 /* AsExpression */:
14913
14912
  return node === parent2.expression;
@@ -15597,20 +15596,23 @@ ${lanes.join("\n")}
15597
15596
  function hasTypeArguments(node) {
15598
15597
  return !!node.typeArguments;
15599
15598
  }
15600
- function getAssignmentTargetKind(node) {
15599
+ function getAssignmentTarget(node) {
15601
15600
  let parent2 = node.parent;
15602
15601
  while (true) {
15603
15602
  switch (parent2.kind) {
15604
15603
  case 226 /* BinaryExpression */:
15605
- const binaryOperator = parent2.operatorToken.kind;
15606
- return isAssignmentOperator(binaryOperator) && parent2.left === node ? binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */ : 0 /* None */;
15604
+ const binaryExpression = parent2;
15605
+ const binaryOperator = binaryExpression.operatorToken.kind;
15606
+ return isAssignmentOperator(binaryOperator) && binaryExpression.left === node ? binaryExpression : void 0;
15607
15607
  case 224 /* PrefixUnaryExpression */:
15608
15608
  case 225 /* PostfixUnaryExpression */:
15609
- const unaryOperator = parent2.operator;
15610
- return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
15609
+ const unaryExpression = parent2;
15610
+ const unaryOperator = unaryExpression.operator;
15611
+ return unaryOperator === 46 /* PlusPlusToken */ || unaryOperator === 47 /* MinusMinusToken */ ? unaryExpression : void 0;
15611
15612
  case 249 /* ForInStatement */:
15612
15613
  case 250 /* ForOfStatement */:
15613
- return parent2.initializer === node ? 1 /* Definite */ : 0 /* None */;
15614
+ const forInOrOfStatement = parent2;
15615
+ return forInOrOfStatement.initializer === node ? forInOrOfStatement : void 0;
15614
15616
  case 217 /* ParenthesizedExpression */:
15615
15617
  case 209 /* ArrayLiteralExpression */:
15616
15618
  case 230 /* SpreadElement */:
@@ -15622,24 +15624,53 @@ ${lanes.join("\n")}
15622
15624
  break;
15623
15625
  case 304 /* ShorthandPropertyAssignment */:
15624
15626
  if (parent2.name !== node) {
15625
- return 0 /* None */;
15627
+ return void 0;
15626
15628
  }
15627
15629
  node = parent2.parent;
15628
15630
  break;
15629
15631
  case 303 /* PropertyAssignment */:
15630
15632
  if (parent2.name === node) {
15631
- return 0 /* None */;
15633
+ return void 0;
15632
15634
  }
15633
15635
  node = parent2.parent;
15634
15636
  break;
15635
15637
  default:
15636
- return 0 /* None */;
15638
+ return void 0;
15637
15639
  }
15638
15640
  parent2 = node.parent;
15639
15641
  }
15640
15642
  }
15643
+ function getAssignmentTargetKind(node) {
15644
+ const target = getAssignmentTarget(node);
15645
+ if (!target) {
15646
+ return 0 /* None */;
15647
+ }
15648
+ switch (target.kind) {
15649
+ case 226 /* BinaryExpression */:
15650
+ const binaryOperator = target.operatorToken.kind;
15651
+ return binaryOperator === 64 /* EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* Definite */ : 2 /* Compound */;
15652
+ case 224 /* PrefixUnaryExpression */:
15653
+ case 225 /* PostfixUnaryExpression */:
15654
+ return 2 /* Compound */;
15655
+ case 249 /* ForInStatement */:
15656
+ case 250 /* ForOfStatement */:
15657
+ return 1 /* Definite */;
15658
+ }
15659
+ }
15641
15660
  function isAssignmentTarget(node) {
15642
- return getAssignmentTargetKind(node) !== 0 /* None */;
15661
+ return !!getAssignmentTarget(node);
15662
+ }
15663
+ function isCompoundLikeAssignment(assignment) {
15664
+ const right = skipParentheses(assignment.right);
15665
+ return right.kind === 226 /* BinaryExpression */ && isShiftOperatorOrHigher(right.operatorToken.kind);
15666
+ }
15667
+ function isInCompoundLikeAssignment(node) {
15668
+ const target = getAssignmentTarget(node);
15669
+ return !!target && isAssignmentExpression(
15670
+ target,
15671
+ /*excludeCompoundAssignment*/
15672
+ true
15673
+ ) && isCompoundLikeAssignment(target);
15643
15674
  }
15644
15675
  function isNodeWithPossibleHoistedDeclaration(node) {
15645
15676
  switch (node.kind) {
@@ -50407,19 +50438,18 @@ ${lanes.join("\n")}
50407
50438
  const arity = getTypeReferenceArity(type2);
50408
50439
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50409
50440
  if (tupleConstituentNodes) {
50410
- if (type2.target.labeledElementDeclarations) {
50411
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
50412
- const flags = type2.target.elementFlags[i];
50441
+ const { labeledElementDeclarations } = type2.target;
50442
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50443
+ const flags = type2.target.elementFlags[i];
50444
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50445
+ if (labeledElementDeclaration) {
50413
50446
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50414
50447
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50415
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50448
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50416
50449
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50417
50450
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50418
50451
  );
50419
- }
50420
- } else {
50421
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50422
- const flags = type2.target.elementFlags[i];
50452
+ } else {
50423
50453
  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
50454
  }
50425
50455
  }
@@ -55531,17 +55561,18 @@ ${lanes.join("\n")}
55531
55561
  function getExpandedParameters(sig, skipUnionExpanding) {
55532
55562
  if (signatureHasRestParameter(sig)) {
55533
55563
  const restIndex = sig.parameters.length - 1;
55564
+ const restName = sig.parameters[restIndex].escapedName;
55534
55565
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55535
55566
  if (isTupleType(restType)) {
55536
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55567
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55537
55568
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55538
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55569
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55539
55570
  }
55540
55571
  }
55541
55572
  return [sig.parameters];
55542
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55543
- const elementTypes = getElementTypes(restType);
55544
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55573
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55574
+ const elementTypes = getTypeArguments(restType);
55575
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55545
55576
  const restParams = map(elementTypes, (t, i) => {
55546
55577
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55547
55578
  const flags = restType.target.elementFlags[i];
@@ -55552,10 +55583,10 @@ ${lanes.join("\n")}
55552
55583
  });
55553
55584
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55554
55585
  }
55555
- function getUniqAssociatedNamesFromTupleType(type) {
55586
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
55556
55587
  const associatedNamesMap = /* @__PURE__ */ new Map();
55557
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
55558
- const name = getTupleElementLabel(labeledElement);
55588
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55589
+ const name = getTupleElementLabel(labeledElement, i, restName);
55559
55590
  const prevCounter = associatedNamesMap.get(name);
55560
55591
  if (prevCounter === void 0) {
55561
55592
  associatedNamesMap.set(name, 1);
@@ -58489,13 +58520,10 @@ ${lanes.join("\n")}
58489
58520
  return readonly ? globalReadonlyArrayType : globalArrayType;
58490
58521
  }
58491
58522
  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
- );
58523
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58524
+ }
58525
+ function memberIfLabeledElementDeclaration(member) {
58526
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
58499
58527
  }
58500
58528
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58501
58529
  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 +58598,7 @@ ${lanes.join("\n")}
58570
58598
  function isReadonlyTypeOperator(node) {
58571
58599
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58572
58600
  }
58573
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58601
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58574
58602
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58575
58603
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58576
58604
  }
@@ -58578,7 +58606,8 @@ ${lanes.join("\n")}
58578
58606
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58579
58607
  return readonly ? globalReadonlyArrayType : globalArrayType;
58580
58608
  }
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(",") : "");
58609
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
58610
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
58582
58611
  let type = tupleTypes.get(key);
58583
58612
  if (!type) {
58584
58613
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58660,7 +58689,7 @@ ${lanes.join("\n")}
58660
58689
  }
58661
58690
  const expandedTypes = [];
58662
58691
  const expandedFlags = [];
58663
- let expandedDeclarations = [];
58692
+ const expandedDeclarations = [];
58664
58693
  let lastRequiredIndex = -1;
58665
58694
  let firstRestIndex = -1;
58666
58695
  let lastOptionalOrRestIndex = -1;
@@ -58698,7 +58727,7 @@ ${lanes.join("\n")}
58698
58727
  ));
58699
58728
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58700
58729
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58701
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58730
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58702
58731
  }
58703
58732
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58704
58733
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58718,11 +58747,7 @@ ${lanes.join("\n")}
58718
58747
  true
58719
58748
  ) : type);
58720
58749
  expandedFlags.push(flags);
58721
- if (expandedDeclarations && declaration) {
58722
- expandedDeclarations.push(declaration);
58723
- } else {
58724
- expandedDeclarations = void 0;
58725
- }
58750
+ expandedDeclarations.push(declaration);
58726
58751
  }
58727
58752
  }
58728
58753
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -67621,10 +67646,11 @@ ${lanes.join("\n")}
67621
67646
  const assignedType = getWidenedLiteralType(getInitialOrAssignedType(flow));
67622
67647
  return isTypeAssignableTo(assignedType, declaredType) ? assignedType : anyArrayType;
67623
67648
  }
67624
- if (declaredType.flags & 1048576 /* Union */) {
67625
- return getAssignmentReducedType(declaredType, getInitialOrAssignedType(flow));
67649
+ const t = isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(declaredType) : declaredType;
67650
+ if (t.flags & 1048576 /* Union */) {
67651
+ return getAssignmentReducedType(t, getInitialOrAssignedType(flow));
67626
67652
  }
67627
- return declaredType;
67653
+ return t;
67628
67654
  }
67629
67655
  if (containsMatchingReference(reference, node)) {
67630
67656
  if (!isReachableFlowNode(flow)) {
@@ -68753,7 +68779,7 @@ ${lanes.join("\n")}
68753
68779
  const isAlias = localOrExportSymbol.flags & 2097152 /* Alias */;
68754
68780
  if (localOrExportSymbol.flags & 3 /* Variable */) {
68755
68781
  if (assignmentKind === 1 /* Definite */) {
68756
- return type;
68782
+ return isInCompoundLikeAssignment(node) ? getBaseTypeOfLiteralType(type) : type;
68757
68783
  }
68758
68784
  } else if (isAlias) {
68759
68785
  declaration = getDeclarationOfAliasSymbol(symbol);
@@ -69080,17 +69106,14 @@ ${lanes.join("\n")}
69080
69106
  }
69081
69107
  }
69082
69108
  function getTypeForThisExpressionFromJSDoc(node) {
69083
- const jsdocType = getJSDocType(node);
69084
- if (jsdocType && jsdocType.kind === 324 /* JSDocFunctionType */) {
69085
- const jsDocFunctionType = jsdocType;
69086
- if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && jsDocFunctionType.parameters[0].name.escapedText === "this" /* This */) {
69087
- return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type);
69088
- }
69089
- }
69090
69109
  const thisTag = getJSDocThisTag(node);
69091
69110
  if (thisTag && thisTag.typeExpression) {
69092
69111
  return getTypeFromTypeNode(thisTag.typeExpression);
69093
69112
  }
69113
+ const signature = getSignatureOfTypeTag(node);
69114
+ if (signature) {
69115
+ return getThisTypeOfSignature(signature);
69116
+ }
69094
69117
  }
69095
69118
  function isInConstructorArgumentInitializer(node, constructorDecl) {
69096
69119
  return !!findAncestor(node, (n) => isFunctionLikeDeclaration(n) ? "quit" : n.kind === 169 /* Parameter */ && n.parent === constructorDecl);
@@ -72992,12 +73015,7 @@ ${lanes.join("\n")}
72992
73015
  }
72993
73016
  const candidates = candidatesOutArray || [];
72994
73017
  reorderCandidates(signatures, candidates, callChainFlags);
72995
- if (!candidates.length) {
72996
- if (reportErrors2) {
72997
- diagnostics.add(getDiagnosticForCallNode(node, Diagnostics.Call_target_does_not_contain_any_signatures));
72998
- }
72999
- return resolveErrorCall(node);
73000
- }
73018
+ Debug.assert(candidates.length, "Revert #54442 and add a testcase with whatever triggered this");
73001
73019
  const args = getEffectiveCallArguments(node);
73002
73020
  const isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
73003
73021
  let argCheckMode = !isDecorator2 && !isSingleNonGenericCandidate && some(args, isContextSensitive) ? 4 /* SkipContextSensitive */ : 0 /* Normal */;
@@ -74449,7 +74467,10 @@ ${lanes.join("\n")}
74449
74467
  }
74450
74468
  return type;
74451
74469
  }
74452
- function getTupleElementLabel(d) {
74470
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
74471
+ if (!d) {
74472
+ return `${restParameterName}_${index}`;
74473
+ }
74453
74474
  Debug.assert(isIdentifier(d.name));
74454
74475
  return d.name.escapedText;
74455
74476
  }
@@ -74463,7 +74484,7 @@ ${lanes.join("\n")}
74463
74484
  if (isTupleType(restType)) {
74464
74485
  const associatedNames = restType.target.labeledElementDeclarations;
74465
74486
  const index = pos - paramCount;
74466
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74487
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74467
74488
  }
74468
74489
  return restParameter.escapedName;
74469
74490
  }
@@ -77818,12 +77839,7 @@ ${lanes.join("\n")}
77818
77839
  const elementTypes = node.elements;
77819
77840
  let seenOptionalElement = false;
77820
77841
  let seenRestElement = false;
77821
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
77822
77842
  for (const e of elementTypes) {
77823
- if (e.kind !== 202 /* NamedTupleMember */ && hasNamedElement) {
77824
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
77825
- break;
77826
- }
77827
77843
  const flags = getTupleElementFlags(e);
77828
77844
  if (flags & 8 /* Variadic */) {
77829
77845
  const type = getTypeFromTypeNode(e.type);
@@ -136395,7 +136411,10 @@ ${lanes.join("\n")}
136395
136411
  if (isExpression(parent2) && (getExpressionPrecedence(replacement) < getExpressionPrecedence(parent2) || needsParentheses(parent2))) {
136396
136412
  return factory.createParenthesizedExpression(replacement);
136397
136413
  }
136398
- if (isFunctionLike(replacement) && isCallLikeExpression(parent2)) {
136414
+ if (isFunctionLike(replacement) && (isCallLikeExpression(parent2) || isPropertyAccessExpression(parent2))) {
136415
+ return factory.createParenthesizedExpression(replacement);
136416
+ }
136417
+ if (isPropertyAccessExpression(parent2) && (isNumericLiteral(replacement) || isObjectLiteralExpression(replacement))) {
136399
136418
  return factory.createParenthesizedExpression(replacement);
136400
136419
  }
136401
136420
  return replacement;
@@ -156786,6 +156805,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
156786
156805
  return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
156787
156806
  }
156788
156807
  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) {
156808
+ var _a, _b;
156789
156809
  let insertText;
156790
156810
  let filterText;
156791
156811
  let replacementSpan = getReplacementSpanForContextToken(replacementToken);
@@ -156844,6 +156864,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
156844
156864
  if ((origin == null ? void 0 : origin.kind) === 64 /* TypeOnlyAlias */) {
156845
156865
  hasAction = true;
156846
156866
  }
156867
+ if (completionKind === 0 /* ObjectPropertyDeclaration */ && contextToken && ((_a = findPrecedingToken(contextToken.pos, sourceFile, contextToken)) == null ? void 0 : _a.kind) !== 28 /* CommaToken */) {
156868
+ 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) {
156869
+ source = "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */;
156870
+ hasAction = true;
156871
+ }
156872
+ }
156847
156873
  if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* MemberLike */ && isClassLikeMemberCompletion(symbol, location, sourceFile)) {
156848
156874
  let importAdder;
156849
156875
  const memberCompletionEntry = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, position, contextToken, formatContext);
@@ -157407,7 +157433,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157407
157433
  }
157408
157434
  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) {
157409
157435
  const start = timestamp();
157410
- const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken);
157436
+ const variableOrParameterDeclaration = getVariableOrParameterDeclaration(contextToken, location);
157411
157437
  const useSemicolons = probablyUsesSemicolons(sourceFile);
157412
157438
  const typeChecker = program.getTypeChecker();
157413
157439
  const uniques = /* @__PURE__ */ new Map();
@@ -157574,7 +157600,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157574
157600
  return firstDefined(symbols, (symbol, index) => {
157575
157601
  const origin = symbolToOriginInfoMap[index];
157576
157602
  const info = getCompletionEntryDisplayNameForSymbol(symbol, getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
157577
- 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;
157603
+ 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;
157578
157604
  }) || { type: "none" };
157579
157605
  }
157580
157606
  function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
@@ -157719,6 +157745,21 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
157719
157745
  Debug.assertIsDefined(codeAction2, "Expected to have a code action for promoting type-only alias");
157720
157746
  return { codeActions: [codeAction2], sourceDisplay: void 0 };
157721
157747
  }
157748
+ if (source === "ObjectLiteralMemberWithComma/" /* ObjectLiteralMemberWithComma */ && contextToken) {
157749
+ const changes = ts_textChanges_exports.ChangeTracker.with(
157750
+ { host, formatContext, preferences },
157751
+ (tracker) => tracker.insertText(sourceFile, contextToken.end, ",")
157752
+ );
157753
+ if (changes) {
157754
+ return {
157755
+ sourceDisplay: void 0,
157756
+ codeActions: [{
157757
+ changes,
157758
+ description: diagnosticToString([Diagnostics.Add_missing_comma_for_object_member_completion_0, name])
157759
+ }]
157760
+ };
157761
+ }
157762
+ }
157722
157763
  if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
157723
157764
  return { codeActions: void 0, sourceDisplay: void 0 };
157724
157765
  }
@@ -158616,7 +158657,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
158616
158657
  }
158617
158658
  function tryGetObjectLikeCompletionSymbols() {
158618
158659
  const symbolsStartIndex = symbols.length;
158619
- const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken);
158660
+ const objectLikeContainer = tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile);
158620
158661
  if (!objectLikeContainer)
158621
158662
  return 0 /* Continue */;
158622
158663
  completionKind = 0 /* ObjectPropertyDeclaration */;
@@ -159102,7 +159143,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159102
159143
  return node2.getStart(sourceFile) <= position && position <= node2.getEnd();
159103
159144
  }
159104
159145
  }
159105
- function tryGetObjectLikeCompletionContainer(contextToken) {
159146
+ function tryGetObjectLikeCompletionContainer(contextToken, position, sourceFile) {
159147
+ var _a;
159106
159148
  if (contextToken) {
159107
159149
  const { parent: parent2 } = contextToken;
159108
159150
  switch (contextToken.kind) {
@@ -159117,7 +159159,29 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159117
159159
  case 134 /* AsyncKeyword */:
159118
159160
  return tryCast(parent2.parent, isObjectLiteralExpression);
159119
159161
  case 80 /* Identifier */:
159120
- return contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent) ? contextToken.parent.parent : void 0;
159162
+ if (contextToken.text === "async" && isShorthandPropertyAssignment(contextToken.parent)) {
159163
+ return contextToken.parent.parent;
159164
+ } else {
159165
+ if (isObjectLiteralExpression(contextToken.parent.parent) && (isSpreadAssignment(contextToken.parent) || isShorthandPropertyAssignment(contextToken.parent) && getLineAndCharacterOfPosition(sourceFile, contextToken.getEnd()).line !== getLineAndCharacterOfPosition(sourceFile, position).line)) {
159166
+ return contextToken.parent.parent;
159167
+ }
159168
+ const ancestorNode2 = findAncestor(parent2, isPropertyAssignment);
159169
+ if ((ancestorNode2 == null ? void 0 : ancestorNode2.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode2.parent)) {
159170
+ return ancestorNode2.parent;
159171
+ }
159172
+ }
159173
+ break;
159174
+ default:
159175
+ if (((_a = parent2.parent) == null ? void 0 : _a.parent) && (isMethodDeclaration(parent2.parent) || isGetAccessorDeclaration(parent2.parent) || isSetAccessorDeclaration(parent2.parent)) && isObjectLiteralExpression(parent2.parent.parent)) {
159176
+ return parent2.parent.parent;
159177
+ }
159178
+ if (isSpreadAssignment(parent2) && isObjectLiteralExpression(parent2.parent)) {
159179
+ return parent2.parent;
159180
+ }
159181
+ const ancestorNode = findAncestor(parent2, isPropertyAssignment);
159182
+ if (contextToken.kind !== 59 /* ColonToken */ && (ancestorNode == null ? void 0 : ancestorNode.getLastToken(sourceFile)) === contextToken && isObjectLiteralExpression(ancestorNode.parent)) {
159183
+ return ancestorNode.parent;
159184
+ }
159121
159185
  }
159122
159186
  }
159123
159187
  return void 0;
@@ -159571,11 +159635,12 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159571
159635
  return true;
159572
159636
  return !((_a = tryCast(isExternalModuleReference(specifier) ? specifier.expression : specifier, isStringLiteralLike)) == null ? void 0 : _a.text);
159573
159637
  }
159574
- function getVariableOrParameterDeclaration(contextToken) {
159638
+ function getVariableOrParameterDeclaration(contextToken, location) {
159575
159639
  if (!contextToken)
159576
159640
  return;
159577
- const declaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node) || (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
159578
- return declaration;
159641
+ const possiblyParameterDeclaration = findAncestor(contextToken, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : (isParameter(node) || isTypeParameterDeclaration(node)) && !isIndexSignatureDeclaration(node.parent));
159642
+ const possiblyVariableDeclaration = findAncestor(location, (node) => isFunctionBlock(node) || isArrowFunctionBody(node) || isBindingPattern(node) ? "quit" : isVariableDeclaration(node));
159643
+ return possiblyParameterDeclaration || possiblyVariableDeclaration;
159579
159644
  }
159580
159645
  function isArrowFunctionBody(node) {
159581
159646
  return node.parent && isArrowFunction(node.parent) && (node.parent.body === node || // const a = () => /**/;
@@ -159659,6 +159724,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
159659
159724
  CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
159660
159725
  CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
159661
159726
  CompletionSource2["SwitchCases"] = "SwitchCases/";
159727
+ CompletionSource2["ObjectLiteralMemberWithComma"] = "ObjectLiteralMemberWithComma/";
159662
159728
  return CompletionSource2;
159663
159729
  })(CompletionSource || {});
159664
159730
  SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
@@ -184097,6 +184163,7 @@ ${e.message}`;
184097
184163
  isImportTypeNode: () => isImportTypeNode,
184098
184164
  isImportableFile: () => isImportableFile,
184099
184165
  isInComment: () => isInComment,
184166
+ isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
184100
184167
  isInExpressionContext: () => isInExpressionContext,
184101
184168
  isInJSDoc: () => isInJSDoc,
184102
184169
  isInJSFile: () => isInJSFile,
@@ -184389,6 +184456,7 @@ ${e.message}`;
184389
184456
  isSetAccessor: () => isSetAccessor,
184390
184457
  isSetAccessorDeclaration: () => isSetAccessorDeclaration,
184391
184458
  isShebangTrivia: () => isShebangTrivia,
184459
+ isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
184392
184460
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
184393
184461
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
184394
184462
  isSignedNumericLiteral: () => isSignedNumericLiteral,
@@ -186500,6 +186568,7 @@ ${e.message}`;
186500
186568
  isImportTypeNode: () => isImportTypeNode,
186501
186569
  isImportableFile: () => isImportableFile,
186502
186570
  isInComment: () => isInComment,
186571
+ isInCompoundLikeAssignment: () => isInCompoundLikeAssignment,
186503
186572
  isInExpressionContext: () => isInExpressionContext,
186504
186573
  isInJSDoc: () => isInJSDoc,
186505
186574
  isInJSFile: () => isInJSFile,
@@ -186792,6 +186861,7 @@ ${e.message}`;
186792
186861
  isSetAccessor: () => isSetAccessor,
186793
186862
  isSetAccessorDeclaration: () => isSetAccessorDeclaration,
186794
186863
  isShebangTrivia: () => isShebangTrivia,
186864
+ isShiftOperatorOrHigher: () => isShiftOperatorOrHigher,
186795
186865
  isShorthandAmbientModuleSymbol: () => isShorthandAmbientModuleSymbol,
186796
186866
  isShorthandPropertyAssignment: () => isShorthandPropertyAssignment,
186797
186867
  isSignedNumericLiteral: () => isSignedNumericLiteral,
@@ -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;