@typescript-deploys/pr-build 5.2.0-pr-53804-5 → 5.2.0-pr-53356-21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/tsc.js CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.2";
21
- var version = `${versionMajorMinor}.0-insiders.20230613`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230615`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6808,7 +6808,6 @@ var Diagnostics = {
6808
6808
  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}."),
6809
6809
  _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}'."),
6810
6810
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
6811
- 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."),
6812
6811
  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."),
6813
6812
  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."),
6814
6813
  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."),
@@ -47707,19 +47706,18 @@ function createTypeChecker(host) {
47707
47706
  const arity = getTypeReferenceArity(type2);
47708
47707
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
47709
47708
  if (tupleConstituentNodes) {
47710
- if (type2.target.labeledElementDeclarations) {
47711
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
47712
- const flags = type2.target.elementFlags[i];
47709
+ const { labeledElementDeclarations } = type2.target;
47710
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
47711
+ const flags = type2.target.elementFlags[i];
47712
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
47713
+ if (labeledElementDeclaration) {
47713
47714
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
47714
47715
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
47715
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
47716
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
47716
47717
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
47717
47718
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
47718
47719
  );
47719
- }
47720
- } else {
47721
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
47722
- const flags = type2.target.elementFlags[i];
47720
+ } else {
47723
47721
  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];
47724
47722
  }
47725
47723
  }
@@ -52826,17 +52824,18 @@ function createTypeChecker(host) {
52826
52824
  function getExpandedParameters(sig, skipUnionExpanding) {
52827
52825
  if (signatureHasRestParameter(sig)) {
52828
52826
  const restIndex = sig.parameters.length - 1;
52827
+ const restName = sig.parameters[restIndex].escapedName;
52829
52828
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
52830
52829
  if (isTupleType(restType)) {
52831
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
52830
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
52832
52831
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
52833
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
52832
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
52834
52833
  }
52835
52834
  }
52836
52835
  return [sig.parameters];
52837
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
52838
- const elementTypes = getElementTypes(restType);
52839
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
52836
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
52837
+ const elementTypes = getTypeArguments(restType);
52838
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
52840
52839
  const restParams = map(elementTypes, (t, i) => {
52841
52840
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
52842
52841
  const flags = restType.target.elementFlags[i];
@@ -52847,10 +52846,10 @@ function createTypeChecker(host) {
52847
52846
  });
52848
52847
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
52849
52848
  }
52850
- function getUniqAssociatedNamesFromTupleType(type) {
52849
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
52851
52850
  const associatedNamesMap = /* @__PURE__ */ new Map();
52852
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
52853
- const name = getTupleElementLabel(labeledElement);
52851
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
52852
+ const name = getTupleElementLabel(labeledElement, i, restName);
52854
52853
  const prevCounter = associatedNamesMap.get(name);
52855
52854
  if (prevCounter === void 0) {
52856
52855
  associatedNamesMap.set(name, 1);
@@ -55768,13 +55767,10 @@ function createTypeChecker(host) {
55768
55767
  return readonly ? globalReadonlyArrayType : globalArrayType;
55769
55768
  }
55770
55769
  const elementFlags = map(node.elements, getTupleElementFlags);
55771
- const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */);
55772
- return getTupleTargetType(
55773
- elementFlags,
55774
- readonly,
55775
- /*associatedNames*/
55776
- missingName ? void 0 : node.elements
55777
- );
55770
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
55771
+ }
55772
+ function memberIfLabeledElementDeclaration(member) {
55773
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
55778
55774
  }
55779
55775
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
55780
55776
  return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
@@ -55849,7 +55845,7 @@ function createTypeChecker(host) {
55849
55845
  function isReadonlyTypeOperator(node) {
55850
55846
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
55851
55847
  }
55852
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
55848
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
55853
55849
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
55854
55850
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
55855
55851
  }
@@ -55857,7 +55853,8 @@ function createTypeChecker(host) {
55857
55853
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
55858
55854
  return readonly ? globalReadonlyArrayType : globalArrayType;
55859
55855
  }
55860
- const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : "");
55856
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
55857
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
55861
55858
  let type = tupleTypes.get(key);
55862
55859
  if (!type) {
55863
55860
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -55939,7 +55936,7 @@ function createTypeChecker(host) {
55939
55936
  }
55940
55937
  const expandedTypes = [];
55941
55938
  const expandedFlags = [];
55942
- let expandedDeclarations = [];
55939
+ const expandedDeclarations = [];
55943
55940
  let lastRequiredIndex = -1;
55944
55941
  let firstRestIndex = -1;
55945
55942
  let lastOptionalOrRestIndex = -1;
@@ -55977,7 +55974,7 @@ function createTypeChecker(host) {
55977
55974
  ));
55978
55975
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55979
55976
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55980
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55977
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55981
55978
  }
55982
55979
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
55983
55980
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -55997,11 +55994,7 @@ function createTypeChecker(host) {
55997
55994
  true
55998
55995
  ) : type);
55999
55996
  expandedFlags.push(flags);
56000
- if (expandedDeclarations && declaration) {
56001
- expandedDeclarations.push(declaration);
56002
- } else {
56003
- expandedDeclarations = void 0;
56004
- }
55997
+ expandedDeclarations.push(declaration);
56005
55998
  }
56006
55999
  }
56007
56000
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -65774,7 +65767,7 @@ function createTypeChecker(host) {
65774
65767
  location = location.parent;
65775
65768
  }
65776
65769
  if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
65777
- const type = removeOptionalTypeMarker(getTypeOfExpression(location));
65770
+ const type = getTypeOfExpression(location);
65778
65771
  if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
65779
65772
  return type;
65780
65773
  }
@@ -71733,7 +71726,10 @@ function createTypeChecker(host) {
71733
71726
  }
71734
71727
  return type;
71735
71728
  }
71736
- function getTupleElementLabel(d) {
71729
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
71730
+ if (!d) {
71731
+ return `${restParameterName}_${index}`;
71732
+ }
71737
71733
  Debug.assert(isIdentifier(d.name));
71738
71734
  return d.name.escapedText;
71739
71735
  }
@@ -71747,7 +71743,7 @@ function createTypeChecker(host) {
71747
71743
  if (isTupleType(restType)) {
71748
71744
  const associatedNames = restType.target.labeledElementDeclarations;
71749
71745
  const index = pos - paramCount;
71750
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
71746
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
71751
71747
  }
71752
71748
  return restParameter.escapedName;
71753
71749
  }
@@ -75102,12 +75098,7 @@ function createTypeChecker(host) {
75102
75098
  const elementTypes = node.elements;
75103
75099
  let seenOptionalElement = false;
75104
75100
  let seenRestElement = false;
75105
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
75106
75101
  for (const e of elementTypes) {
75107
- if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) {
75108
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
75109
- break;
75110
- }
75111
75102
  const flags = getTupleElementFlags(e);
75112
75103
  if (flags & 8 /* Variadic */) {
75113
75104
  const type = getTypeFromTypeNode(e.type);
package/lib/tsserver.js CHANGED
@@ -2305,7 +2305,7 @@ module.exports = __toCommonJS(server_exports);
2305
2305
 
2306
2306
  // src/compiler/corePublic.ts
2307
2307
  var versionMajorMinor = "5.2";
2308
- var version = `${versionMajorMinor}.0-insiders.20230613`;
2308
+ var version = `${versionMajorMinor}.0-insiders.20230615`;
2309
2309
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2310
2310
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2311
2311
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10306,7 +10306,6 @@ var Diagnostics = {
10306
10306
  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}."),
10307
10307
  _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}'."),
10308
10308
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
10309
- 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."),
10310
10309
  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."),
10311
10310
  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."),
10312
10311
  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."),
@@ -52348,19 +52347,18 @@ function createTypeChecker(host) {
52348
52347
  const arity = getTypeReferenceArity(type2);
52349
52348
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
52350
52349
  if (tupleConstituentNodes) {
52351
- if (type2.target.labeledElementDeclarations) {
52352
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
52353
- const flags = type2.target.elementFlags[i];
52350
+ const { labeledElementDeclarations } = type2.target;
52351
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
52352
+ const flags = type2.target.elementFlags[i];
52353
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
52354
+ if (labeledElementDeclaration) {
52354
52355
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
52355
52356
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
52356
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
52357
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
52357
52358
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
52358
52359
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
52359
52360
  );
52360
- }
52361
- } else {
52362
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
52363
- const flags = type2.target.elementFlags[i];
52361
+ } else {
52364
52362
  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];
52365
52363
  }
52366
52364
  }
@@ -57467,17 +57465,18 @@ function createTypeChecker(host) {
57467
57465
  function getExpandedParameters(sig, skipUnionExpanding) {
57468
57466
  if (signatureHasRestParameter(sig)) {
57469
57467
  const restIndex = sig.parameters.length - 1;
57468
+ const restName = sig.parameters[restIndex].escapedName;
57470
57469
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
57471
57470
  if (isTupleType(restType)) {
57472
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
57471
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
57473
57472
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
57474
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
57473
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
57475
57474
  }
57476
57475
  }
57477
57476
  return [sig.parameters];
57478
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
57479
- const elementTypes = getElementTypes(restType);
57480
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
57477
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
57478
+ const elementTypes = getTypeArguments(restType);
57479
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
57481
57480
  const restParams = map(elementTypes, (t, i) => {
57482
57481
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
57483
57482
  const flags = restType.target.elementFlags[i];
@@ -57488,10 +57487,10 @@ function createTypeChecker(host) {
57488
57487
  });
57489
57488
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
57490
57489
  }
57491
- function getUniqAssociatedNamesFromTupleType(type) {
57490
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
57492
57491
  const associatedNamesMap = /* @__PURE__ */ new Map();
57493
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
57494
- const name = getTupleElementLabel(labeledElement);
57492
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
57493
+ const name = getTupleElementLabel(labeledElement, i, restName);
57495
57494
  const prevCounter = associatedNamesMap.get(name);
57496
57495
  if (prevCounter === void 0) {
57497
57496
  associatedNamesMap.set(name, 1);
@@ -60409,13 +60408,10 @@ function createTypeChecker(host) {
60409
60408
  return readonly ? globalReadonlyArrayType : globalArrayType;
60410
60409
  }
60411
60410
  const elementFlags = map(node.elements, getTupleElementFlags);
60412
- const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */);
60413
- return getTupleTargetType(
60414
- elementFlags,
60415
- readonly,
60416
- /*associatedNames*/
60417
- missingName ? void 0 : node.elements
60418
- );
60411
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
60412
+ }
60413
+ function memberIfLabeledElementDeclaration(member) {
60414
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
60419
60415
  }
60420
60416
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
60421
60417
  return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
@@ -60490,7 +60486,7 @@ function createTypeChecker(host) {
60490
60486
  function isReadonlyTypeOperator(node) {
60491
60487
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
60492
60488
  }
60493
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
60489
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
60494
60490
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
60495
60491
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
60496
60492
  }
@@ -60498,7 +60494,8 @@ function createTypeChecker(host) {
60498
60494
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
60499
60495
  return readonly ? globalReadonlyArrayType : globalArrayType;
60500
60496
  }
60501
- const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : "");
60497
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
60498
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
60502
60499
  let type = tupleTypes.get(key);
60503
60500
  if (!type) {
60504
60501
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -60580,7 +60577,7 @@ function createTypeChecker(host) {
60580
60577
  }
60581
60578
  const expandedTypes = [];
60582
60579
  const expandedFlags = [];
60583
- let expandedDeclarations = [];
60580
+ const expandedDeclarations = [];
60584
60581
  let lastRequiredIndex = -1;
60585
60582
  let firstRestIndex = -1;
60586
60583
  let lastOptionalOrRestIndex = -1;
@@ -60618,7 +60615,7 @@ function createTypeChecker(host) {
60618
60615
  ));
60619
60616
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60620
60617
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60621
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60618
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60622
60619
  }
60623
60620
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
60624
60621
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -60638,11 +60635,7 @@ function createTypeChecker(host) {
60638
60635
  true
60639
60636
  ) : type);
60640
60637
  expandedFlags.push(flags);
60641
- if (expandedDeclarations && declaration) {
60642
- expandedDeclarations.push(declaration);
60643
- } else {
60644
- expandedDeclarations = void 0;
60645
- }
60638
+ expandedDeclarations.push(declaration);
60646
60639
  }
60647
60640
  }
60648
60641
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -70415,7 +70408,7 @@ function createTypeChecker(host) {
70415
70408
  location = location.parent;
70416
70409
  }
70417
70410
  if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
70418
- const type = removeOptionalTypeMarker(getTypeOfExpression(location));
70411
+ const type = getTypeOfExpression(location);
70419
70412
  if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
70420
70413
  return type;
70421
70414
  }
@@ -76374,7 +76367,10 @@ function createTypeChecker(host) {
76374
76367
  }
76375
76368
  return type;
76376
76369
  }
76377
- function getTupleElementLabel(d) {
76370
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
76371
+ if (!d) {
76372
+ return `${restParameterName}_${index}`;
76373
+ }
76378
76374
  Debug.assert(isIdentifier(d.name));
76379
76375
  return d.name.escapedText;
76380
76376
  }
@@ -76388,7 +76384,7 @@ function createTypeChecker(host) {
76388
76384
  if (isTupleType(restType)) {
76389
76385
  const associatedNames = restType.target.labeledElementDeclarations;
76390
76386
  const index = pos - paramCount;
76391
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
76387
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
76392
76388
  }
76393
76389
  return restParameter.escapedName;
76394
76390
  }
@@ -79743,12 +79739,7 @@ function createTypeChecker(host) {
79743
79739
  const elementTypes = node.elements;
79744
79740
  let seenOptionalElement = false;
79745
79741
  let seenRestElement = false;
79746
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
79747
79742
  for (const e of elementTypes) {
79748
- if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) {
79749
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
79750
- break;
79751
- }
79752
79743
  const flags = getTupleElementFlags(e);
79753
79744
  if (flags & 8 /* Variadic */) {
79754
79745
  const type = getTypeFromTypeNode(e.type);
@@ -6948,7 +6948,7 @@ declare namespace ts {
6948
6948
  hasRestElement: boolean;
6949
6949
  combinedFlags: ElementFlags;
6950
6950
  readonly: boolean;
6951
- labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
6951
+ labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
6952
6952
  }
6953
6953
  interface TupleTypeReference extends TypeReference {
6954
6954
  target: TupleType;
@@ -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.20230613`;
38
+ version = `${versionMajorMinor}.0-insiders.20230615`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8111,7 +8111,6 @@ ${lanes.join("\n")}
8111
8111
  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}."),
8112
8112
  _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}'."),
8113
8113
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
8114
- 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."),
8115
8114
  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."),
8116
8115
  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."),
8117
8116
  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."),
@@ -50137,19 +50136,18 @@ ${lanes.join("\n")}
50137
50136
  const arity = getTypeReferenceArity(type2);
50138
50137
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50139
50138
  if (tupleConstituentNodes) {
50140
- if (type2.target.labeledElementDeclarations) {
50141
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
50142
- const flags = type2.target.elementFlags[i];
50139
+ const { labeledElementDeclarations } = type2.target;
50140
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50141
+ const flags = type2.target.elementFlags[i];
50142
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50143
+ if (labeledElementDeclaration) {
50143
50144
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50144
50145
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50145
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50146
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50146
50147
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50147
50148
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50148
50149
  );
50149
- }
50150
- } else {
50151
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50152
- const flags = type2.target.elementFlags[i];
50150
+ } else {
50153
50151
  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];
50154
50152
  }
50155
50153
  }
@@ -55256,17 +55254,18 @@ ${lanes.join("\n")}
55256
55254
  function getExpandedParameters(sig, skipUnionExpanding) {
55257
55255
  if (signatureHasRestParameter(sig)) {
55258
55256
  const restIndex = sig.parameters.length - 1;
55257
+ const restName = sig.parameters[restIndex].escapedName;
55259
55258
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55260
55259
  if (isTupleType(restType)) {
55261
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55260
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55262
55261
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55263
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55262
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55264
55263
  }
55265
55264
  }
55266
55265
  return [sig.parameters];
55267
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55268
- const elementTypes = getElementTypes(restType);
55269
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55266
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55267
+ const elementTypes = getTypeArguments(restType);
55268
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55270
55269
  const restParams = map(elementTypes, (t, i) => {
55271
55270
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55272
55271
  const flags = restType.target.elementFlags[i];
@@ -55277,10 +55276,10 @@ ${lanes.join("\n")}
55277
55276
  });
55278
55277
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55279
55278
  }
55280
- function getUniqAssociatedNamesFromTupleType(type) {
55279
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
55281
55280
  const associatedNamesMap = /* @__PURE__ */ new Map();
55282
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
55283
- const name = getTupleElementLabel(labeledElement);
55281
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55282
+ const name = getTupleElementLabel(labeledElement, i, restName);
55284
55283
  const prevCounter = associatedNamesMap.get(name);
55285
55284
  if (prevCounter === void 0) {
55286
55285
  associatedNamesMap.set(name, 1);
@@ -58198,13 +58197,10 @@ ${lanes.join("\n")}
58198
58197
  return readonly ? globalReadonlyArrayType : globalArrayType;
58199
58198
  }
58200
58199
  const elementFlags = map(node.elements, getTupleElementFlags);
58201
- const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */);
58202
- return getTupleTargetType(
58203
- elementFlags,
58204
- readonly,
58205
- /*associatedNames*/
58206
- missingName ? void 0 : node.elements
58207
- );
58200
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58201
+ }
58202
+ function memberIfLabeledElementDeclaration(member) {
58203
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
58208
58204
  }
58209
58205
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58210
58206
  return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
@@ -58279,7 +58275,7 @@ ${lanes.join("\n")}
58279
58275
  function isReadonlyTypeOperator(node) {
58280
58276
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58281
58277
  }
58282
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58278
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58283
58279
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58284
58280
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58285
58281
  }
@@ -58287,7 +58283,8 @@ ${lanes.join("\n")}
58287
58283
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58288
58284
  return readonly ? globalReadonlyArrayType : globalArrayType;
58289
58285
  }
58290
- const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : "");
58286
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
58287
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
58291
58288
  let type = tupleTypes.get(key);
58292
58289
  if (!type) {
58293
58290
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58369,7 +58366,7 @@ ${lanes.join("\n")}
58369
58366
  }
58370
58367
  const expandedTypes = [];
58371
58368
  const expandedFlags = [];
58372
- let expandedDeclarations = [];
58369
+ const expandedDeclarations = [];
58373
58370
  let lastRequiredIndex = -1;
58374
58371
  let firstRestIndex = -1;
58375
58372
  let lastOptionalOrRestIndex = -1;
@@ -58407,7 +58404,7 @@ ${lanes.join("\n")}
58407
58404
  ));
58408
58405
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58409
58406
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58410
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58407
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58411
58408
  }
58412
58409
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58413
58410
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58427,11 +58424,7 @@ ${lanes.join("\n")}
58427
58424
  true
58428
58425
  ) : type);
58429
58426
  expandedFlags.push(flags);
58430
- if (expandedDeclarations && declaration) {
58431
- expandedDeclarations.push(declaration);
58432
- } else {
58433
- expandedDeclarations = void 0;
58434
- }
58427
+ expandedDeclarations.push(declaration);
58435
58428
  }
58436
58429
  }
58437
58430
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -68204,7 +68197,7 @@ ${lanes.join("\n")}
68204
68197
  location = location.parent;
68205
68198
  }
68206
68199
  if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
68207
- const type = removeOptionalTypeMarker(getTypeOfExpression(location));
68200
+ const type = getTypeOfExpression(location);
68208
68201
  if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
68209
68202
  return type;
68210
68203
  }
@@ -74163,7 +74156,10 @@ ${lanes.join("\n")}
74163
74156
  }
74164
74157
  return type;
74165
74158
  }
74166
- function getTupleElementLabel(d) {
74159
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
74160
+ if (!d) {
74161
+ return `${restParameterName}_${index}`;
74162
+ }
74167
74163
  Debug.assert(isIdentifier(d.name));
74168
74164
  return d.name.escapedText;
74169
74165
  }
@@ -74177,7 +74173,7 @@ ${lanes.join("\n")}
74177
74173
  if (isTupleType(restType)) {
74178
74174
  const associatedNames = restType.target.labeledElementDeclarations;
74179
74175
  const index = pos - paramCount;
74180
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74176
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74181
74177
  }
74182
74178
  return restParameter.escapedName;
74183
74179
  }
@@ -77532,12 +77528,7 @@ ${lanes.join("\n")}
77532
77528
  const elementTypes = node.elements;
77533
77529
  let seenOptionalElement = false;
77534
77530
  let seenRestElement = false;
77535
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
77536
77531
  for (const e of elementTypes) {
77537
- if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) {
77538
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
77539
- break;
77540
- }
77541
77532
  const flags = getTupleElementFlags(e);
77542
77533
  if (flags & 8 /* Variadic */) {
77543
77534
  const type = getTypeFromTypeNode(e.type);
@@ -2895,7 +2895,7 @@ declare namespace ts {
2895
2895
  hasRestElement: boolean;
2896
2896
  combinedFlags: ElementFlags;
2897
2897
  readonly: boolean;
2898
- labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
2898
+ labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
2899
2899
  }
2900
2900
  interface TupleTypeReference extends TypeReference {
2901
2901
  target: TupleType;
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.20230613`;
38
+ version = `${versionMajorMinor}.0-insiders.20230615`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8111,7 +8111,6 @@ ${lanes.join("\n")}
8111
8111
  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}."),
8112
8112
  _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}'."),
8113
8113
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
8114
- 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."),
8115
8114
  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."),
8116
8115
  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."),
8117
8116
  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."),
@@ -50137,19 +50136,18 @@ ${lanes.join("\n")}
50137
50136
  const arity = getTypeReferenceArity(type2);
50138
50137
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50139
50138
  if (tupleConstituentNodes) {
50140
- if (type2.target.labeledElementDeclarations) {
50141
- for (let i = 0; i < tupleConstituentNodes.length; i++) {
50142
- const flags = type2.target.elementFlags[i];
50139
+ const { labeledElementDeclarations } = type2.target;
50140
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50141
+ const flags = type2.target.elementFlags[i];
50142
+ const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50143
+ if (labeledElementDeclaration) {
50143
50144
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50144
50145
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50145
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50146
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50146
50147
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50147
50148
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50148
50149
  );
50149
- }
50150
- } else {
50151
- for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50152
- const flags = type2.target.elementFlags[i];
50150
+ } else {
50153
50151
  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];
50154
50152
  }
50155
50153
  }
@@ -55256,17 +55254,18 @@ ${lanes.join("\n")}
55256
55254
  function getExpandedParameters(sig, skipUnionExpanding) {
55257
55255
  if (signatureHasRestParameter(sig)) {
55258
55256
  const restIndex = sig.parameters.length - 1;
55257
+ const restName = sig.parameters[restIndex].escapedName;
55259
55258
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55260
55259
  if (isTupleType(restType)) {
55261
- return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55260
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55262
55261
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55263
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55262
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55264
55263
  }
55265
55264
  }
55266
55265
  return [sig.parameters];
55267
- function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55268
- const elementTypes = getElementTypes(restType);
55269
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55266
+ function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55267
+ const elementTypes = getTypeArguments(restType);
55268
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55270
55269
  const restParams = map(elementTypes, (t, i) => {
55271
55270
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55272
55271
  const flags = restType.target.elementFlags[i];
@@ -55277,10 +55276,10 @@ ${lanes.join("\n")}
55277
55276
  });
55278
55277
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55279
55278
  }
55280
- function getUniqAssociatedNamesFromTupleType(type) {
55279
+ function getUniqAssociatedNamesFromTupleType(type, restName) {
55281
55280
  const associatedNamesMap = /* @__PURE__ */ new Map();
55282
- return map(type.target.labeledElementDeclarations, (labeledElement) => {
55283
- const name = getTupleElementLabel(labeledElement);
55281
+ return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55282
+ const name = getTupleElementLabel(labeledElement, i, restName);
55284
55283
  const prevCounter = associatedNamesMap.get(name);
55285
55284
  if (prevCounter === void 0) {
55286
55285
  associatedNamesMap.set(name, 1);
@@ -58198,13 +58197,10 @@ ${lanes.join("\n")}
58198
58197
  return readonly ? globalReadonlyArrayType : globalArrayType;
58199
58198
  }
58200
58199
  const elementFlags = map(node.elements, getTupleElementFlags);
58201
- const missingName = some(node.elements, (e) => e.kind !== 201 /* NamedTupleMember */);
58202
- return getTupleTargetType(
58203
- elementFlags,
58204
- readonly,
58205
- /*associatedNames*/
58206
- missingName ? void 0 : node.elements
58207
- );
58200
+ return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58201
+ }
58202
+ function memberIfLabeledElementDeclaration(member) {
58203
+ return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
58208
58204
  }
58209
58205
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58210
58206
  return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 187 /* ArrayType */ ? mayResolveTypeAlias(node.elementType) : node.kind === 188 /* TupleType */ ? some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || some(node.typeArguments, mayResolveTypeAlias));
@@ -58279,7 +58275,7 @@ ${lanes.join("\n")}
58279
58275
  function isReadonlyTypeOperator(node) {
58280
58276
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58281
58277
  }
58282
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58278
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58283
58279
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58284
58280
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58285
58281
  }
@@ -58287,7 +58283,8 @@ ${lanes.join("\n")}
58287
58283
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58288
58284
  return readonly ? globalReadonlyArrayType : globalArrayType;
58289
58285
  }
58290
- const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (namedMemberDeclarations && namedMemberDeclarations.length ? "," + map(namedMemberDeclarations, getNodeId).join(",") : "");
58286
+ const memberIds = mapDefined(namedMemberDeclarations, (node) => node ? getNodeId(node) : void 0);
58287
+ const key = map(elementFlags, (f) => f & 1 /* Required */ ? "#" : f & 2 /* Optional */ ? "?" : f & 4 /* Rest */ ? "." : "*").join() + (readonly ? "R" : "") + (memberIds.length ? "," + memberIds.join(",") : "");
58291
58288
  let type = tupleTypes.get(key);
58292
58289
  if (!type) {
58293
58290
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58369,7 +58366,7 @@ ${lanes.join("\n")}
58369
58366
  }
58370
58367
  const expandedTypes = [];
58371
58368
  const expandedFlags = [];
58372
- let expandedDeclarations = [];
58369
+ const expandedDeclarations = [];
58373
58370
  let lastRequiredIndex = -1;
58374
58371
  let firstRestIndex = -1;
58375
58372
  let lastOptionalOrRestIndex = -1;
@@ -58407,7 +58404,7 @@ ${lanes.join("\n")}
58407
58404
  ));
58408
58405
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58409
58406
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58410
- expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58407
+ expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58411
58408
  }
58412
58409
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58413
58410
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58427,11 +58424,7 @@ ${lanes.join("\n")}
58427
58424
  true
58428
58425
  ) : type);
58429
58426
  expandedFlags.push(flags);
58430
- if (expandedDeclarations && declaration) {
58431
- expandedDeclarations.push(declaration);
58432
- } else {
58433
- expandedDeclarations = void 0;
58434
- }
58427
+ expandedDeclarations.push(declaration);
58435
58428
  }
58436
58429
  }
58437
58430
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -68204,7 +68197,7 @@ ${lanes.join("\n")}
68204
68197
  location = location.parent;
68205
68198
  }
68206
68199
  if (isExpressionNode(location) && (!isAssignmentTarget(location) || isWriteAccess(location))) {
68207
- const type = removeOptionalTypeMarker(getTypeOfExpression(location));
68200
+ const type = getTypeOfExpression(location);
68208
68201
  if (getExportSymbolOfValueSymbolIfExported(getNodeLinks(location).resolvedSymbol) === symbol) {
68209
68202
  return type;
68210
68203
  }
@@ -74163,7 +74156,10 @@ ${lanes.join("\n")}
74163
74156
  }
74164
74157
  return type;
74165
74158
  }
74166
- function getTupleElementLabel(d) {
74159
+ function getTupleElementLabel(d, index, restParameterName = "arg") {
74160
+ if (!d) {
74161
+ return `${restParameterName}_${index}`;
74162
+ }
74167
74163
  Debug.assert(isIdentifier(d.name));
74168
74164
  return d.name.escapedText;
74169
74165
  }
@@ -74177,7 +74173,7 @@ ${lanes.join("\n")}
74177
74173
  if (isTupleType(restType)) {
74178
74174
  const associatedNames = restType.target.labeledElementDeclarations;
74179
74175
  const index = pos - paramCount;
74180
- return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74176
+ return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74181
74177
  }
74182
74178
  return restParameter.escapedName;
74183
74179
  }
@@ -77532,12 +77528,7 @@ ${lanes.join("\n")}
77532
77528
  const elementTypes = node.elements;
77533
77529
  let seenOptionalElement = false;
77534
77530
  let seenRestElement = false;
77535
- const hasNamedElement = some(elementTypes, isNamedTupleMember);
77536
77531
  for (const e of elementTypes) {
77537
- if (e.kind !== 201 /* NamedTupleMember */ && hasNamedElement) {
77538
- grammarErrorOnNode(e, Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names);
77539
- break;
77540
- }
77541
77532
  const flags = getTupleElementFlags(e);
77542
77533
  if (flags & 8 /* Variadic */) {
77543
77534
  const type = getTypeFromTypeNode(e.type);
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
54
54
 
55
55
  // src/compiler/corePublic.ts
56
56
  var versionMajorMinor = "5.2";
57
- var version = `${versionMajorMinor}.0-insiders.20230613`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230615`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6182,7 +6182,6 @@ var Diagnostics = {
6182
6182
  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}."),
6183
6183
  _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}'."),
6184
6184
  Cannot_read_file_0: diag(5083, 1 /* Error */, "Cannot_read_file_0_5083", "Cannot read file '{0}'."),
6185
- 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."),
6186
6185
  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."),
6187
6186
  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."),
6188
6187
  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."),
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@typescript-deploys/pr-build",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.2.0-pr-53804-5",
5
+ "version": "5.2.0-pr-53356-21",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -115,5 +115,5 @@
115
115
  "node": "20.1.0",
116
116
  "npm": "8.19.4"
117
117
  },
118
- "gitHead": "ce97e292eee1cc68a0a3c9c92472259247e48a1f"
118
+ "gitHead": "0003af0701202d3feb29063d5e5073970dca9f6d"
119
119
  }