typescript 5.2.0-dev.20230720 → 5.2.0-dev.20230721

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-dev.20230720`;
21
+ var version = `${versionMajorMinor}.0-dev.20230721`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -17404,6 +17404,18 @@ function getTextOfJsxNamespacedName(node) {
17404
17404
  function intrinsicTagNameToString(node) {
17405
17405
  return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
17406
17406
  }
17407
+ function isTypeUsableAsPropertyName(type) {
17408
+ return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
17409
+ }
17410
+ function getPropertyNameFromType(type) {
17411
+ if (type.flags & 8192 /* UniqueESSymbol */) {
17412
+ return type.escapedName;
17413
+ }
17414
+ if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
17415
+ return escapeLeadingUnderscores("" + type.value);
17416
+ }
17417
+ return Debug.fail();
17418
+ }
17407
17419
 
17408
17420
  // src/compiler/factory/baseNodeFactory.ts
17409
17421
  function createBaseNodeFactory() {
@@ -30711,10 +30723,14 @@ var Parser;
30711
30723
  case 124 /* ProtectedKeyword */:
30712
30724
  case 125 /* PublicKeyword */:
30713
30725
  case 148 /* ReadonlyKeyword */:
30726
+ const previousToken = token();
30714
30727
  nextToken();
30715
30728
  if (scanner.hasPrecedingLineBreak()) {
30716
30729
  return false;
30717
30730
  }
30731
+ if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
30732
+ return true;
30733
+ }
30718
30734
  continue;
30719
30735
  case 162 /* GlobalKeyword */:
30720
30736
  nextToken();
@@ -31079,14 +31095,14 @@ var Parser;
31079
31095
  function parseObjectBindingPattern() {
31080
31096
  const pos = getNodePos();
31081
31097
  parseExpected(19 /* OpenBraceToken */);
31082
- const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
31098
+ const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
31083
31099
  parseExpected(20 /* CloseBraceToken */);
31084
31100
  return finishNode(factory2.createObjectBindingPattern(elements), pos);
31085
31101
  }
31086
31102
  function parseArrayBindingPattern() {
31087
31103
  const pos = getNodePos();
31088
31104
  parseExpected(23 /* OpenBracketToken */);
31089
- const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
31105
+ const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
31090
31106
  parseExpected(24 /* CloseBracketToken */);
31091
31107
  return finishNode(factory2.createArrayBindingPattern(elements), pos);
31092
31108
  }
@@ -31604,6 +31620,9 @@ var Parser;
31604
31620
  }
31605
31621
  function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
31606
31622
  parseExpected(156 /* TypeKeyword */);
31623
+ if (scanner.hasPrecedingLineBreak()) {
31624
+ parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
31625
+ }
31607
31626
  const name = parseIdentifier();
31608
31627
  const typeParameters = parseTypeParameters();
31609
31628
  parseExpected(64 /* EqualsToken */);
@@ -43111,7 +43130,7 @@ function createTypeChecker(host) {
43111
43130
  return node ? getTypeFromTypeNode(node) : errorType;
43112
43131
  },
43113
43132
  getParameterType: getTypeAtPosition,
43114
- getParameterIdentifierNameAtPosition,
43133
+ getParameterIdentifierInfoAtPosition,
43115
43134
  getPromisedTypeOfPromise,
43116
43135
  getAwaitedType: (type) => getAwaitedType(type),
43117
43136
  getReturnTypeOfSignature,
@@ -51574,7 +51593,7 @@ function createTypeChecker(host) {
51574
51593
  false,
51575
51594
  definedInMethod && !definedInConstructor
51576
51595
  ));
51577
- if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
51596
+ if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
51578
51597
  reportImplicitAny(symbol.valueDeclaration, anyType);
51579
51598
  return anyType;
51580
51599
  }
@@ -52853,9 +52872,6 @@ function createTypeChecker(host) {
52853
52872
  }
52854
52873
  return type;
52855
52874
  }
52856
- function isTypeUsableAsPropertyName(type) {
52857
- return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
52858
- }
52859
52875
  function isLateBindableName(node) {
52860
52876
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
52861
52877
  return false;
@@ -52876,15 +52892,6 @@ function createTypeChecker(host) {
52876
52892
  function isNonBindableDynamicName(node) {
52877
52893
  return isDynamicName(node) && !isLateBindableName(node);
52878
52894
  }
52879
- function getPropertyNameFromType(type) {
52880
- if (type.flags & 8192 /* UniqueESSymbol */) {
52881
- return type.escapedName;
52882
- }
52883
- if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
52884
- return escapeLeadingUnderscores("" + type.value);
52885
- }
52886
- return Debug.fail();
52887
- }
52888
52895
  function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
52889
52896
  Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
52890
52897
  symbol.flags |= symbolFlags;
@@ -53531,20 +53538,17 @@ function createTypeChecker(host) {
53531
53538
  setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
53532
53539
  return;
53533
53540
  }
53534
- let members = emptySymbols;
53541
+ let members = getExportsOfSymbol(symbol);
53535
53542
  let indexInfos;
53536
- if (symbol.exports) {
53537
- members = getExportsOfSymbol(symbol);
53538
- if (symbol === globalThisSymbol) {
53539
- const varsOnly = /* @__PURE__ */ new Map();
53540
- members.forEach((p) => {
53541
- var _a;
53542
- if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
53543
- varsOnly.set(p.escapedName, p);
53544
- }
53545
- });
53546
- members = varsOnly;
53547
- }
53543
+ if (symbol === globalThisSymbol) {
53544
+ const varsOnly = /* @__PURE__ */ new Map();
53545
+ members.forEach((p) => {
53546
+ var _a;
53547
+ if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
53548
+ varsOnly.set(p.escapedName, p);
53549
+ }
53550
+ });
53551
+ members = varsOnly;
53548
53552
  }
53549
53553
  let baseConstructorIndexInfo;
53550
53554
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
@@ -72056,7 +72060,7 @@ function createTypeChecker(host) {
72056
72060
  }
72057
72061
  return restParameter.escapedName;
72058
72062
  }
72059
- function getParameterIdentifierNameAtPosition(signature, pos) {
72063
+ function getParameterIdentifierInfoAtPosition(signature, pos) {
72060
72064
  var _a;
72061
72065
  if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
72062
72066
  return void 0;
@@ -72064,10 +72068,16 @@ function createTypeChecker(host) {
72064
72068
  const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
72065
72069
  if (pos < paramCount) {
72066
72070
  const param = signature.parameters[pos];
72067
- return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : void 0;
72071
+ const paramIdent = getParameterDeclarationIdentifier(param);
72072
+ return paramIdent ? {
72073
+ parameter: paramIdent,
72074
+ parameterName: param.escapedName,
72075
+ isRestParameter: false
72076
+ } : void 0;
72068
72077
  }
72069
72078
  const restParameter = signature.parameters[paramCount] || unknownSymbol;
72070
- if (!isParameterDeclarationWithIdentifierName(restParameter)) {
72079
+ const restIdent = getParameterDeclarationIdentifier(restParameter);
72080
+ if (!restIdent) {
72071
72081
  return void 0;
72072
72082
  }
72073
72083
  const restType = getTypeOfSymbol(restParameter);
@@ -72076,18 +72086,19 @@ function createTypeChecker(host) {
72076
72086
  const index = pos - paramCount;
72077
72087
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
72078
72088
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
72079
- return associatedName ? [
72080
- getTupleElementLabel(associatedName),
72081
- isRestTupleElement
72082
- ] : void 0;
72089
+ if (associatedName) {
72090
+ Debug.assert(isIdentifier(associatedName.name));
72091
+ return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
72092
+ }
72093
+ return void 0;
72083
72094
  }
72084
72095
  if (pos === paramCount) {
72085
- return [restParameter.escapedName, true];
72096
+ return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
72086
72097
  }
72087
72098
  return void 0;
72088
72099
  }
72089
- function isParameterDeclarationWithIdentifierName(symbol) {
72090
- return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
72100
+ function getParameterDeclarationIdentifier(symbol) {
72101
+ return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
72091
72102
  }
72092
72103
  function isValidDeclarationForTupleLabel(d) {
72093
72104
  return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
package/lib/tsserver.js CHANGED
@@ -970,6 +970,7 @@ __export(server_exports, {
970
970
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
971
971
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
972
972
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
973
+ getPropertyNameFromType: () => getPropertyNameFromType,
973
974
  getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
974
975
  getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
975
976
  getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
@@ -1802,6 +1803,7 @@ __export(server_exports, {
1802
1803
  isTypeQueryNode: () => isTypeQueryNode,
1803
1804
  isTypeReferenceNode: () => isTypeReferenceNode,
1804
1805
  isTypeReferenceType: () => isTypeReferenceType,
1806
+ isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
1805
1807
  isUMDExportSymbol: () => isUMDExportSymbol,
1806
1808
  isUnaryExpression: () => isUnaryExpression,
1807
1809
  isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
@@ -2327,7 +2329,7 @@ module.exports = __toCommonJS(server_exports);
2327
2329
 
2328
2330
  // src/compiler/corePublic.ts
2329
2331
  var versionMajorMinor = "5.2";
2330
- var version = `${versionMajorMinor}.0-dev.20230720`;
2332
+ var version = `${versionMajorMinor}.0-dev.20230721`;
2331
2333
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2332
2334
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2333
2335
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -21601,6 +21603,18 @@ function getTextOfJsxNamespacedName(node) {
21601
21603
  function intrinsicTagNameToString(node) {
21602
21604
  return isIdentifier(node) ? idText(node) : getTextOfJsxNamespacedName(node);
21603
21605
  }
21606
+ function isTypeUsableAsPropertyName(type) {
21607
+ return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
21608
+ }
21609
+ function getPropertyNameFromType(type) {
21610
+ if (type.flags & 8192 /* UniqueESSymbol */) {
21611
+ return type.escapedName;
21612
+ }
21613
+ if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
21614
+ return escapeLeadingUnderscores("" + type.value);
21615
+ }
21616
+ return Debug.fail();
21617
+ }
21604
21618
 
21605
21619
  // src/compiler/factory/baseNodeFactory.ts
21606
21620
  function createBaseNodeFactory() {
@@ -35109,10 +35123,14 @@ var Parser;
35109
35123
  case 124 /* ProtectedKeyword */:
35110
35124
  case 125 /* PublicKeyword */:
35111
35125
  case 148 /* ReadonlyKeyword */:
35126
+ const previousToken = token();
35112
35127
  nextToken();
35113
35128
  if (scanner2.hasPrecedingLineBreak()) {
35114
35129
  return false;
35115
35130
  }
35131
+ if (previousToken === 138 /* DeclareKeyword */ && token() === 156 /* TypeKeyword */) {
35132
+ return true;
35133
+ }
35116
35134
  continue;
35117
35135
  case 162 /* GlobalKeyword */:
35118
35136
  nextToken();
@@ -35477,14 +35495,14 @@ var Parser;
35477
35495
  function parseObjectBindingPattern() {
35478
35496
  const pos = getNodePos();
35479
35497
  parseExpected(19 /* OpenBraceToken */);
35480
- const elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
35498
+ const elements = allowInAnd(() => parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement));
35481
35499
  parseExpected(20 /* CloseBraceToken */);
35482
35500
  return finishNode(factory2.createObjectBindingPattern(elements), pos);
35483
35501
  }
35484
35502
  function parseArrayBindingPattern() {
35485
35503
  const pos = getNodePos();
35486
35504
  parseExpected(23 /* OpenBracketToken */);
35487
- const elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
35505
+ const elements = allowInAnd(() => parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement));
35488
35506
  parseExpected(24 /* CloseBracketToken */);
35489
35507
  return finishNode(factory2.createArrayBindingPattern(elements), pos);
35490
35508
  }
@@ -36002,6 +36020,9 @@ var Parser;
36002
36020
  }
36003
36021
  function parseTypeAliasDeclaration(pos, hasJSDoc, modifiers) {
36004
36022
  parseExpected(156 /* TypeKeyword */);
36023
+ if (scanner2.hasPrecedingLineBreak()) {
36024
+ parseErrorAtCurrentToken(Diagnostics.Line_break_not_permitted_here);
36025
+ }
36005
36026
  const name = parseIdentifier();
36006
36027
  const typeParameters = parseTypeParameters();
36007
36028
  parseExpected(64 /* EqualsToken */);
@@ -47818,7 +47839,7 @@ function createTypeChecker(host) {
47818
47839
  return node ? getTypeFromTypeNode(node) : errorType;
47819
47840
  },
47820
47841
  getParameterType: getTypeAtPosition,
47821
- getParameterIdentifierNameAtPosition,
47842
+ getParameterIdentifierInfoAtPosition,
47822
47843
  getPromisedTypeOfPromise,
47823
47844
  getAwaitedType: (type) => getAwaitedType(type),
47824
47845
  getReturnTypeOfSignature,
@@ -56281,7 +56302,7 @@ function createTypeChecker(host) {
56281
56302
  false,
56282
56303
  definedInMethod && !definedInConstructor
56283
56304
  ));
56284
- if (symbol.valueDeclaration && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
56305
+ if (symbol.valueDeclaration && isInJSFile(symbol.valueDeclaration) && filterType(widened, (t) => !!(t.flags & ~98304 /* Nullable */)) === neverType) {
56285
56306
  reportImplicitAny(symbol.valueDeclaration, anyType);
56286
56307
  return anyType;
56287
56308
  }
@@ -57560,9 +57581,6 @@ function createTypeChecker(host) {
57560
57581
  }
57561
57582
  return type;
57562
57583
  }
57563
- function isTypeUsableAsPropertyName(type) {
57564
- return !!(type.flags & 8576 /* StringOrNumberLiteralOrUnique */);
57565
- }
57566
57584
  function isLateBindableName(node) {
57567
57585
  if (!isComputedPropertyName(node) && !isElementAccessExpression(node)) {
57568
57586
  return false;
@@ -57583,15 +57601,6 @@ function createTypeChecker(host) {
57583
57601
  function isNonBindableDynamicName(node) {
57584
57602
  return isDynamicName(node) && !isLateBindableName(node);
57585
57603
  }
57586
- function getPropertyNameFromType(type) {
57587
- if (type.flags & 8192 /* UniqueESSymbol */) {
57588
- return type.escapedName;
57589
- }
57590
- if (type.flags & (128 /* StringLiteral */ | 256 /* NumberLiteral */)) {
57591
- return escapeLeadingUnderscores("" + type.value);
57592
- }
57593
- return Debug.fail();
57594
- }
57595
57604
  function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
57596
57605
  Debug.assert(!!(getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
57597
57606
  symbol.flags |= symbolFlags;
@@ -58238,20 +58247,17 @@ function createTypeChecker(host) {
58238
58247
  setStructuredTypeMembers(type, members2, callSignatures, constructSignatures, indexInfos2);
58239
58248
  return;
58240
58249
  }
58241
- let members = emptySymbols;
58250
+ let members = getExportsOfSymbol(symbol);
58242
58251
  let indexInfos;
58243
- if (symbol.exports) {
58244
- members = getExportsOfSymbol(symbol);
58245
- if (symbol === globalThisSymbol) {
58246
- const varsOnly = /* @__PURE__ */ new Map();
58247
- members.forEach((p) => {
58248
- var _a;
58249
- if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
58250
- varsOnly.set(p.escapedName, p);
58251
- }
58252
- });
58253
- members = varsOnly;
58254
- }
58252
+ if (symbol === globalThisSymbol) {
58253
+ const varsOnly = /* @__PURE__ */ new Map();
58254
+ members.forEach((p) => {
58255
+ var _a;
58256
+ if (!(p.flags & 418 /* BlockScoped */) && !(p.flags & 512 /* ValueModule */ && ((_a = p.declarations) == null ? void 0 : _a.length) && every(p.declarations, isAmbientModule))) {
58257
+ varsOnly.set(p.escapedName, p);
58258
+ }
58259
+ });
58260
+ members = varsOnly;
58255
58261
  }
58256
58262
  let baseConstructorIndexInfo;
58257
58263
  setStructuredTypeMembers(type, members, emptyArray, emptyArray, emptyArray);
@@ -76763,7 +76769,7 @@ function createTypeChecker(host) {
76763
76769
  }
76764
76770
  return restParameter.escapedName;
76765
76771
  }
76766
- function getParameterIdentifierNameAtPosition(signature, pos) {
76772
+ function getParameterIdentifierInfoAtPosition(signature, pos) {
76767
76773
  var _a;
76768
76774
  if (((_a = signature.declaration) == null ? void 0 : _a.kind) === 324 /* JSDocFunctionType */) {
76769
76775
  return void 0;
@@ -76771,10 +76777,16 @@ function createTypeChecker(host) {
76771
76777
  const paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0);
76772
76778
  if (pos < paramCount) {
76773
76779
  const param = signature.parameters[pos];
76774
- return isParameterDeclarationWithIdentifierName(param) ? [param.escapedName, false] : void 0;
76780
+ const paramIdent = getParameterDeclarationIdentifier(param);
76781
+ return paramIdent ? {
76782
+ parameter: paramIdent,
76783
+ parameterName: param.escapedName,
76784
+ isRestParameter: false
76785
+ } : void 0;
76775
76786
  }
76776
76787
  const restParameter = signature.parameters[paramCount] || unknownSymbol;
76777
- if (!isParameterDeclarationWithIdentifierName(restParameter)) {
76788
+ const restIdent = getParameterDeclarationIdentifier(restParameter);
76789
+ if (!restIdent) {
76778
76790
  return void 0;
76779
76791
  }
76780
76792
  const restType = getTypeOfSymbol(restParameter);
@@ -76783,18 +76795,19 @@ function createTypeChecker(host) {
76783
76795
  const index = pos - paramCount;
76784
76796
  const associatedName = associatedNames == null ? void 0 : associatedNames[index];
76785
76797
  const isRestTupleElement = !!(associatedName == null ? void 0 : associatedName.dotDotDotToken);
76786
- return associatedName ? [
76787
- getTupleElementLabel(associatedName),
76788
- isRestTupleElement
76789
- ] : void 0;
76798
+ if (associatedName) {
76799
+ Debug.assert(isIdentifier(associatedName.name));
76800
+ return { parameter: associatedName.name, parameterName: associatedName.name.escapedText, isRestParameter: isRestTupleElement };
76801
+ }
76802
+ return void 0;
76790
76803
  }
76791
76804
  if (pos === paramCount) {
76792
- return [restParameter.escapedName, true];
76805
+ return { parameter: restIdent, parameterName: restParameter.escapedName, isRestParameter: true };
76793
76806
  }
76794
76807
  return void 0;
76795
76808
  }
76796
- function isParameterDeclarationWithIdentifierName(symbol) {
76797
- return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name);
76809
+ function getParameterDeclarationIdentifier(symbol) {
76810
+ return symbol.valueDeclaration && isParameter(symbol.valueDeclaration) && isIdentifier(symbol.valueDeclaration.name) && symbol.valueDeclaration.name;
76798
76811
  }
76799
76812
  function isValidDeclarationForTupleLabel(d) {
76800
76813
  return d.kind === 202 /* NamedTupleMember */ || isParameter(d) && d.name && isIdentifier(d.name);
@@ -155122,15 +155135,11 @@ var PreserveOptionalFlags = /* @__PURE__ */ ((PreserveOptionalFlags2) => {
155122
155135
  })(PreserveOptionalFlags || {});
155123
155136
  function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional = 3 /* All */, isAmbient = false) {
155124
155137
  const declarations = symbol.getDeclarations();
155125
- const declaration = declarations == null ? void 0 : declarations[0];
155138
+ const declaration = firstOrUndefined(declarations);
155126
155139
  const checker = context.program.getTypeChecker();
155127
155140
  const scriptTarget = getEmitScriptTarget(context.program.getCompilerOptions());
155128
155141
  const kind = (declaration == null ? void 0 : declaration.kind) ?? 171 /* PropertySignature */;
155129
- const declarationName = getSynthesizedDeepClone(
155130
- getNameOfDeclaration(declaration),
155131
- /*includeTrivia*/
155132
- false
155133
- );
155142
+ const declarationName = createDeclarationName(symbol, declaration);
155134
155143
  const effectiveModifierFlags = declaration ? getEffectiveModifierFlags(declaration) : 0 /* None */;
155135
155144
  let modifierFlags = effectiveModifierFlags & 32 /* Static */;
155136
155145
  modifierFlags |= effectiveModifierFlags & 4 /* Public */ ? 4 /* Public */ : effectiveModifierFlags & 16 /* Protected */ ? 16 /* Protected */ : 0 /* None */;
@@ -155281,6 +155290,19 @@ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, con
155281
155290
  false
155282
155291
  );
155283
155292
  }
155293
+ function createDeclarationName(symbol2, declaration2) {
155294
+ if (getCheckFlags(symbol2) & 262144 /* Mapped */) {
155295
+ const nameType = symbol2.links.nameType;
155296
+ if (nameType && isTypeUsableAsPropertyName(nameType)) {
155297
+ return factory.createIdentifier(unescapeLeadingUnderscores(getPropertyNameFromType(nameType)));
155298
+ }
155299
+ }
155300
+ return getSynthesizedDeepClone(
155301
+ getNameOfDeclaration(declaration2),
155302
+ /*includeTrivia*/
155303
+ false
155304
+ );
155305
+ }
155284
155306
  }
155285
155307
  function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
155286
155308
  const program = context.program;
@@ -164498,7 +164520,7 @@ __export(ts_InlayHints_exports, {
164498
164520
  });
164499
164521
 
164500
164522
  // src/services/inlayHints.ts
164501
- var maxHintsLength = 30;
164523
+ var maxTypeHintLength = 30;
164502
164524
  var leadingParameterNameCommentRegexFactory = (name) => {
164503
164525
  return new RegExp(`^\\s?/\\*\\*?\\s?${name}\\s?\\*\\/\\s?$`);
164504
164526
  };
@@ -164508,6 +164530,9 @@ function shouldShowParameterNameHints(preferences) {
164508
164530
  function shouldShowLiteralParameterNameHintsOnly(preferences) {
164509
164531
  return preferences.includeInlayParameterNameHints === "literals";
164510
164532
  }
164533
+ function shouldUseInteractiveInlayHints(preferences) {
164534
+ return preferences.interactiveInlayHints === true;
164535
+ }
164511
164536
  function provideInlayHints(context) {
164512
164537
  const { file, program, span, cancellationToken, preferences } = context;
164513
164538
  const sourceFileText = file.text;
@@ -164558,9 +164583,15 @@ function provideInlayHints(context) {
164558
164583
  function isSignatureSupportingReturnAnnotation(node) {
164559
164584
  return isArrowFunction(node) || isFunctionExpression(node) || isFunctionDeclaration(node) || isMethodDeclaration(node) || isGetAccessorDeclaration(node);
164560
164585
  }
164561
- function addParameterHints(text, position, isFirstVariadicArgument) {
164586
+ function addParameterHints(text, parameter, position, isFirstVariadicArgument, sourceFile) {
164587
+ let hintText = `${isFirstVariadicArgument ? "..." : ""}${text}`;
164588
+ if (shouldUseInteractiveInlayHints(preferences)) {
164589
+ hintText = [getNodeDisplayPart(hintText, parameter, sourceFile), { text: ":" }];
164590
+ } else {
164591
+ hintText += ":";
164592
+ }
164562
164593
  result.push({
164563
- text: `${isFirstVariadicArgument ? "..." : ""}${truncation(text, maxHintsLength)}:`,
164594
+ text: hintText,
164564
164595
  position,
164565
164596
  kind: "Parameter" /* Parameter */,
164566
164597
  whitespaceAfter: true
@@ -164568,7 +164599,7 @@ function provideInlayHints(context) {
164568
164599
  }
164569
164600
  function addTypeHints(text, position) {
164570
164601
  result.push({
164571
- text: `: ${truncation(text, maxHintsLength)}`,
164602
+ text: `: ${text.length > maxTypeHintLength ? text.substr(0, maxTypeHintLength - "...".length) + "..." : text}`,
164572
164603
  position,
164573
164604
  kind: "Type" /* Type */,
164574
164605
  whitespaceBefore: true
@@ -164576,7 +164607,7 @@ function provideInlayHints(context) {
164576
164607
  }
164577
164608
  function addEnumMemberValueHints(text, position) {
164578
164609
  result.push({
164579
- text: `= ${truncation(text, maxHintsLength)}`,
164610
+ text: `= ${text}`,
164580
164611
  position,
164581
164612
  kind: "Enum" /* Enum */,
164582
164613
  whitespaceBefore: true
@@ -164626,6 +164657,7 @@ function provideInlayHints(context) {
164626
164657
  return;
164627
164658
  }
164628
164659
  let signatureParamPos = 0;
164660
+ const sourceFile = shouldUseInteractiveInlayHints(preferences) ? expr.getSourceFile() : void 0;
164629
164661
  for (const originalArg of args) {
164630
164662
  const arg = skipParentheses(originalArg);
164631
164663
  if (shouldShowLiteralParameterNameHintsOnly(preferences) && !isHintableLiteral(arg)) {
@@ -164646,10 +164678,10 @@ function provideInlayHints(context) {
164646
164678
  }
164647
164679
  }
164648
164680
  }
164649
- const identifierNameInfo = checker.getParameterIdentifierNameAtPosition(signature, signatureParamPos);
164681
+ const identifierInfo = checker.getParameterIdentifierInfoAtPosition(signature, signatureParamPos);
164650
164682
  signatureParamPos = signatureParamPos + (spreadArgs || 1);
164651
- if (identifierNameInfo) {
164652
- const [parameterName, isFirstVariadicArgument] = identifierNameInfo;
164683
+ if (identifierInfo) {
164684
+ const { parameter, parameterName, isRestParameter: isFirstVariadicArgument } = identifierInfo;
164653
164685
  const isParameterNameNotSameAsArgument = preferences.includeInlayParameterNameHintsWhenArgumentMatchesName || !identifierOrAccessExpressionPostfixMatchesParameterName(arg, parameterName);
164654
164686
  if (!isParameterNameNotSameAsArgument && !isFirstVariadicArgument) {
164655
164687
  continue;
@@ -164658,7 +164690,7 @@ function provideInlayHints(context) {
164658
164690
  if (leadingCommentsContainsParameterName(arg, name)) {
164659
164691
  continue;
164660
164692
  }
164661
- addParameterHints(name, originalArg.getStart(), isFirstVariadicArgument);
164693
+ addParameterHints(name, parameter, originalArg.getStart(), isFirstVariadicArgument, sourceFile);
164662
164694
  }
164663
164695
  }
164664
164696
  }
@@ -164764,12 +164796,6 @@ function provideInlayHints(context) {
164764
164796
  }
164765
164797
  return printTypeInSingleLine(signatureParamType);
164766
164798
  }
164767
- function truncation(text, maxLength2) {
164768
- if (text.length > maxLength2) {
164769
- return text.substr(0, maxLength2 - "...".length) + "...";
164770
- }
164771
- return text;
164772
- }
164773
164799
  function printTypeInSingleLine(type) {
164774
164800
  const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
164775
164801
  const printer = createPrinterWithRemoveComments();
@@ -164800,6 +164826,13 @@ function provideInlayHints(context) {
164800
164826
  }
164801
164827
  return true;
164802
164828
  }
164829
+ function getNodeDisplayPart(text, node, sourceFile) {
164830
+ return {
164831
+ text,
164832
+ span: createTextSpanFromNode(node, sourceFile),
164833
+ file: sourceFile.fileName
164834
+ };
164835
+ }
164803
164836
  }
164804
164837
 
164805
164838
  // src/services/_namespaces/ts.JsDoc.ts
@@ -167219,7 +167252,7 @@ function getSymbolModifiers(typeChecker, symbol) {
167219
167252
  }
167220
167253
  return modifiers.size > 0 ? arrayFrom(modifiers.values()).join(",") : "" /* none */;
167221
167254
  }
167222
- function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
167255
+ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symbol, sourceFile, enclosingDeclaration, location, type, semanticMeaning, alias) {
167223
167256
  var _a;
167224
167257
  const displayParts = [];
167225
167258
  let documentation = [];
@@ -167228,7 +167261,6 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
167228
167261
  let symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
167229
167262
  let hasAddedSymbolInfo = false;
167230
167263
  const isThisExpression = location.kind === 110 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
167231
- let type;
167232
167264
  let documentationFromAlias;
167233
167265
  let tagsFromAlias;
167234
167266
  let hasMultipleSignatures = false;
@@ -167257,7 +167289,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
167257
167289
  }
167258
167290
  }
167259
167291
  let signature;
167260
- type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
167292
+ type ?? (type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location));
167261
167293
  if (location.parent && location.parent.kind === 211 /* PropertyAccessExpression */) {
167262
167294
  const right = location.parent.name;
167263
167295
  if (right === location || right && right.getFullWidth() === 0) {
@@ -167472,12 +167504,13 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
167472
167504
  if (declarationName && !hasAddedSymbolInfo) {
167473
167505
  const isExternalModuleDeclaration = isModuleWithStringLiteralName(resolvedNode) && hasSyntacticModifier(resolvedNode, 2 /* Ambient */);
167474
167506
  const shouldUseAliasName = symbol.name !== "default" && !isExternalModuleDeclaration;
167475
- const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKind(
167507
+ const resolvedInfo = getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
167476
167508
  typeChecker,
167477
167509
  resolvedSymbol,
167478
167510
  getSourceFileOfNode(resolvedNode),
167479
167511
  resolvedNode,
167480
167512
  declarationName,
167513
+ type,
167481
167514
  semanticMeaning,
167482
167515
  shouldUseAliasName ? symbol : resolvedSymbol
167483
167516
  );
@@ -167732,6 +167765,19 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
167732
167765
  addRange(displayParts, typeParameterParts);
167733
167766
  }
167734
167767
  }
167768
+ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning = getMeaningFromLocation(location), alias) {
167769
+ return getSymbolDisplayPartsDocumentationAndSymbolKindWorker(
167770
+ typeChecker,
167771
+ symbol,
167772
+ sourceFile,
167773
+ enclosingDeclaration,
167774
+ location,
167775
+ /*type*/
167776
+ void 0,
167777
+ semanticMeaning,
167778
+ alias
167779
+ );
167780
+ }
167735
167781
  function isLocalVariableOrFunction(symbol) {
167736
167782
  if (symbol.parent) {
167737
167783
  return false;
@@ -172741,6 +172787,7 @@ __export(ts_exports2, {
172741
172787
  getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
172742
172788
  getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
172743
172789
  getPropertyNameForUniqueESSymbol: () => getPropertyNameForUniqueESSymbol,
172790
+ getPropertyNameFromType: () => getPropertyNameFromType,
172744
172791
  getPropertyNameOfBindingOrAssignmentElement: () => getPropertyNameOfBindingOrAssignmentElement,
172745
172792
  getPropertySymbolFromBindingElement: () => getPropertySymbolFromBindingElement,
172746
172793
  getPropertySymbolsFromContextualType: () => getPropertySymbolsFromContextualType,
@@ -173573,6 +173620,7 @@ __export(ts_exports2, {
173573
173620
  isTypeQueryNode: () => isTypeQueryNode,
173574
173621
  isTypeReferenceNode: () => isTypeReferenceNode,
173575
173622
  isTypeReferenceType: () => isTypeReferenceType,
173623
+ isTypeUsableAsPropertyName: () => isTypeUsableAsPropertyName,
173576
173624
  isUMDExportSymbol: () => isUMDExportSymbol,
173577
173625
  isUnaryExpression: () => isUnaryExpression,
173578
173626
  isUnaryExpressionWithWrite: () => isUnaryExpressionWithWrite,
@@ -183431,10 +183479,22 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
183431
183479
  const { file, project } = this.getFileAndProject(args);
183432
183480
  const scriptInfo = this.projectService.getScriptInfoForNormalizedPath(file);
183433
183481
  const hints = project.getLanguageService().provideInlayHints(file, args, this.getPreferences(file));
183434
- return hints.map((hint) => ({
183435
- ...hint,
183436
- position: scriptInfo.positionToLineOffset(hint.position)
183437
- }));
183482
+ return hints.map((hint) => {
183483
+ const { text, position } = hint;
183484
+ const hintText = typeof text === "string" ? text : text.map(({ text: text2, span, file: file2 }) => ({
183485
+ text: text2,
183486
+ span: span && {
183487
+ start: scriptInfo.positionToLineOffset(span.start),
183488
+ end: scriptInfo.positionToLineOffset(span.start + span.length),
183489
+ file: file2
183490
+ }
183491
+ }));
183492
+ return {
183493
+ ...hint,
183494
+ position: scriptInfo.positionToLineOffset(position),
183495
+ text: hintText
183496
+ };
183497
+ });
183438
183498
  }
183439
183499
  setCompilerOptionsForInferredProjects(args) {
183440
183500
  this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath);
@@ -187255,6 +187315,7 @@ start(initializeNodeSystem(), require("os").platform());
187255
187315
  getPropertyAssignmentAliasLikeExpression,
187256
187316
  getPropertyNameForPropertyNameNode,
187257
187317
  getPropertyNameForUniqueESSymbol,
187318
+ getPropertyNameFromType,
187258
187319
  getPropertyNameOfBindingOrAssignmentElement,
187259
187320
  getPropertySymbolFromBindingElement,
187260
187321
  getPropertySymbolsFromContextualType,
@@ -188087,6 +188148,7 @@ start(initializeNodeSystem(), require("os").platform());
188087
188148
  isTypeQueryNode,
188088
188149
  isTypeReferenceNode,
188089
188150
  isTypeReferenceType,
188151
+ isTypeUsableAsPropertyName,
188090
188152
  isUMDExportSymbol,
188091
188153
  isUnaryExpression,
188092
188154
  isUnaryExpressionWithWrite,