@typescript-deploys/pr-build 5.3.0-pr-54960-22 → 5.3.0-pr-55452-4

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
@@ -17484,6 +17484,9 @@ function getPropertyNameFromType(type) {
17484
17484
  }
17485
17485
  return Debug.fail();
17486
17486
  }
17487
+ function isNamedTupleMemberName(node) {
17488
+ return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
17489
+ }
17487
17490
 
17488
17491
  // src/compiler/factory/baseNodeFactory.ts
17489
17492
  function createBaseNodeFactory() {
@@ -28657,21 +28660,29 @@ var Parser;
28657
28660
  }
28658
28661
  return type;
28659
28662
  }
28660
- function isNextTokenColonOrQuestionColon() {
28661
- return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
28663
+ function isTokenColonOrQuestionColon() {
28664
+ return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
28662
28665
  }
28663
28666
  function isTupleElementName() {
28664
28667
  if (token() === 26 /* DotDotDotToken */) {
28665
- return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
28668
+ nextToken();
28669
+ }
28670
+ if (token() === 16 /* TemplateHead */) {
28671
+ parseTemplateType();
28672
+ return isTokenColonOrQuestionColon();
28673
+ }
28674
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
28675
+ nextToken();
28676
+ return isTokenColonOrQuestionColon();
28666
28677
  }
28667
- return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
28678
+ return false;
28668
28679
  }
28669
28680
  function parseTupleElementNameOrTupleElementType() {
28670
28681
  if (lookAhead(isTupleElementName)) {
28671
28682
  const pos = getNodePos();
28672
28683
  const hasJSDoc = hasPrecedingJSDocComment();
28673
28684
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
28674
- const name = parseIdentifierName();
28685
+ const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
28675
28686
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
28676
28687
  parseExpected(59 /* ColonToken */);
28677
28688
  const type = parseTupleElementType();
@@ -48081,10 +48092,11 @@ function createTypeChecker(host) {
48081
48092
  for (let i = 0; i < tupleConstituentNodes.length; i++) {
48082
48093
  const flags = type2.target.elementFlags[i];
48083
48094
  const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
48084
- if (labeledElementDeclaration) {
48095
+ const label = labeledElementDeclaration && getTupleElementLabel(type2, labeledElementDeclaration);
48096
+ if (label) {
48085
48097
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
48086
48098
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
48087
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
48099
+ factory.createIdentifier(unescapeLeadingUnderscores(label)),
48088
48100
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
48089
48101
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
48090
48102
  );
@@ -53284,7 +53296,7 @@ function createTypeChecker(host) {
53284
53296
  function getUniqAssociatedNamesFromTupleType(type, restName) {
53285
53297
  const associatedNamesMap = /* @__PURE__ */ new Map();
53286
53298
  return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
53287
- const name = getTupleElementLabel(labeledElement, i, restName);
53299
+ const name = getTupleElementLabel(type, labeledElement, i, restName);
53288
53300
  const prevCounter = associatedNamesMap.get(name);
53289
53301
  if (prevCounter === void 0) {
53290
53302
  associatedNamesMap.set(name, 1);
@@ -54740,7 +54752,7 @@ function createTypeChecker(host) {
54740
54752
  }
54741
54753
  const iife = getImmediatelyInvokedFunctionExpression(node.parent);
54742
54754
  if (iife) {
54743
- return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= getEffectiveCallArguments(iife).length;
54755
+ return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length;
54744
54756
  }
54745
54757
  return false;
54746
54758
  }
@@ -72040,20 +72052,27 @@ function createTypeChecker(host) {
72040
72052
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
72041
72053
  }
72042
72054
  function getTypeOfParameter(symbol) {
72043
- const declaration = symbol.valueDeclaration;
72044
- return addOptionality(
72045
- getTypeOfSymbol(symbol),
72046
- /*isProperty*/
72047
- false,
72048
- /*isOptional*/
72049
- !!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
72050
- );
72055
+ const type = getTypeOfSymbol(symbol);
72056
+ if (strictNullChecks) {
72057
+ const declaration = symbol.valueDeclaration;
72058
+ if (declaration && hasInitializer(declaration)) {
72059
+ return getOptionalType(type);
72060
+ }
72061
+ }
72062
+ return type;
72051
72063
  }
72052
- function getTupleElementLabel(d, index, restParameterName = "arg") {
72064
+ function getTupleElementLabel(tupleType, d, index, restParameterName = "arg") {
72053
72065
  if (!d) {
72054
72066
  return `${restParameterName}_${index}`;
72055
72067
  }
72056
- Debug.assert(isIdentifier(d.name));
72068
+ Debug.assert(!isBindingPattern(d.name));
72069
+ if (d.name.kind === 203 /* TemplateLiteralType */) {
72070
+ const label = instantiateType(getTypeFromTypeNode(d.name), tupleType.mapper);
72071
+ return label.flags & 128 /* StringLiteral */ ? escapeLeadingUnderscores(label.value) : typeof index === "number" ? `${restParameterName}_${index}` : void 0;
72072
+ }
72073
+ if (d.name.kind === 15 /* NoSubstitutionTemplateLiteral */) {
72074
+ return escapeLeadingUnderscores(d.name.text);
72075
+ }
72057
72076
  return d.name.escapedText;
72058
72077
  }
72059
72078
  function getParameterNameAtPosition(signature, pos, overrideRestType) {
@@ -72066,7 +72085,7 @@ function createTypeChecker(host) {
72066
72085
  if (isTupleType(restType)) {
72067
72086
  const associatedNames = restType.target.labeledElementDeclarations;
72068
72087
  const index = pos - paramCount;
72069
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
72088
+ return getTupleElementLabel(restType, associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
72070
72089
  }
72071
72090
  return restParameter.escapedName;
72072
72091
  }
@@ -72096,8 +72115,7 @@ function createTypeChecker(host) {
72096
72115
  const index = pos - paramCount;
72097
72116
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
72098
72117
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
72099
- if (associatedName) {
72100
- Debug.assert(isIdentifier(associatedName.name));
72118
+ if (associatedName && isIdentifier(associatedName.name)) {
72101
72119
  return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
72102
72120
  }
72103
72121
  return void 0;
@@ -72314,29 +72332,23 @@ function createTypeChecker(host) {
72314
72332
  assignParameterType(parameter);
72315
72333
  }
72316
72334
  }
72317
- function assignParameterType(parameter, contextualType) {
72335
+ function assignParameterType(parameter, type) {
72318
72336
  const links = getSymbolLinks(parameter);
72319
72337
  if (!links.type) {
72320
72338
  const declaration = parameter.valueDeclaration;
72321
- links.type = addOptionality(
72322
- contextualType || (declaration ? getWidenedTypeForVariableLikeDeclaration(
72323
- declaration,
72324
- /*reportErrors*/
72325
- true
72326
- ) : getTypeOfSymbol(parameter)),
72327
- /*isProperty*/
72328
- false,
72329
- /*isOptional*/
72330
- !!declaration && !declaration.initializer && isOptionalDeclaration(declaration)
72331
- );
72339
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(
72340
+ declaration,
72341
+ /*reportErrors*/
72342
+ true
72343
+ ) : getTypeOfSymbol(parameter));
72332
72344
  if (declaration && declaration.name.kind !== 80 /* Identifier */) {
72333
72345
  if (links.type === unknownType) {
72334
72346
  links.type = getTypeFromBindingPattern(declaration.name);
72335
72347
  }
72336
72348
  assignBindingElementTypes(declaration.name, links.type);
72337
72349
  }
72338
- } else if (contextualType) {
72339
- Debug.assertEqual(links.type, contextualType, "Parameter symbol already has a cached type which differs from newly assigned type");
72350
+ } else if (type) {
72351
+ Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
72340
72352
  }
72341
72353
  }
72342
72354
  function assignBindingElementTypes(pattern, parentType) {
@@ -75601,6 +75613,9 @@ function createTypeChecker(host) {
75601
75613
  if (node.type.kind === 191 /* RestType */) {
75602
75614
  grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type);
75603
75615
  }
75616
+ if (node.name.kind === 203 /* TemplateLiteralType */) {
75617
+ checkSourceElement(node.name);
75618
+ }
75604
75619
  checkSourceElement(node.type);
75605
75620
  getTypeFromTypeNode(node);
75606
75621
  }
@@ -84412,7 +84427,7 @@ var visitEachChildTable = {
84412
84427
  return context.factory.updateNamedTupleMember(
84413
84428
  node,
84414
84429
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
84415
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
84430
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
84416
84431
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
84417
84432
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
84418
84433
  );
package/lib/tsserver.js CHANGED
@@ -1587,6 +1587,7 @@ __export(server_exports, {
1587
1587
  isNamedImports: () => isNamedImports,
1588
1588
  isNamedImportsOrExports: () => isNamedImportsOrExports,
1589
1589
  isNamedTupleMember: () => isNamedTupleMember,
1590
+ isNamedTupleMemberName: () => isNamedTupleMemberName,
1590
1591
  isNamespaceBody: () => isNamespaceBody,
1591
1592
  isNamespaceExport: () => isNamespaceExport,
1592
1593
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -21685,6 +21686,9 @@ function getPropertyNameFromType(type) {
21685
21686
  }
21686
21687
  return Debug.fail();
21687
21688
  }
21689
+ function isNamedTupleMemberName(node) {
21690
+ return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
21691
+ }
21688
21692
 
21689
21693
  // src/compiler/factory/baseNodeFactory.ts
21690
21694
  function createBaseNodeFactory() {
@@ -33059,21 +33063,29 @@ var Parser;
33059
33063
  }
33060
33064
  return type;
33061
33065
  }
33062
- function isNextTokenColonOrQuestionColon() {
33063
- return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
33066
+ function isTokenColonOrQuestionColon() {
33067
+ return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
33064
33068
  }
33065
33069
  function isTupleElementName() {
33066
33070
  if (token() === 26 /* DotDotDotToken */) {
33067
- return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
33071
+ nextToken();
33072
+ }
33073
+ if (token() === 16 /* TemplateHead */) {
33074
+ parseTemplateType();
33075
+ return isTokenColonOrQuestionColon();
33076
+ }
33077
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
33078
+ nextToken();
33079
+ return isTokenColonOrQuestionColon();
33068
33080
  }
33069
- return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
33081
+ return false;
33070
33082
  }
33071
33083
  function parseTupleElementNameOrTupleElementType() {
33072
33084
  if (lookAhead(isTupleElementName)) {
33073
33085
  const pos = getNodePos();
33074
33086
  const hasJSDoc = hasPrecedingJSDocComment();
33075
33087
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
33076
- const name = parseIdentifierName();
33088
+ const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
33077
33089
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
33078
33090
  parseExpected(59 /* ColonToken */);
33079
33091
  const type = parseTupleElementType();
@@ -52789,10 +52801,11 @@ function createTypeChecker(host) {
52789
52801
  for (let i = 0; i < tupleConstituentNodes.length; i++) {
52790
52802
  const flags = type2.target.elementFlags[i];
52791
52803
  const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
52792
- if (labeledElementDeclaration) {
52804
+ const label = labeledElementDeclaration && getTupleElementLabel(type2, labeledElementDeclaration);
52805
+ if (label) {
52793
52806
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
52794
52807
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
52795
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
52808
+ factory.createIdentifier(unescapeLeadingUnderscores(label)),
52796
52809
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
52797
52810
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
52798
52811
  );
@@ -57992,7 +58005,7 @@ function createTypeChecker(host) {
57992
58005
  function getUniqAssociatedNamesFromTupleType(type, restName) {
57993
58006
  const associatedNamesMap = /* @__PURE__ */ new Map();
57994
58007
  return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
57995
- const name = getTupleElementLabel(labeledElement, i, restName);
58008
+ const name = getTupleElementLabel(type, labeledElement, i, restName);
57996
58009
  const prevCounter = associatedNamesMap.get(name);
57997
58010
  if (prevCounter === void 0) {
57998
58011
  associatedNamesMap.set(name, 1);
@@ -59448,7 +59461,7 @@ function createTypeChecker(host) {
59448
59461
  }
59449
59462
  const iife = getImmediatelyInvokedFunctionExpression(node.parent);
59450
59463
  if (iife) {
59451
- return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= getEffectiveCallArguments(iife).length;
59464
+ return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length;
59452
59465
  }
59453
59466
  return false;
59454
59467
  }
@@ -76748,20 +76761,27 @@ function createTypeChecker(host) {
76748
76761
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
76749
76762
  }
76750
76763
  function getTypeOfParameter(symbol) {
76751
- const declaration = symbol.valueDeclaration;
76752
- return addOptionality(
76753
- getTypeOfSymbol(symbol),
76754
- /*isProperty*/
76755
- false,
76756
- /*isOptional*/
76757
- !!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
76758
- );
76764
+ const type = getTypeOfSymbol(symbol);
76765
+ if (strictNullChecks) {
76766
+ const declaration = symbol.valueDeclaration;
76767
+ if (declaration && hasInitializer(declaration)) {
76768
+ return getOptionalType(type);
76769
+ }
76770
+ }
76771
+ return type;
76759
76772
  }
76760
- function getTupleElementLabel(d, index, restParameterName = "arg") {
76773
+ function getTupleElementLabel(tupleType, d, index, restParameterName = "arg") {
76761
76774
  if (!d) {
76762
76775
  return `${restParameterName}_${index}`;
76763
76776
  }
76764
- Debug.assert(isIdentifier(d.name));
76777
+ Debug.assert(!isBindingPattern(d.name));
76778
+ if (d.name.kind === 203 /* TemplateLiteralType */) {
76779
+ const label = instantiateType(getTypeFromTypeNode(d.name), tupleType.mapper);
76780
+ return label.flags & 128 /* StringLiteral */ ? escapeLeadingUnderscores(label.value) : typeof index === "number" ? `${restParameterName}_${index}` : void 0;
76781
+ }
76782
+ if (d.name.kind === 15 /* NoSubstitutionTemplateLiteral */) {
76783
+ return escapeLeadingUnderscores(d.name.text);
76784
+ }
76765
76785
  return d.name.escapedText;
76766
76786
  }
76767
76787
  function getParameterNameAtPosition(signature, pos, overrideRestType) {
@@ -76774,7 +76794,7 @@ function createTypeChecker(host) {
76774
76794
  if (isTupleType(restType)) {
76775
76795
  const associatedNames = restType.target.labeledElementDeclarations;
76776
76796
  const index = pos - paramCount;
76777
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
76797
+ return getTupleElementLabel(restType, associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
76778
76798
  }
76779
76799
  return restParameter.escapedName;
76780
76800
  }
@@ -76804,8 +76824,7 @@ function createTypeChecker(host) {
76804
76824
  const index = pos - paramCount;
76805
76825
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
76806
76826
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
76807
- if (associatedName) {
76808
- Debug.assert(isIdentifier(associatedName.name));
76827
+ if (associatedName && isIdentifier(associatedName.name)) {
76809
76828
  return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
76810
76829
  }
76811
76830
  return void 0;
@@ -77022,29 +77041,23 @@ function createTypeChecker(host) {
77022
77041
  assignParameterType(parameter);
77023
77042
  }
77024
77043
  }
77025
- function assignParameterType(parameter, contextualType) {
77044
+ function assignParameterType(parameter, type) {
77026
77045
  const links = getSymbolLinks(parameter);
77027
77046
  if (!links.type) {
77028
77047
  const declaration = parameter.valueDeclaration;
77029
- links.type = addOptionality(
77030
- contextualType || (declaration ? getWidenedTypeForVariableLikeDeclaration(
77031
- declaration,
77032
- /*reportErrors*/
77033
- true
77034
- ) : getTypeOfSymbol(parameter)),
77035
- /*isProperty*/
77036
- false,
77037
- /*isOptional*/
77038
- !!declaration && !declaration.initializer && isOptionalDeclaration(declaration)
77039
- );
77048
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(
77049
+ declaration,
77050
+ /*reportErrors*/
77051
+ true
77052
+ ) : getTypeOfSymbol(parameter));
77040
77053
  if (declaration && declaration.name.kind !== 80 /* Identifier */) {
77041
77054
  if (links.type === unknownType) {
77042
77055
  links.type = getTypeFromBindingPattern(declaration.name);
77043
77056
  }
77044
77057
  assignBindingElementTypes(declaration.name, links.type);
77045
77058
  }
77046
- } else if (contextualType) {
77047
- Debug.assertEqual(links.type, contextualType, "Parameter symbol already has a cached type which differs from newly assigned type");
77059
+ } else if (type) {
77060
+ Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
77048
77061
  }
77049
77062
  }
77050
77063
  function assignBindingElementTypes(pattern, parentType) {
@@ -80309,6 +80322,9 @@ function createTypeChecker(host) {
80309
80322
  if (node.type.kind === 191 /* RestType */) {
80310
80323
  grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type);
80311
80324
  }
80325
+ if (node.name.kind === 203 /* TemplateLiteralType */) {
80326
+ checkSourceElement(node.name);
80327
+ }
80312
80328
  checkSourceElement(node.type);
80313
80329
  getTypeFromTypeNode(node);
80314
80330
  }
@@ -89120,7 +89136,7 @@ var visitEachChildTable = {
89120
89136
  return context.factory.updateNamedTupleMember(
89121
89137
  node,
89122
89138
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
89123
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
89139
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
89124
89140
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
89125
89141
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
89126
89142
  );
@@ -173464,6 +173480,7 @@ __export(ts_exports2, {
173464
173480
  isNamedImports: () => isNamedImports,
173465
173481
  isNamedImportsOrExports: () => isNamedImportsOrExports,
173466
173482
  isNamedTupleMember: () => isNamedTupleMember,
173483
+ isNamedTupleMemberName: () => isNamedTupleMemberName,
173467
173484
  isNamespaceBody: () => isNamespaceBody,
173468
173485
  isNamespaceExport: () => isNamespaceExport,
173469
173486
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -188019,6 +188036,7 @@ start(initializeNodeSystem(), require("os").platform());
188019
188036
  isNamedImports,
188020
188037
  isNamedImportsOrExports,
188021
188038
  isNamedTupleMember,
188039
+ isNamedTupleMemberName,
188022
188040
  isNamespaceBody,
188023
188041
  isNamespaceExport,
188024
188042
  isNamespaceExportDeclaration,
@@ -5196,10 +5196,11 @@ declare namespace ts {
5196
5196
  readonly kind: SyntaxKind.TupleType;
5197
5197
  readonly elements: NodeArray<TypeNode | NamedTupleMember>;
5198
5198
  }
5199
+ type NamedTupleMemberName = Identifier | NoSubstitutionTemplateLiteral | TemplateLiteralTypeNode;
5199
5200
  interface NamedTupleMember extends TypeNode, Declaration, JSDocContainer {
5200
5201
  readonly kind: SyntaxKind.NamedTupleMember;
5201
5202
  readonly dotDotDotToken?: Token<SyntaxKind.DotDotDotToken>;
5202
- readonly name: Identifier;
5203
+ readonly name: NamedTupleMemberName;
5203
5204
  readonly questionToken?: Token<SyntaxKind.QuestionToken>;
5204
5205
  readonly type: TypeNode;
5205
5206
  }
@@ -7932,8 +7933,8 @@ declare namespace ts {
7932
7933
  updateArrayTypeNode(node: ArrayTypeNode, elementType: TypeNode): ArrayTypeNode;
7933
7934
  createTupleTypeNode(elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode;
7934
7935
  updateTupleTypeNode(node: TupleTypeNode, elements: readonly (TypeNode | NamedTupleMember)[]): TupleTypeNode;
7935
- createNamedTupleMember(dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
7936
- updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: DotDotDotToken | undefined, name: Identifier, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
7936
+ createNamedTupleMember(dotDotDotToken: DotDotDotToken | undefined, name: NamedTupleMemberName, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
7937
+ updateNamedTupleMember(node: NamedTupleMember, dotDotDotToken: DotDotDotToken | undefined, name: NamedTupleMemberName, questionToken: QuestionToken | undefined, type: TypeNode): NamedTupleMember;
7937
7938
  createOptionalTypeNode(type: TypeNode): OptionalTypeNode;
7938
7939
  updateOptionalTypeNode(node: OptionalTypeNode, type: TypeNode): OptionalTypeNode;
7939
7940
  createRestTypeNode(type: TypeNode): RestTypeNode;
package/lib/typescript.js CHANGED
@@ -19303,6 +19303,9 @@ ${lanes.join("\n")}
19303
19303
  }
19304
19304
  return Debug.fail();
19305
19305
  }
19306
+ function isNamedTupleMemberName(node) {
19307
+ return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
19308
+ }
19306
19309
  var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashLibReferenceRegEx, fullTripleSlashAMDReferencePathRegEx, fullTripleSlashAMDModuleRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, objectAllocator, objectAllocatorPatchers, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, supportedTSImplementationExtensions, extensionsNotSupportingExtensionlessResolution, ModuleSpecifierEnding, extensionsToRemove, emptyFileSystemEntries;
19307
19310
  var init_utilities = __esm({
19308
19311
  "src/compiler/utilities.ts"() {
@@ -31126,21 +31129,29 @@ ${lanes.join("\n")}
31126
31129
  }
31127
31130
  return type;
31128
31131
  }
31129
- function isNextTokenColonOrQuestionColon() {
31130
- return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
31132
+ function isTokenColonOrQuestionColon() {
31133
+ return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
31131
31134
  }
31132
31135
  function isTupleElementName() {
31133
31136
  if (token() === 26 /* DotDotDotToken */) {
31134
- return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
31137
+ nextToken();
31138
+ }
31139
+ if (token() === 16 /* TemplateHead */) {
31140
+ parseTemplateType();
31141
+ return isTokenColonOrQuestionColon();
31142
+ }
31143
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
31144
+ nextToken();
31145
+ return isTokenColonOrQuestionColon();
31135
31146
  }
31136
- return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
31147
+ return false;
31137
31148
  }
31138
31149
  function parseTupleElementNameOrTupleElementType() {
31139
31150
  if (lookAhead(isTupleElementName)) {
31140
31151
  const pos = getNodePos();
31141
31152
  const hasJSDoc = hasPrecedingJSDocComment();
31142
31153
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
31143
- const name = parseIdentifierName();
31154
+ const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
31144
31155
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
31145
31156
  parseExpected(59 /* ColonToken */);
31146
31157
  const type = parseTupleElementType();
@@ -50550,10 +50561,11 @@ ${lanes.join("\n")}
50550
50561
  for (let i = 0; i < tupleConstituentNodes.length; i++) {
50551
50562
  const flags = type2.target.elementFlags[i];
50552
50563
  const labeledElementDeclaration = labeledElementDeclarations == null ? void 0 : labeledElementDeclarations[i];
50553
- if (labeledElementDeclaration) {
50564
+ const label = labeledElementDeclaration && getTupleElementLabel(type2, labeledElementDeclaration);
50565
+ if (label) {
50554
50566
  tupleConstituentNodes[i] = factory.createNamedTupleMember(
50555
50567
  flags & 12 /* Variable */ ? factory.createToken(26 /* DotDotDotToken */) : void 0,
50556
- factory.createIdentifier(unescapeLeadingUnderscores(getTupleElementLabel(labeledElementDeclaration))),
50568
+ factory.createIdentifier(unescapeLeadingUnderscores(label)),
50557
50569
  flags & 2 /* Optional */ ? factory.createToken(58 /* QuestionToken */) : void 0,
50558
50570
  flags & 4 /* Rest */ ? factory.createArrayTypeNode(tupleConstituentNodes[i]) : tupleConstituentNodes[i]
50559
50571
  );
@@ -55753,7 +55765,7 @@ ${lanes.join("\n")}
55753
55765
  function getUniqAssociatedNamesFromTupleType(type, restName) {
55754
55766
  const associatedNamesMap = /* @__PURE__ */ new Map();
55755
55767
  return map(type.target.labeledElementDeclarations, (labeledElement, i) => {
55756
- const name = getTupleElementLabel(labeledElement, i, restName);
55768
+ const name = getTupleElementLabel(type, labeledElement, i, restName);
55757
55769
  const prevCounter = associatedNamesMap.get(name);
55758
55770
  if (prevCounter === void 0) {
55759
55771
  associatedNamesMap.set(name, 1);
@@ -57209,7 +57221,7 @@ ${lanes.join("\n")}
57209
57221
  }
57210
57222
  const iife = getImmediatelyInvokedFunctionExpression(node.parent);
57211
57223
  if (iife) {
57212
- return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= getEffectiveCallArguments(iife).length;
57224
+ return !node.type && !node.dotDotDotToken && node.parent.parameters.indexOf(node) >= iife.arguments.length;
57213
57225
  }
57214
57226
  return false;
57215
57227
  }
@@ -74509,20 +74521,27 @@ ${lanes.join("\n")}
74509
74521
  return node.name.escapedText === "meta" ? getGlobalImportMetaType() : errorType;
74510
74522
  }
74511
74523
  function getTypeOfParameter(symbol) {
74512
- const declaration = symbol.valueDeclaration;
74513
- return addOptionality(
74514
- getTypeOfSymbol(symbol),
74515
- /*isProperty*/
74516
- false,
74517
- /*isOptional*/
74518
- !!declaration && (hasInitializer(declaration) || isOptionalDeclaration(declaration))
74519
- );
74524
+ const type = getTypeOfSymbol(symbol);
74525
+ if (strictNullChecks) {
74526
+ const declaration = symbol.valueDeclaration;
74527
+ if (declaration && hasInitializer(declaration)) {
74528
+ return getOptionalType(type);
74529
+ }
74530
+ }
74531
+ return type;
74520
74532
  }
74521
- function getTupleElementLabel(d, index, restParameterName = "arg") {
74533
+ function getTupleElementLabel(tupleType, d, index, restParameterName = "arg") {
74522
74534
  if (!d) {
74523
74535
  return `${restParameterName}_${index}`;
74524
74536
  }
74525
- Debug.assert(isIdentifier(d.name));
74537
+ Debug.assert(!isBindingPattern(d.name));
74538
+ if (d.name.kind === 203 /* TemplateLiteralType */) {
74539
+ const label = instantiateType(getTypeFromTypeNode(d.name), tupleType.mapper);
74540
+ return label.flags & 128 /* StringLiteral */ ? escapeLeadingUnderscores(label.value) : typeof index === "number" ? `${restParameterName}_${index}` : void 0;
74541
+ }
74542
+ if (d.name.kind === 15 /* NoSubstitutionTemplateLiteral */) {
74543
+ return escapeLeadingUnderscores(d.name.text);
74544
+ }
74526
74545
  return d.name.escapedText;
74527
74546
  }
74528
74547
  function getParameterNameAtPosition(signature, pos, overrideRestType) {
@@ -74535,7 +74554,7 @@ ${lanes.join("\n")}
74535
74554
  if (isTupleType(restType)) {
74536
74555
  const associatedNames = restType.target.labeledElementDeclarations;
74537
74556
  const index = pos - paramCount;
74538
- return getTupleElementLabel(associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74557
+ return getTupleElementLabel(restType, associatedNames == null ? void 0 : associatedNames[index], index, restParameter.escapedName);
74539
74558
  }
74540
74559
  return restParameter.escapedName;
74541
74560
  }
@@ -74565,8 +74584,7 @@ ${lanes.join("\n")}
74565
74584
  const index = pos - paramCount;
74566
74585
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
74567
74586
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
74568
- if (associatedName) {
74569
- Debug.assert(isIdentifier(associatedName.name));
74587
+ if (associatedName && isIdentifier(associatedName.name)) {
74570
74588
  return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
74571
74589
  }
74572
74590
  return void 0;
@@ -74783,29 +74801,23 @@ ${lanes.join("\n")}
74783
74801
  assignParameterType(parameter);
74784
74802
  }
74785
74803
  }
74786
- function assignParameterType(parameter, contextualType) {
74804
+ function assignParameterType(parameter, type) {
74787
74805
  const links = getSymbolLinks(parameter);
74788
74806
  if (!links.type) {
74789
74807
  const declaration = parameter.valueDeclaration;
74790
- links.type = addOptionality(
74791
- contextualType || (declaration ? getWidenedTypeForVariableLikeDeclaration(
74792
- declaration,
74793
- /*reportErrors*/
74794
- true
74795
- ) : getTypeOfSymbol(parameter)),
74796
- /*isProperty*/
74797
- false,
74798
- /*isOptional*/
74799
- !!declaration && !declaration.initializer && isOptionalDeclaration(declaration)
74800
- );
74808
+ links.type = type || (declaration ? getWidenedTypeForVariableLikeDeclaration(
74809
+ declaration,
74810
+ /*reportErrors*/
74811
+ true
74812
+ ) : getTypeOfSymbol(parameter));
74801
74813
  if (declaration && declaration.name.kind !== 80 /* Identifier */) {
74802
74814
  if (links.type === unknownType) {
74803
74815
  links.type = getTypeFromBindingPattern(declaration.name);
74804
74816
  }
74805
74817
  assignBindingElementTypes(declaration.name, links.type);
74806
74818
  }
74807
- } else if (contextualType) {
74808
- Debug.assertEqual(links.type, contextualType, "Parameter symbol already has a cached type which differs from newly assigned type");
74819
+ } else if (type) {
74820
+ Debug.assertEqual(links.type, type, "Parameter symbol already has a cached type which differs from newly assigned type");
74809
74821
  }
74810
74822
  }
74811
74823
  function assignBindingElementTypes(pattern, parentType) {
@@ -78070,6 +78082,9 @@ ${lanes.join("\n")}
78070
78082
  if (node.type.kind === 191 /* RestType */) {
78071
78083
  grammarErrorOnNode(node.type, Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type);
78072
78084
  }
78085
+ if (node.name.kind === 203 /* TemplateLiteralType */) {
78086
+ checkSourceElement(node.name);
78087
+ }
78073
78088
  checkSourceElement(node.type);
78074
78089
  getTypeFromTypeNode(node);
78075
78090
  }
@@ -87024,7 +87039,7 @@ ${lanes.join("\n")}
87024
87039
  return context.factory.updateNamedTupleMember(
87025
87040
  node,
87026
87041
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
87027
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
87042
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
87028
87043
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
87029
87044
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
87030
87045
  );
@@ -184634,6 +184649,7 @@ ${e.message}`;
184634
184649
  isNamedImports: () => isNamedImports,
184635
184650
  isNamedImportsOrExports: () => isNamedImportsOrExports,
184636
184651
  isNamedTupleMember: () => isNamedTupleMember,
184652
+ isNamedTupleMemberName: () => isNamedTupleMemberName,
184637
184653
  isNamespaceBody: () => isNamespaceBody,
184638
184654
  isNamespaceExport: () => isNamespaceExport,
184639
184655
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -187043,6 +187059,7 @@ ${e.message}`;
187043
187059
  isNamedImports: () => isNamedImports,
187044
187060
  isNamedImportsOrExports: () => isNamedImportsOrExports,
187045
187061
  isNamedTupleMember: () => isNamedTupleMember,
187062
+ isNamedTupleMemberName: () => isNamedTupleMemberName,
187046
187063
  isNamespaceBody: () => isNamespaceBody,
187047
187064
  isNamespaceExport: () => isNamespaceExport,
187048
187065
  isNamespaceExportDeclaration: () => isNamespaceExportDeclaration,
@@ -11742,6 +11742,9 @@ function getEscapedTextOfJsxNamespacedName(node) {
11742
11742
  function getTextOfJsxNamespacedName(node) {
11743
11743
  return `${idText(node.namespace)}:${idText(node.name)}`;
11744
11744
  }
11745
+ function isNamedTupleMemberName(node) {
11746
+ return node.kind === 80 /* Identifier */ || node.kind === 203 /* TemplateLiteralType */ || node.kind === 15 /* NoSubstitutionTemplateLiteral */;
11747
+ }
11745
11748
 
11746
11749
  // src/compiler/factory/baseNodeFactory.ts
11747
11750
  function createBaseNodeFactory() {
@@ -20514,21 +20517,29 @@ var Parser;
20514
20517
  }
20515
20518
  return type;
20516
20519
  }
20517
- function isNextTokenColonOrQuestionColon() {
20518
- return nextToken() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
20520
+ function isTokenColonOrQuestionColon() {
20521
+ return token() === 59 /* ColonToken */ || token() === 58 /* QuestionToken */ && nextToken() === 59 /* ColonToken */;
20519
20522
  }
20520
20523
  function isTupleElementName() {
20521
20524
  if (token() === 26 /* DotDotDotToken */) {
20522
- return tokenIsIdentifierOrKeyword(nextToken()) && isNextTokenColonOrQuestionColon();
20525
+ nextToken();
20526
+ }
20527
+ if (token() === 16 /* TemplateHead */) {
20528
+ parseTemplateType();
20529
+ return isTokenColonOrQuestionColon();
20530
+ }
20531
+ if (tokenIsIdentifierOrKeyword(token()) || token() === 15 /* NoSubstitutionTemplateLiteral */) {
20532
+ nextToken();
20533
+ return isTokenColonOrQuestionColon();
20523
20534
  }
20524
- return tokenIsIdentifierOrKeyword(token()) && isNextTokenColonOrQuestionColon();
20535
+ return false;
20525
20536
  }
20526
20537
  function parseTupleElementNameOrTupleElementType() {
20527
20538
  if (lookAhead(isTupleElementName)) {
20528
20539
  const pos = getNodePos();
20529
20540
  const hasJSDoc = hasPrecedingJSDocComment();
20530
20541
  const dotDotDotToken = parseOptionalToken(26 /* DotDotDotToken */);
20531
- const name = parseIdentifierName();
20542
+ const name = token() === 15 /* NoSubstitutionTemplateLiteral */ ? parseLiteralLikeNode(token()) : token() === 16 /* TemplateHead */ ? parseTemplateType() : parseIdentifierName();
20532
20543
  const questionToken = parseOptionalToken(58 /* QuestionToken */);
20533
20544
  parseExpected(59 /* ColonToken */);
20534
20545
  const type = parseTupleElementType();
@@ -29681,7 +29692,7 @@ var visitEachChildTable = {
29681
29692
  return context.factory.updateNamedTupleMember(
29682
29693
  node,
29683
29694
  tokenVisitor ? nodeVisitor(node.dotDotDotToken, tokenVisitor, isDotDotDotToken) : node.dotDotDotToken,
29684
- Debug.checkDefined(nodeVisitor(node.name, visitor, isIdentifier)),
29695
+ Debug.checkDefined(nodeVisitor(node.name, visitor, isNamedTupleMemberName)),
29685
29696
  tokenVisitor ? nodeVisitor(node.questionToken, tokenVisitor, isQuestionToken) : node.questionToken,
29686
29697
  Debug.checkDefined(nodeVisitor(node.type, visitor, isTypeNode))
29687
29698
  );
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.3.0-pr-54960-22",
5
+ "version": "5.3.0-pr-55452-4",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -116,5 +116,5 @@
116
116
  "node": "20.1.0",
117
117
  "npm": "8.19.4"
118
118
  },
119
- "gitHead": "f8cc24a8ac05cb2c324aee134f69db1d696a2dc7"
119
+ "gitHead": "58d231b23ea90cb6256dc152cc6c4efcb41fc2af"
120
120
  }