@typescript-deploys/pr-build 5.2.0-pr-53356-21 → 5.2.0-pr-54647-2

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.20230615`;
21
+ var version = `${versionMajorMinor}.0-insiders.20230616`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -6808,6 +6808,7 @@ 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."),
6811
6812
  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."),
6812
6813
  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."),
6813
6814
  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."),
@@ -7698,7 +7699,7 @@ var Diagnostics = {
7698
7699
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
7699
7700
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
7700
7701
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
7701
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
7702
+ Can_only_convert_string_concatenation_or_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_or_string_literals_95154", "Can only convert string concatenation or string literals"),
7702
7703
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
7703
7704
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
7704
7705
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -47706,18 +47707,19 @@ function createTypeChecker(host) {
47706
47707
  const arity = getTypeReferenceArity(type2);
47707
47708
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
47708
47709
  if (tupleConstituentNodes) {
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) {
47710
+ if (type2.target.labeledElementDeclarations) {
47711
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
47712
+ const flags = type2.target.elementFlags[i];
47714
47713
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
47715
47714
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
47716
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
47715
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
47717
47716
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
47718
47717
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
47719
47718
  );
47720
- } else {
47719
+ }
47720
+ } else {
47721
+ for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
47722
+ const flags = type2.target.elementFlags[i];
47721
47723
  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];
47722
47724
  }
47723
47725
  }
@@ -52824,18 +52826,17 @@ function createTypeChecker(host) {
52824
52826
  function getExpandedParameters(sig, skipUnionExpanding) {
52825
52827
  if (signatureHasRestParameter(sig)) {
52826
52828
  const restIndex = sig.parameters.length - 1;
52827
- const restName = sig.parameters[restIndex].escapedName;
52828
52829
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
52829
52830
  if (isTupleType(restType)) {
52830
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
52831
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
52831
52832
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
52832
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
52833
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
52833
52834
  }
52834
52835
  }
52835
52836
  return [sig.parameters];
52836
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
52837
- const elementTypes = getTypeArguments(restType);
52838
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
52837
+ function expandSignatureParametersWithTupleMembers(restType, restIndex) {
52838
+ const elementTypes = getElementTypes(restType);
52839
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
52839
52840
  const restParams = map(elementTypes, (t, i) => {
52840
52841
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
52841
52842
  const flags = restType.target.elementFlags[i];
@@ -52846,10 +52847,10 @@ function createTypeChecker(host) {
52846
52847
  });
52847
52848
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
52848
52849
  }
52849
- function getUniqAssociatedNamesFromTupleType(type, restName) {
52850
+ function getUniqAssociatedNamesFromTupleType(type) {
52850
52851
  const associatedNamesMap = /* @__PURE__ */ new Map();
52851
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
52852
- const name = getTupleElementLabel(labeledElement, i, restName);
52852
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
52853
+ const name = getTupleElementLabel(labeledElement);
52853
52854
  const prevCounter = associatedNamesMap.get(name);
52854
52855
  if (prevCounter === void 0) {
52855
52856
  associatedNamesMap.set(name, 1);
@@ -53648,9 +53649,9 @@ function createTypeChecker(host) {
53648
53649
  function getConstraintOfTypeParameter(typeParameter) {
53649
53650
  return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
53650
53651
  }
53651
- function isConstTypeVariable(type) {
53652
+ function isConstTypeVariable(type, depth = 0) {
53652
53653
  var _a;
53653
- return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0));
53654
+ return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
53654
53655
  }
53655
53656
  function getConstraintOfIndexedAccess(type) {
53656
53657
  return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
@@ -55767,10 +55768,13 @@ function createTypeChecker(host) {
55767
55768
  return readonly ? globalReadonlyArrayType : globalArrayType;
55768
55769
  }
55769
55770
  const elementFlags = map(node.elements, getTupleElementFlags);
55770
- return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
55771
- }
55772
- function memberIfLabeledElementDeclaration(member) {
55773
- return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
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
+ );
55774
55778
  }
55775
55779
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
55776
55780
  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));
@@ -55845,7 +55849,7 @@ function createTypeChecker(host) {
55845
55849
  function isReadonlyTypeOperator(node) {
55846
55850
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
55847
55851
  }
55848
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
55852
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
55849
55853
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
55850
55854
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
55851
55855
  }
@@ -55853,8 +55857,7 @@ function createTypeChecker(host) {
55853
55857
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
55854
55858
  return readonly ? globalReadonlyArrayType : globalArrayType;
55855
55859
  }
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(",") : "");
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(",") : "");
55858
55861
  let type = tupleTypes.get(key);
55859
55862
  if (!type) {
55860
55863
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -55936,7 +55939,7 @@ function createTypeChecker(host) {
55936
55939
  }
55937
55940
  const expandedTypes = [];
55938
55941
  const expandedFlags = [];
55939
- const expandedDeclarations = [];
55942
+ let expandedDeclarations = [];
55940
55943
  let lastRequiredIndex = -1;
55941
55944
  let firstRestIndex = -1;
55942
55945
  let lastOptionalOrRestIndex = -1;
@@ -55974,7 +55977,7 @@ function createTypeChecker(host) {
55974
55977
  ));
55975
55978
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55976
55979
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55977
- expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55980
+ expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
55978
55981
  }
55979
55982
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
55980
55983
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -55994,7 +55997,11 @@ function createTypeChecker(host) {
55994
55997
  true
55995
55998
  ) : type);
55996
55999
  expandedFlags.push(flags);
55997
- expandedDeclarations.push(declaration);
56000
+ if (expandedDeclarations && declaration) {
56001
+ expandedDeclarations.push(declaration);
56002
+ } else {
56003
+ expandedDeclarations = void 0;
56004
+ }
55998
56005
  }
55999
56006
  }
56000
56007
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -71726,10 +71733,7 @@ function createTypeChecker(host) {
71726
71733
  }
71727
71734
  return type;
71728
71735
  }
71729
- function getTupleElementLabel(d, index, restParameterName = "arg") {
71730
- if (!d) {
71731
- return `${restParameterName}_${index}`;
71732
- }
71736
+ function getTupleElementLabel(d) {
71733
71737
  Debug.assert(isIdentifier(d.name));
71734
71738
  return d.name.escapedText;
71735
71739
  }
@@ -71743,7 +71747,7 @@ function createTypeChecker(host) {
71743
71747
  if (isTupleType(restType)) {
71744
71748
  const associatedNames = restType.target.labeledElementDeclarations;
71745
71749
  const index = pos - paramCount;
71746
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
71750
+ return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
71747
71751
  }
71748
71752
  return restParameter.escapedName;
71749
71753
  }
@@ -75098,7 +75102,12 @@ function createTypeChecker(host) {
75098
75102
  const elementTypes = node.elements;
75099
75103
  let seenOptionalElement = false;
75100
75104
  let seenRestElement = false;
75105
+ const hasNamedElement = some(elementTypes, isNamedTupleMember);
75101
75106
  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
+ }
75102
75111
  const flags = getTupleElementFlags(e);
75103
75112
  if (flags & 8 /* Variadic */) {
75104
75113
  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.20230615`;
2308
+ var version = `${versionMajorMinor}.0-insiders.20230616`;
2309
2309
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2310
2310
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2311
2311
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10306,6 +10306,7 @@ 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."),
10309
10310
  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."),
10310
10311
  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."),
10311
10312
  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."),
@@ -11196,7 +11197,7 @@ var Diagnostics = {
11196
11197
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
11197
11198
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
11198
11199
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
11199
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
11200
+ Can_only_convert_string_concatenation_or_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_or_string_literals_95154", "Can only convert string concatenation or string literals"),
11200
11201
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
11201
11202
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
11202
11203
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -52347,18 +52348,19 @@ function createTypeChecker(host) {
52347
52348
  const arity = getTypeReferenceArity(type2);
52348
52349
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
52349
52350
  if (tupleConstituentNodes) {
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) {
52351
+ if (type2.target.labeledElementDeclarations) {
52352
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
52353
+ const flags = type2.target.elementFlags[i];
52355
52354
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
52356
52355
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
52357
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
52356
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
52358
52357
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
52359
52358
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
52360
52359
  );
52361
- } else {
52360
+ }
52361
+ } else {
52362
+ for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
52363
+ const flags = type2.target.elementFlags[i];
52362
52364
  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];
52363
52365
  }
52364
52366
  }
@@ -57465,18 +57467,17 @@ function createTypeChecker(host) {
57465
57467
  function getExpandedParameters(sig, skipUnionExpanding) {
57466
57468
  if (signatureHasRestParameter(sig)) {
57467
57469
  const restIndex = sig.parameters.length - 1;
57468
- const restName = sig.parameters[restIndex].escapedName;
57469
57470
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
57470
57471
  if (isTupleType(restType)) {
57471
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
57472
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
57472
57473
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
57473
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
57474
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
57474
57475
  }
57475
57476
  }
57476
57477
  return [sig.parameters];
57477
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
57478
- const elementTypes = getTypeArguments(restType);
57479
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
57478
+ function expandSignatureParametersWithTupleMembers(restType, restIndex) {
57479
+ const elementTypes = getElementTypes(restType);
57480
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
57480
57481
  const restParams = map(elementTypes, (t, i) => {
57481
57482
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
57482
57483
  const flags = restType.target.elementFlags[i];
@@ -57487,10 +57488,10 @@ function createTypeChecker(host) {
57487
57488
  });
57488
57489
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
57489
57490
  }
57490
- function getUniqAssociatedNamesFromTupleType(type, restName) {
57491
+ function getUniqAssociatedNamesFromTupleType(type) {
57491
57492
  const associatedNamesMap = /* @__PURE__ */ new Map();
57492
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
57493
- const name = getTupleElementLabel(labeledElement, i, restName);
57493
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
57494
+ const name = getTupleElementLabel(labeledElement);
57494
57495
  const prevCounter = associatedNamesMap.get(name);
57495
57496
  if (prevCounter === void 0) {
57496
57497
  associatedNamesMap.set(name, 1);
@@ -58289,9 +58290,9 @@ function createTypeChecker(host) {
58289
58290
  function getConstraintOfTypeParameter(typeParameter) {
58290
58291
  return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
58291
58292
  }
58292
- function isConstTypeVariable(type) {
58293
+ function isConstTypeVariable(type, depth = 0) {
58293
58294
  var _a;
58294
- return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0));
58295
+ return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
58295
58296
  }
58296
58297
  function getConstraintOfIndexedAccess(type) {
58297
58298
  return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
@@ -60408,10 +60409,13 @@ function createTypeChecker(host) {
60408
60409
  return readonly ? globalReadonlyArrayType : globalArrayType;
60409
60410
  }
60410
60411
  const elementFlags = map(node.elements, getTupleElementFlags);
60411
- return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
60412
- }
60413
- function memberIfLabeledElementDeclaration(member) {
60414
- return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
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
+ );
60415
60419
  }
60416
60420
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
60417
60421
  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));
@@ -60486,7 +60490,7 @@ function createTypeChecker(host) {
60486
60490
  function isReadonlyTypeOperator(node) {
60487
60491
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
60488
60492
  }
60489
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
60493
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
60490
60494
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
60491
60495
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
60492
60496
  }
@@ -60494,8 +60498,7 @@ function createTypeChecker(host) {
60494
60498
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
60495
60499
  return readonly ? globalReadonlyArrayType : globalArrayType;
60496
60500
  }
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(",") : "");
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(",") : "");
60499
60502
  let type = tupleTypes.get(key);
60500
60503
  if (!type) {
60501
60504
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -60577,7 +60580,7 @@ function createTypeChecker(host) {
60577
60580
  }
60578
60581
  const expandedTypes = [];
60579
60582
  const expandedFlags = [];
60580
- const expandedDeclarations = [];
60583
+ let expandedDeclarations = [];
60581
60584
  let lastRequiredIndex = -1;
60582
60585
  let firstRestIndex = -1;
60583
60586
  let lastOptionalOrRestIndex = -1;
@@ -60615,7 +60618,7 @@ function createTypeChecker(host) {
60615
60618
  ));
60616
60619
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60617
60620
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60618
- expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60621
+ expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
60619
60622
  }
60620
60623
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
60621
60624
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -60635,7 +60638,11 @@ function createTypeChecker(host) {
60635
60638
  true
60636
60639
  ) : type);
60637
60640
  expandedFlags.push(flags);
60638
- expandedDeclarations.push(declaration);
60641
+ if (expandedDeclarations && declaration) {
60642
+ expandedDeclarations.push(declaration);
60643
+ } else {
60644
+ expandedDeclarations = void 0;
60645
+ }
60639
60646
  }
60640
60647
  }
60641
60648
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -76367,10 +76374,7 @@ function createTypeChecker(host) {
76367
76374
  }
76368
76375
  return type;
76369
76376
  }
76370
- function getTupleElementLabel(d, index, restParameterName = "arg") {
76371
- if (!d) {
76372
- return `${restParameterName}_${index}`;
76373
- }
76377
+ function getTupleElementLabel(d) {
76374
76378
  Debug.assert(isIdentifier(d.name));
76375
76379
  return d.name.escapedText;
76376
76380
  }
@@ -76384,7 +76388,7 @@ function createTypeChecker(host) {
76384
76388
  if (isTupleType(restType)) {
76385
76389
  const associatedNames = restType.target.labeledElementDeclarations;
76386
76390
  const index = pos - paramCount;
76387
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
76391
+ return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
76388
76392
  }
76389
76393
  return restParameter.escapedName;
76390
76394
  }
@@ -79739,7 +79743,12 @@ function createTypeChecker(host) {
79739
79743
  const elementTypes = node.elements;
79740
79744
  let seenOptionalElement = false;
79741
79745
  let seenRestElement = false;
79746
+ const hasNamedElement = some(elementTypes, isNamedTupleMember);
79742
79747
  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
+ }
79743
79752
  const flags = getTupleElementFlags(e);
79744
79753
  if (flags & 8 /* Variadic */) {
79745
79754
  const type = getTypeFromTypeNode(e.type);
@@ -138728,14 +138737,18 @@ function getRefactorActionsToConvertToTemplateString(context) {
138728
138737
  const { file, startPosition } = context;
138729
138738
  const node = getNodeOrParentOfParentheses(file, startPosition);
138730
138739
  const maybeBinary = getParentBinaryExpression(node);
138740
+ const nodeIsStringLiteral = isStringLiteral(maybeBinary);
138731
138741
  const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
138732
- if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
138742
+ if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
138743
+ return emptyArray;
138744
+ }
138745
+ if (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
138733
138746
  refactorInfo.actions.push(convertStringAction);
138734
138747
  return [refactorInfo];
138735
138748
  } else if (context.preferences.provideRefactorNotApplicableReason) {
138736
138749
  refactorInfo.actions.push({
138737
138750
  ...convertStringAction,
138738
- notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation)
138751
+ notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation_or_string_literals)
138739
138752
  });
138740
138753
  return [refactorInfo];
138741
138754
  }
@@ -6948,7 +6948,7 @@ declare namespace ts {
6948
6948
  hasRestElement: boolean;
6949
6949
  combinedFlags: ElementFlags;
6950
6950
  readonly: boolean;
6951
- labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
6951
+ labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
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.20230615`;
38
+ version = `${versionMajorMinor}.0-insiders.20230616`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8111,6 +8111,7 @@ ${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."),
8114
8115
  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."),
8115
8116
  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."),
8116
8117
  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."),
@@ -9001,7 +9002,7 @@ ${lanes.join("\n")}
9001
9002
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
9002
9003
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
9003
9004
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
9004
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
9005
+ Can_only_convert_string_concatenation_or_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_or_string_literals_95154", "Can only convert string concatenation or string literals"),
9005
9006
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
9006
9007
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
9007
9008
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -50136,18 +50137,19 @@ ${lanes.join("\n")}
50136
50137
  const arity = getTypeReferenceArity(type2);
50137
50138
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50138
50139
  if (tupleConstituentNodes) {
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) {
50140
+ if (type2.target.labeledElementDeclarations) {
50141
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50142
+ const flags = type2.target.elementFlags[i];
50144
50143
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50145
50144
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50146
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50145
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50147
50146
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50148
50147
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50149
50148
  );
50150
- } else {
50149
+ }
50150
+ } else {
50151
+ for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50152
+ const flags = type2.target.elementFlags[i];
50151
50153
  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];
50152
50154
  }
50153
50155
  }
@@ -55254,18 +55256,17 @@ ${lanes.join("\n")}
55254
55256
  function getExpandedParameters(sig, skipUnionExpanding) {
55255
55257
  if (signatureHasRestParameter(sig)) {
55256
55258
  const restIndex = sig.parameters.length - 1;
55257
- const restName = sig.parameters[restIndex].escapedName;
55258
55259
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55259
55260
  if (isTupleType(restType)) {
55260
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55261
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55261
55262
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55262
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55263
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55263
55264
  }
55264
55265
  }
55265
55266
  return [sig.parameters];
55266
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55267
- const elementTypes = getTypeArguments(restType);
55268
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55267
+ function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55268
+ const elementTypes = getElementTypes(restType);
55269
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55269
55270
  const restParams = map(elementTypes, (t, i) => {
55270
55271
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55271
55272
  const flags = restType.target.elementFlags[i];
@@ -55276,10 +55277,10 @@ ${lanes.join("\n")}
55276
55277
  });
55277
55278
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55278
55279
  }
55279
- function getUniqAssociatedNamesFromTupleType(type, restName) {
55280
+ function getUniqAssociatedNamesFromTupleType(type) {
55280
55281
  const associatedNamesMap = /* @__PURE__ */ new Map();
55281
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55282
- const name = getTupleElementLabel(labeledElement, i, restName);
55282
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55283
+ const name = getTupleElementLabel(labeledElement);
55283
55284
  const prevCounter = associatedNamesMap.get(name);
55284
55285
  if (prevCounter === void 0) {
55285
55286
  associatedNamesMap.set(name, 1);
@@ -56078,9 +56079,9 @@ ${lanes.join("\n")}
56078
56079
  function getConstraintOfTypeParameter(typeParameter) {
56079
56080
  return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
56080
56081
  }
56081
- function isConstTypeVariable(type) {
56082
+ function isConstTypeVariable(type, depth = 0) {
56082
56083
  var _a;
56083
- return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0));
56084
+ return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
56084
56085
  }
56085
56086
  function getConstraintOfIndexedAccess(type) {
56086
56087
  return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
@@ -58197,10 +58198,13 @@ ${lanes.join("\n")}
58197
58198
  return readonly ? globalReadonlyArrayType : globalArrayType;
58198
58199
  }
58199
58200
  const elementFlags = map(node.elements, getTupleElementFlags);
58200
- return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58201
- }
58202
- function memberIfLabeledElementDeclaration(member) {
58203
- return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
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
+ );
58204
58208
  }
58205
58209
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58206
58210
  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));
@@ -58275,7 +58279,7 @@ ${lanes.join("\n")}
58275
58279
  function isReadonlyTypeOperator(node) {
58276
58280
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58277
58281
  }
58278
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58282
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58279
58283
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58280
58284
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58281
58285
  }
@@ -58283,8 +58287,7 @@ ${lanes.join("\n")}
58283
58287
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58284
58288
  return readonly ? globalReadonlyArrayType : globalArrayType;
58285
58289
  }
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(",") : "");
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(",") : "");
58288
58291
  let type = tupleTypes.get(key);
58289
58292
  if (!type) {
58290
58293
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58366,7 +58369,7 @@ ${lanes.join("\n")}
58366
58369
  }
58367
58370
  const expandedTypes = [];
58368
58371
  const expandedFlags = [];
58369
- const expandedDeclarations = [];
58372
+ let expandedDeclarations = [];
58370
58373
  let lastRequiredIndex = -1;
58371
58374
  let firstRestIndex = -1;
58372
58375
  let lastOptionalOrRestIndex = -1;
@@ -58404,7 +58407,7 @@ ${lanes.join("\n")}
58404
58407
  ));
58405
58408
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58406
58409
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58407
- expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58410
+ expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58408
58411
  }
58409
58412
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58410
58413
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58424,7 +58427,11 @@ ${lanes.join("\n")}
58424
58427
  true
58425
58428
  ) : type);
58426
58429
  expandedFlags.push(flags);
58427
- expandedDeclarations.push(declaration);
58430
+ if (expandedDeclarations && declaration) {
58431
+ expandedDeclarations.push(declaration);
58432
+ } else {
58433
+ expandedDeclarations = void 0;
58434
+ }
58428
58435
  }
58429
58436
  }
58430
58437
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -74156,10 +74163,7 @@ ${lanes.join("\n")}
74156
74163
  }
74157
74164
  return type;
74158
74165
  }
74159
- function getTupleElementLabel(d, index, restParameterName = "arg") {
74160
- if (!d) {
74161
- return `${restParameterName}_${index}`;
74162
- }
74166
+ function getTupleElementLabel(d) {
74163
74167
  Debug.assert(isIdentifier(d.name));
74164
74168
  return d.name.escapedText;
74165
74169
  }
@@ -74173,7 +74177,7 @@ ${lanes.join("\n")}
74173
74177
  if (isTupleType(restType)) {
74174
74178
  const associatedNames = restType.target.labeledElementDeclarations;
74175
74179
  const index = pos - paramCount;
74176
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74180
+ return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74177
74181
  }
74178
74182
  return restParameter.escapedName;
74179
74183
  }
@@ -77528,7 +77532,12 @@ ${lanes.join("\n")}
77528
77532
  const elementTypes = node.elements;
77529
77533
  let seenOptionalElement = false;
77530
77534
  let seenRestElement = false;
77535
+ const hasNamedElement = some(elementTypes, isNamedTupleMember);
77531
77536
  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
+ }
77532
77541
  const flags = getTupleElementFlags(e);
77533
77542
  if (flags & 8 /* Variadic */) {
77534
77543
  const type = getTypeFromTypeNode(e.type);
@@ -137197,14 +137206,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137197
137206
  const { file, startPosition } = context;
137198
137207
  const node = getNodeOrParentOfParentheses(file, startPosition);
137199
137208
  const maybeBinary = getParentBinaryExpression(node);
137209
+ const nodeIsStringLiteral = isStringLiteral(maybeBinary);
137200
137210
  const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
137201
- if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137211
+ if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
137212
+ return emptyArray;
137213
+ }
137214
+ if (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137202
137215
  refactorInfo.actions.push(convertStringAction);
137203
137216
  return [refactorInfo];
137204
137217
  } else if (context.preferences.provideRefactorNotApplicableReason) {
137205
137218
  refactorInfo.actions.push({
137206
137219
  ...convertStringAction,
137207
- notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation)
137220
+ notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation_or_string_literals)
137208
137221
  });
137209
137222
  return [refactorInfo];
137210
137223
  }
@@ -2895,7 +2895,7 @@ declare namespace ts {
2895
2895
  hasRestElement: boolean;
2896
2896
  combinedFlags: ElementFlags;
2897
2897
  readonly: boolean;
2898
- labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration | undefined)[];
2898
+ labeledElementDeclarations?: readonly (NamedTupleMember | ParameterDeclaration)[];
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.20230615`;
38
+ version = `${versionMajorMinor}.0-insiders.20230616`;
39
39
  Comparison = /* @__PURE__ */ ((Comparison3) => {
40
40
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
41
41
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -8111,6 +8111,7 @@ ${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."),
8114
8115
  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."),
8115
8116
  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."),
8116
8117
  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."),
@@ -9001,7 +9002,7 @@ ${lanes.join("\n")}
9001
9002
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
9002
9003
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
9003
9004
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
9004
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
9005
+ Can_only_convert_string_concatenation_or_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_or_string_literals_95154", "Can only convert string concatenation or string literals"),
9005
9006
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
9006
9007
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
9007
9008
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
@@ -50136,18 +50137,19 @@ ${lanes.join("\n")}
50136
50137
  const arity = getTypeReferenceArity(type2);
50137
50138
  const tupleConstituentNodes = mapToTypeNodes(typeArguments.slice(0, arity), context);
50138
50139
  if (tupleConstituentNodes) {
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) {
50140
+ if (type2.target.labeledElementDeclarations) {
50141
+ for (let i = 0; i < tupleConstituentNodes.length; i++) {
50142
+ const flags = type2.target.elementFlags[i];
50144
50143
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50145
50144
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50146
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50145
+ factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(type2.target.labeledElementDeclarations[i]))),
50147
50146
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50148
50147
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50149
50148
  );
50150
- } else {
50149
+ }
50150
+ } else {
50151
+ for (let i = 0; i < Math.min(arity, tupleConstituentNodes.length); i++) {
50152
+ const flags = type2.target.elementFlags[i];
50151
50153
  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];
50152
50154
  }
50153
50155
  }
@@ -55254,18 +55256,17 @@ ${lanes.join("\n")}
55254
55256
  function getExpandedParameters(sig, skipUnionExpanding) {
55255
55257
  if (signatureHasRestParameter(sig)) {
55256
55258
  const restIndex = sig.parameters.length - 1;
55257
- const restName = sig.parameters[restIndex].escapedName;
55258
55259
  const restType = getTypeOfSymbol(sig.parameters[restIndex]);
55259
55260
  if (isTupleType(restType)) {
55260
- return [expandSignatureParametersWithTupleMembers(restType, restIndex, restName)];
55261
+ return [expandSignatureParametersWithTupleMembers(restType, restIndex)];
55261
55262
  } else if (!skipUnionExpanding && restType.flags & 1048576 /* Union */ && every(restType.types, isTupleType)) {
55262
- return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex, restName));
55263
+ return map(restType.types, (t) => expandSignatureParametersWithTupleMembers(t, restIndex));
55263
55264
  }
55264
55265
  }
55265
55266
  return [sig.parameters];
55266
- function expandSignatureParametersWithTupleMembers(restType, restIndex, restName) {
55267
- const elementTypes = getTypeArguments(restType);
55268
- const associatedNames = getUniqAssociatedNamesFromTupleType(restType, restName);
55267
+ function expandSignatureParametersWithTupleMembers(restType, restIndex) {
55268
+ const elementTypes = getElementTypes(restType);
55269
+ const associatedNames = getUniqAssociatedNamesFromTupleType(restType);
55269
55270
  const restParams = map(elementTypes, (t, i) => {
55270
55271
  const name = associatedNames && associatedNames[i] ? associatedNames[i] : getParameterNameAtPosition(sig, restIndex + i, restType);
55271
55272
  const flags = restType.target.elementFlags[i];
@@ -55276,10 +55277,10 @@ ${lanes.join("\n")}
55276
55277
  });
55277
55278
  return concatenate(sig.parameters.slice(0, restIndex), restParams);
55278
55279
  }
55279
- function getUniqAssociatedNamesFromTupleType(type, restName) {
55280
+ function getUniqAssociatedNamesFromTupleType(type) {
55280
55281
  const associatedNamesMap = /* @__PURE__ */ new Map();
55281
- return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55282
- const name = getTupleElementLabel(labeledElement, i, restName);
55282
+ return map(type.target.labeledElementDeclarations, (labeledElement) => {
55283
+ const name = getTupleElementLabel(labeledElement);
55283
55284
  const prevCounter = associatedNamesMap.get(name);
55284
55285
  if (prevCounter === void 0) {
55285
55286
  associatedNamesMap.set(name, 1);
@@ -56078,9 +56079,9 @@ ${lanes.join("\n")}
56078
56079
  function getConstraintOfTypeParameter(typeParameter) {
56079
56080
  return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : void 0;
56080
56081
  }
56081
- function isConstTypeVariable(type) {
56082
+ function isConstTypeVariable(type, depth = 0) {
56082
56083
  var _a;
56083
- return !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, isConstTypeVariable) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type)) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t)) >= 0));
56084
+ return depth < 5 && !!(type && (type.flags & 262144 /* TypeParameter */ && some((_a = type.symbol) == null ? void 0 : _a.declarations, (d) => hasSyntacticModifier(d, 2048 /* Const */)) || type.flags & 1048576 /* Union */ && some(type.types, (t) => isConstTypeVariable(t, depth)) || type.flags & 8388608 /* IndexedAccess */ && isConstTypeVariable(type.objectType, depth + 1) || type.flags & 16777216 /* Conditional */ && isConstTypeVariable(getConstraintOfConditionalType(type), depth + 1) || type.flags & 33554432 /* Substitution */ && isConstTypeVariable(type.baseType, depth) || isGenericTupleType(type) && findIndex(getElementTypes(type), (t, i) => !!(type.target.elementFlags[i] & 8 /* Variadic */) && isConstTypeVariable(t, depth)) >= 0));
56084
56085
  }
56085
56086
  function getConstraintOfIndexedAccess(type) {
56086
56087
  return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : void 0;
@@ -58197,10 +58198,13 @@ ${lanes.join("\n")}
58197
58198
  return readonly ? globalReadonlyArrayType : globalArrayType;
58198
58199
  }
58199
58200
  const elementFlags = map(node.elements, getTupleElementFlags);
58200
- return getTupleTargetType(elementFlags, readonly, map(node.elements, memberIfLabeledElementDeclaration));
58201
- }
58202
- function memberIfLabeledElementDeclaration(member) {
58203
- return isNamedTupleMember(member) || isParameter(member) ? member : void 0;
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
+ );
58204
58208
  }
58205
58209
  function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) {
58206
58210
  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));
@@ -58275,7 +58279,7 @@ ${lanes.join("\n")}
58275
58279
  function isReadonlyTypeOperator(node) {
58276
58280
  return isTypeOperatorNode(node) && node.operator === 148 /* ReadonlyKeyword */;
58277
58281
  }
58278
- function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations = []) {
58282
+ function createTupleType(elementTypes, elementFlags, readonly = false, namedMemberDeclarations) {
58279
58283
  const tupleTarget = getTupleTargetType(elementFlags || map(elementTypes, (_) => 1 /* Required */), readonly, namedMemberDeclarations);
58280
58284
  return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : tupleTarget;
58281
58285
  }
@@ -58283,8 +58287,7 @@ ${lanes.join("\n")}
58283
58287
  if (elementFlags.length === 1 && elementFlags[0] & 4 /* Rest */) {
58284
58288
  return readonly ? globalReadonlyArrayType : globalArrayType;
58285
58289
  }
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(",") : "");
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(",") : "");
58288
58291
  let type = tupleTypes.get(key);
58289
58292
  if (!type) {
58290
58293
  tupleTypes.set(key, type = createTupleTargetType(elementFlags, readonly, namedMemberDeclarations));
@@ -58366,7 +58369,7 @@ ${lanes.join("\n")}
58366
58369
  }
58367
58370
  const expandedTypes = [];
58368
58371
  const expandedFlags = [];
58369
- const expandedDeclarations = [];
58372
+ let expandedDeclarations = [];
58370
58373
  let lastRequiredIndex = -1;
58371
58374
  let firstRestIndex = -1;
58372
58375
  let lastOptionalOrRestIndex = -1;
@@ -58404,7 +58407,7 @@ ${lanes.join("\n")}
58404
58407
  ));
58405
58408
  expandedTypes.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58406
58409
  expandedFlags.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58407
- expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58410
+ expandedDeclarations == null ? void 0 : expandedDeclarations.splice(firstRestIndex + 1, lastOptionalOrRestIndex - firstRestIndex);
58408
58411
  }
58409
58412
  const tupleTarget = getTupleTargetType(expandedFlags, target.readonly, expandedDeclarations);
58410
58413
  return tupleTarget === emptyGenericType ? emptyObjectType : expandedFlags.length ? createTypeReference(tupleTarget, expandedTypes) : tupleTarget;
@@ -58424,7 +58427,11 @@ ${lanes.join("\n")}
58424
58427
  true
58425
58428
  ) : type);
58426
58429
  expandedFlags.push(flags);
58427
- expandedDeclarations.push(declaration);
58430
+ if (expandedDeclarations && declaration) {
58431
+ expandedDeclarations.push(declaration);
58432
+ } else {
58433
+ expandedDeclarations = void 0;
58434
+ }
58428
58435
  }
58429
58436
  }
58430
58437
  function sliceTupleType(type, index, endSkipCount = 0) {
@@ -74156,10 +74163,7 @@ ${lanes.join("\n")}
74156
74163
  }
74157
74164
  return type;
74158
74165
  }
74159
- function getTupleElementLabel(d, index, restParameterName = "arg") {
74160
- if (!d) {
74161
- return `${restParameterName}_${index}`;
74162
- }
74166
+ function getTupleElementLabel(d) {
74163
74167
  Debug.assert(isIdentifier(d.name));
74164
74168
  return d.name.escapedText;
74165
74169
  }
@@ -74173,7 +74177,7 @@ ${lanes.join("\n")}
74173
74177
  if (isTupleType(restType)) {
74174
74178
  const associatedNames = restType.target.labeledElementDeclarations;
74175
74179
  const index = pos - paramCount;
74176
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74180
+ return associatedNames && getTupleElementLabel(associatedNames[index]) || restParameter.escapedName + "_" + index;
74177
74181
  }
74178
74182
  return restParameter.escapedName;
74179
74183
  }
@@ -77528,7 +77532,12 @@ ${lanes.join("\n")}
77528
77532
  const elementTypes = node.elements;
77529
77533
  let seenOptionalElement = false;
77530
77534
  let seenRestElement = false;
77535
+ const hasNamedElement = some(elementTypes, isNamedTupleMember);
77531
77536
  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
+ }
77532
77541
  const flags = getTupleElementFlags(e);
77533
77542
  if (flags & 8 /* Variadic */) {
77534
77543
  const type = getTypeFromTypeNode(e.type);
@@ -137212,14 +137221,18 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
137212
137221
  const { file, startPosition } = context;
137213
137222
  const node = getNodeOrParentOfParentheses(file, startPosition);
137214
137223
  const maybeBinary = getParentBinaryExpression(node);
137224
+ const nodeIsStringLiteral = isStringLiteral(maybeBinary);
137215
137225
  const refactorInfo = { name: refactorName10, description: refactorDescription6, actions: [] };
137216
- if (isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137226
+ if (nodeIsStringLiteral && context.triggerReason !== "invoked") {
137227
+ return emptyArray;
137228
+ }
137229
+ if (nodeIsStringLiteral || isBinaryExpression(maybeBinary) && treeToArray(maybeBinary).isValidConcatenation) {
137217
137230
  refactorInfo.actions.push(convertStringAction);
137218
137231
  return [refactorInfo];
137219
137232
  } else if (context.preferences.provideRefactorNotApplicableReason) {
137220
137233
  refactorInfo.actions.push({
137221
137234
  ...convertStringAction,
137222
- notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation)
137235
+ notApplicableReason: getLocaleSpecificMessage(Diagnostics.Can_only_convert_string_concatenation_or_string_literals)
137223
137236
  });
137224
137237
  return [refactorInfo];
137225
137238
  }
@@ -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.20230615`;
57
+ var version = `${versionMajorMinor}.0-insiders.20230616`;
58
58
 
59
59
  // src/compiler/core.ts
60
60
  var emptyArray = [];
@@ -6182,6 +6182,7 @@ 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."),
6185
6186
  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."),
6186
6187
  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."),
6187
6188
  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."),
@@ -7072,7 +7073,7 @@ var Diagnostics = {
7072
7073
  Could_not_convert_to_arrow_function: diag(95151, 3 /* Message */, "Could_not_convert_to_arrow_function_95151", "Could not convert to arrow function"),
7073
7074
  Could_not_convert_to_named_function: diag(95152, 3 /* Message */, "Could_not_convert_to_named_function_95152", "Could not convert to named function"),
7074
7075
  Could_not_convert_to_anonymous_function: diag(95153, 3 /* Message */, "Could_not_convert_to_anonymous_function_95153", "Could not convert to anonymous function"),
7075
- Can_only_convert_string_concatenation: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_95154", "Can only convert string concatenation"),
7076
+ Can_only_convert_string_concatenation_or_string_literals: diag(95154, 3 /* Message */, "Can_only_convert_string_concatenation_or_string_literals_95154", "Can only convert string concatenation or string literals"),
7076
7077
  Selection_is_not_a_valid_statement_or_statements: diag(95155, 3 /* Message */, "Selection_is_not_a_valid_statement_or_statements_95155", "Selection is not a valid statement or statements"),
7077
7078
  Add_missing_function_declaration_0: diag(95156, 3 /* Message */, "Add_missing_function_declaration_0_95156", "Add missing function declaration '{0}'"),
7078
7079
  Add_all_missing_function_declarations: diag(95157, 3 /* Message */, "Add_all_missing_function_declarations_95157", "Add all missing function declarations"),
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-53356-21",
5
+ "version": "5.2.0-pr-54647-2",
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": "0003af0701202d3feb29063d5e5073970dca9f6d"
118
+ "gitHead": "4a58fe91bad1aa6dca65eba3ecd2f26e05cd9a14"
119
119
  }