typescript 4.6.0-dev.20220125 → 4.6.0-dev.20220126

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
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
69
69
  var ts;
70
70
  (function (ts) {
71
71
  ts.versionMajorMinor = "4.6";
72
- ts.version = ts.versionMajorMinor + ".0-dev.20220125";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220126";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
75
  var globals = typeof globalThis !== "undefined" ? globalThis :
@@ -10673,10 +10673,13 @@ var ts;
10673
10673
  function packageIdIsEqual(a, b) {
10674
10674
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
10675
10675
  }
10676
- function packageIdToString(_a) {
10677
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
10678
- var fullName = subModuleName ? name + "/" + subModuleName : name;
10679
- return fullName + "@" + version;
10676
+ function packageIdToPackageName(_a) {
10677
+ var name = _a.name, subModuleName = _a.subModuleName;
10678
+ return subModuleName ? name + "/" + subModuleName : name;
10679
+ }
10680
+ ts.packageIdToPackageName = packageIdToPackageName;
10681
+ function packageIdToString(packageId) {
10682
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
10680
10683
  }
10681
10684
  ts.packageIdToString = packageIdToString;
10682
10685
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -11562,7 +11565,8 @@ var ts;
11562
11565
  node.kind === 212 ||
11563
11566
  node.kind === 213 ||
11564
11567
  node.kind === 211 ||
11565
- node.kind === 253) ?
11568
+ node.kind === 253 ||
11569
+ node.kind === 274) ?
11566
11570
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
11567
11571
  ts.getLeadingCommentRanges(text, node.pos);
11568
11572
  return ts.filter(commentRanges, function (comment) {
@@ -29199,7 +29203,8 @@ var ts;
29199
29203
  return finishNode(node, pos);
29200
29204
  }
29201
29205
  function parseExportSpecifier() {
29202
- return parseImportOrExportSpecifier(274);
29206
+ var hasJSDoc = hasPrecedingJSDocComment();
29207
+ return withJSDoc(parseImportOrExportSpecifier(274), hasJSDoc);
29203
29208
  }
29204
29209
  function parseImportSpecifier() {
29205
29210
  return parseImportOrExportSpecifier(269);
@@ -35498,14 +35503,12 @@ var ts;
35498
35503
  }
35499
35504
  var binder = createBinder();
35500
35505
  function bindSourceFile(file, options) {
35501
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35502
35506
  ts.performance.mark("beforeBind");
35503
35507
  ts.perfLogger.logStartBindFile("" + file.fileName);
35504
35508
  binder(file, options);
35505
35509
  ts.perfLogger.logStopBindFile();
35506
35510
  ts.performance.mark("afterBind");
35507
35511
  ts.performance.measure("Bind", "beforeBind", "afterBind");
35508
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35509
35512
  }
35510
35513
  ts.bindSourceFile = bindSourceFile;
35511
35514
  function createBinder() {
@@ -35552,7 +35555,9 @@ var ts;
35552
35555
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
35553
35556
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
35554
35557
  if (!file.locals) {
35558
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35555
35559
  bind(file);
35560
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35556
35561
  file.symbolCount = symbolCount;
35557
35562
  file.classifiableNames = classifiableNames;
35558
35563
  delayedBindJSDocTypedefTag();
@@ -39141,6 +39146,9 @@ var ts;
39141
39146
  suggestionDiagnostics.add(diagnostic);
39142
39147
  return diagnostic;
39143
39148
  }
39149
+ function isDeprecatedSymbol(symbol) {
39150
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39151
+ }
39144
39152
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39145
39153
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
39146
39154
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -50266,7 +50274,7 @@ var ts;
50266
50274
  }
50267
50275
  var prop = getPropertyOfType(objectType, propName);
50268
50276
  if (prop) {
50269
- if (accessFlags & 64 && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(accessNode, prop)) {
50277
+ if (accessFlags & 64 && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
50270
50278
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
50271
50279
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
50272
50280
  }
@@ -58416,9 +58424,9 @@ var ts;
58416
58424
  markAliasReferenced(symbol, node);
58417
58425
  }
58418
58426
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
58419
- var sourceSymbol = localOrExportSymbol.flags & 2097152 ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
58420
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 && isUncalledFunctionReference(node, sourceSymbol)) {
58421
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
58427
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
58428
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
58429
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
58422
58430
  }
58423
58431
  var declaration = localOrExportSymbol.valueDeclaration;
58424
58432
  if (declaration && localOrExportSymbol.flags & 32) {
@@ -60950,7 +60958,7 @@ var ts;
60950
60958
  }
60951
60959
  }
60952
60960
  else {
60953
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(node, prop)) {
60961
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
60954
60962
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
60955
60963
  }
60956
60964
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -69635,7 +69643,6 @@ var ts;
69635
69643
  return true;
69636
69644
  }
69637
69645
  function checkAliasSymbol(node) {
69638
- var _a;
69639
69646
  var symbol = getSymbolOfNode(node);
69640
69647
  var target = resolveAlias(symbol);
69641
69648
  if (target !== unknownSymbol) {
@@ -69682,10 +69689,45 @@ var ts;
69682
69689
  }
69683
69690
  }
69684
69691
  }
69685
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); }))) {
69686
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
69692
+ if (ts.isImportSpecifier(node)) {
69693
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
69694
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
69695
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
69696
+ }
69697
+ }
69698
+ }
69699
+ }
69700
+ function isDeprecatedAliasedSymbol(symbol) {
69701
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); });
69702
+ }
69703
+ function checkDeprecatedAliasedSymbol(symbol, location) {
69704
+ if (!(symbol.flags & 2097152))
69705
+ return symbol;
69706
+ var targetSymbol = resolveAlias(symbol);
69707
+ if (targetSymbol === unknownSymbol)
69708
+ return targetSymbol;
69709
+ while (symbol.flags & 2097152) {
69710
+ var target = getImmediateAliasedSymbol(symbol);
69711
+ if (target) {
69712
+ if (target === targetSymbol)
69713
+ break;
69714
+ if (target.declarations && ts.length(target.declarations)) {
69715
+ if (isDeprecatedAliasedSymbol(target)) {
69716
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
69717
+ break;
69718
+ }
69719
+ else {
69720
+ if (symbol === targetSymbol)
69721
+ break;
69722
+ symbol = target;
69723
+ }
69724
+ }
69725
+ }
69726
+ else {
69727
+ break;
69687
69728
  }
69688
69729
  }
69730
+ return targetSymbol;
69689
69731
  }
69690
69732
  function checkImportBinding(node) {
69691
69733
  checkCollisionsForDeclarationName(node, node.name);
@@ -95580,13 +95622,13 @@ var ts;
95580
95622
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
95581
95623
  addFileToFilesByName(dupFile, path, redirectedPath);
95582
95624
  addFileIncludeReason(dupFile, reason);
95583
- sourceFileToPackageName.set(path, packageId.name);
95625
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95584
95626
  processingOtherFiles.push(dupFile);
95585
95627
  return dupFile;
95586
95628
  }
95587
95629
  else if (file) {
95588
95630
  packageIdToSourceFile.set(packageIdKey, file);
95589
- sourceFileToPackageName.set(path, packageId.name);
95631
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95590
95632
  }
95591
95633
  }
95592
95634
  addFileToFilesByName(file, path, redirectedPath);
package/lib/tsserver.js CHANGED
@@ -100,7 +100,7 @@ var ts;
100
100
  // The following is baselined as a literal template type without intervention
101
101
  /** The version of the TypeScript compiler release */
102
102
  // eslint-disable-next-line @typescript-eslint/no-inferrable-types
103
- ts.version = ts.versionMajorMinor + ".0-dev.20220125";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220126";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -14063,10 +14063,13 @@ var ts;
14063
14063
  function packageIdIsEqual(a, b) {
14064
14064
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14065
14065
  }
14066
- function packageIdToString(_a) {
14067
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14068
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14069
- return fullName + "@" + version;
14066
+ function packageIdToPackageName(_a) {
14067
+ var name = _a.name, subModuleName = _a.subModuleName;
14068
+ return subModuleName ? name + "/" + subModuleName : name;
14069
+ }
14070
+ ts.packageIdToPackageName = packageIdToPackageName;
14071
+ function packageIdToString(packageId) {
14072
+ return packageIdToPackageName(packageId) + "@" + packageId.version;
14070
14073
  }
14071
14074
  ts.packageIdToString = packageIdToString;
14072
14075
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -15067,7 +15070,8 @@ var ts;
15067
15070
  node.kind === 212 /* FunctionExpression */ ||
15068
15071
  node.kind === 213 /* ArrowFunction */ ||
15069
15072
  node.kind === 211 /* ParenthesizedExpression */ ||
15070
- node.kind === 253 /* VariableDeclaration */) ?
15073
+ node.kind === 253 /* VariableDeclaration */ ||
15074
+ node.kind === 274 /* ExportSpecifier */) ?
15071
15075
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15072
15076
  ts.getLeadingCommentRanges(text, node.pos);
15073
15077
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -36218,7 +36222,8 @@ var ts;
36218
36222
  return finishNode(node, pos);
36219
36223
  }
36220
36224
  function parseExportSpecifier() {
36221
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36225
+ var hasJSDoc = hasPrecedingJSDocComment();
36226
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36222
36227
  }
36223
36228
  function parseImportSpecifier() {
36224
36229
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43423,14 +43428,12 @@ var ts;
43423
43428
  }
43424
43429
  var binder = createBinder();
43425
43430
  function bindSourceFile(file, options) {
43426
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43427
43431
  ts.performance.mark("beforeBind");
43428
43432
  ts.perfLogger.logStartBindFile("" + file.fileName);
43429
43433
  binder(file, options);
43430
43434
  ts.perfLogger.logStopBindFile();
43431
43435
  ts.performance.mark("afterBind");
43432
43436
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43433
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43434
43437
  }
43435
43438
  ts.bindSourceFile = bindSourceFile;
43436
43439
  function createBinder() {
@@ -43490,7 +43493,9 @@ var ts;
43490
43493
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43491
43494
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43492
43495
  if (!file.locals) {
43496
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43493
43497
  bind(file);
43498
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43494
43499
  file.symbolCount = symbolCount;
43495
43500
  file.classifiableNames = classifiableNames;
43496
43501
  delayedBindJSDocTypedefTag();
@@ -47757,6 +47762,9 @@ var ts;
47757
47762
  suggestionDiagnostics.add(diagnostic);
47758
47763
  return diagnostic;
47759
47764
  }
47765
+ function isDeprecatedSymbol(symbol) {
47766
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47767
+ }
47760
47768
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47761
47769
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47762
47770
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -60543,7 +60551,7 @@ var ts;
60543
60551
  }
60544
60552
  var prop = getPropertyOfType(objectType, propName);
60545
60553
  if (prop) {
60546
- if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(accessNode, prop)) {
60554
+ if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
60547
60555
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60548
60556
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60549
60557
  }
@@ -69946,9 +69954,9 @@ var ts;
69946
69954
  markAliasReferenced(symbol, node);
69947
69955
  }
69948
69956
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69949
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
69950
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
69951
- addDeprecatedSuggestion(node, sourceSymbol.declarations, node.escapedText);
69957
+ var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
69958
+ if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
69959
+ addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
69952
69960
  }
69953
69961
  var declaration = localOrExportSymbol.valueDeclaration;
69954
69962
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -72960,7 +72968,7 @@ var ts;
72960
72968
  }
72961
72969
  }
72962
72970
  else {
72963
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
72971
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
72964
72972
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
72965
72973
  }
72966
72974
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -83129,7 +83137,6 @@ var ts;
83129
83137
  return true;
83130
83138
  }
83131
83139
  function checkAliasSymbol(node) {
83132
- var _a;
83133
83140
  var symbol = getSymbolOfNode(node);
83134
83141
  var target = resolveAlias(symbol);
83135
83142
  if (target !== unknownSymbol) {
@@ -83185,11 +83192,46 @@ var ts;
83185
83192
  }
83186
83193
  }
83187
83194
  }
83188
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83189
- addDeprecatedSuggestion(node.name, target.declarations, symbol.escapedName);
83195
+ if (ts.isImportSpecifier(node)) {
83196
+ var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
83197
+ if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
83198
+ addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
83199
+ }
83190
83200
  }
83191
83201
  }
83192
83202
  }
83203
+ function isDeprecatedAliasedSymbol(symbol) {
83204
+ return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
83205
+ }
83206
+ function checkDeprecatedAliasedSymbol(symbol, location) {
83207
+ if (!(symbol.flags & 2097152 /* Alias */))
83208
+ return symbol;
83209
+ var targetSymbol = resolveAlias(symbol);
83210
+ if (targetSymbol === unknownSymbol)
83211
+ return targetSymbol;
83212
+ while (symbol.flags & 2097152 /* Alias */) {
83213
+ var target = getImmediateAliasedSymbol(symbol);
83214
+ if (target) {
83215
+ if (target === targetSymbol)
83216
+ break;
83217
+ if (target.declarations && ts.length(target.declarations)) {
83218
+ if (isDeprecatedAliasedSymbol(target)) {
83219
+ addDeprecatedSuggestion(location, target.declarations, target.escapedName);
83220
+ break;
83221
+ }
83222
+ else {
83223
+ if (symbol === targetSymbol)
83224
+ break;
83225
+ symbol = target;
83226
+ }
83227
+ }
83228
+ }
83229
+ else {
83230
+ break;
83231
+ }
83232
+ }
83233
+ return targetSymbol;
83234
+ }
83193
83235
  function checkImportBinding(node) {
83194
83236
  checkCollisionsForDeclarationName(node, node.name);
83195
83237
  checkAliasSymbol(node);
@@ -115847,14 +115889,14 @@ var ts;
115847
115889
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
115848
115890
  addFileToFilesByName(dupFile, path, redirectedPath);
115849
115891
  addFileIncludeReason(dupFile, reason);
115850
- sourceFileToPackageName.set(path, packageId.name);
115892
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115851
115893
  processingOtherFiles.push(dupFile);
115852
115894
  return dupFile;
115853
115895
  }
115854
115896
  else if (file) {
115855
115897
  // This is the first source file to have this packageId.
115856
115898
  packageIdToSourceFile.set(packageIdKey, file);
115857
- sourceFileToPackageName.set(path, packageId.name);
115899
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115858
115900
  }
115859
115901
  }
115860
115902
  addFileToFilesByName(file, path, redirectedPath);
@@ -141287,6 +141329,8 @@ var ts;
141287
141329
  }
141288
141330
  if (flags & 16 /* Function */)
141289
141331
  return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
141332
+ // FIXME: getter and setter use the same symbol. And it is rare to use only setter without getter, so in most cases the symbol always has getter flag.
141333
+ // So, even when the location is just on the declaration of setter, this function returns getter.
141290
141334
  if (flags & 32768 /* GetAccessor */)
141291
141335
  return "getter" /* memberGetAccessorElement */;
141292
141336
  if (flags & 65536 /* SetAccessor */)
@@ -141373,9 +141417,24 @@ var ts;
141373
141417
  }
141374
141418
  // Class at constructor site need to be shown as constructor apart from property,method, vars
141375
141419
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
141376
- // If it is accessor they are allowed only if location is at name of the accessor
141420
+ // If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
141377
141421
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
141378
- symbolKind = "property" /* memberVariableElement */;
141422
+ var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
141423
+ if (declaration) {
141424
+ switch (declaration.kind) {
141425
+ case 171 /* GetAccessor */:
141426
+ symbolKind = "getter" /* memberGetAccessorElement */;
141427
+ break;
141428
+ case 172 /* SetAccessor */:
141429
+ symbolKind = "setter" /* memberSetAccessorElement */;
141430
+ break;
141431
+ default:
141432
+ ts.Debug.assertNever(declaration);
141433
+ }
141434
+ }
141435
+ else {
141436
+ symbolKind = "property" /* memberVariableElement */;
141437
+ }
141379
141438
  }
141380
141439
  var signature = void 0;
141381
141440
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -141689,6 +141748,8 @@ var ts;
141689
141748
  }
141690
141749
  // For properties, variables and local vars: show the type
141691
141750
  if (symbolKind === "property" /* memberVariableElement */ ||
141751
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
141752
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
141692
141753
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
141693
141754
  symbolFlags & 3 /* Variable */ ||
141694
141755
  symbolKind === "local var" /* localVariableElement */ ||
@@ -141759,7 +141820,7 @@ var ts;
141759
141820
  }
141760
141821
  }
141761
141822
  if (tags.length === 0 && !hasMultipleSignatures) {
141762
- tags = symbol.getJsDocTags(typeChecker);
141823
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
141763
141824
  }
141764
141825
  if (documentation.length === 0 && documentationFromAlias) {
141765
141826
  documentation = documentationFromAlias;
@@ -159963,13 +160024,11 @@ var ts;
159963
160024
  switch (context === null || context === void 0 ? void 0 : context.kind) {
159964
160025
  case 171 /* GetAccessor */:
159965
160026
  if (!this.contextualGetAccessorDocumentationComment) {
159966
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
159967
160027
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
159968
160028
  }
159969
160029
  return this.contextualGetAccessorDocumentationComment;
159970
160030
  case 172 /* SetAccessor */:
159971
160031
  if (!this.contextualSetAccessorDocumentationComment) {
159972
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
159973
160032
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
159974
160033
  }
159975
160034
  return this.contextualSetAccessorDocumentationComment;
@@ -159979,10 +160038,26 @@ var ts;
159979
160038
  };
159980
160039
  SymbolObject.prototype.getJsDocTags = function (checker) {
159981
160040
  if (this.tags === undefined) {
159982
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160041
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
159983
160042
  }
159984
160043
  return this.tags;
159985
160044
  };
160045
+ SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
160046
+ switch (context === null || context === void 0 ? void 0 : context.kind) {
160047
+ case 171 /* GetAccessor */:
160048
+ if (!this.contextualGetAccessorTags) {
160049
+ this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
160050
+ }
160051
+ return this.contextualGetAccessorTags;
160052
+ case 172 /* SetAccessor */:
160053
+ if (!this.contextualSetAccessorTags) {
160054
+ this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
160055
+ }
160056
+ return this.contextualSetAccessorTags;
160057
+ default:
160058
+ return this.getJsDocTags(checker);
160059
+ }
160060
+ };
159986
160061
  return SymbolObject;
159987
160062
  }());
159988
160063
  var TokenObject = /** @class */ (function (_super) {
@@ -160152,10 +160227,7 @@ var ts;
160152
160227
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160153
160228
  };
160154
160229
  SignatureObject.prototype.getJsDocTags = function () {
160155
- if (this.jsDocTags === undefined) {
160156
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160157
- }
160158
- return this.jsDocTags;
160230
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160159
160231
  };
160160
160232
  return SignatureObject;
160161
160233
  }());
@@ -160167,12 +160239,30 @@ var ts;
160167
160239
  function hasJSDocInheritDocTag(node) {
160168
160240
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160169
160241
  }
160170
- function getJsDocTagsOfSignature(declaration, checker) {
160171
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160172
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160173
- var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) { var _a; return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; });
160174
- if (inheritedTags) {
160175
- tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160242
+ function getJsDocTagsOfDeclarations(declarations, checker) {
160243
+ if (!declarations)
160244
+ return ts.emptyArray;
160245
+ var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
160246
+ if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160247
+ var seenSymbols_1 = new ts.Set();
160248
+ var _loop_22 = function (declaration) {
160249
+ var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
160250
+ var _a;
160251
+ if (!seenSymbols_1.has(symbol)) {
160252
+ seenSymbols_1.add(symbol);
160253
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160254
+ return symbol.getContextualJsDocTags(declaration, checker);
160255
+ }
160256
+ return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
160257
+ }
160258
+ });
160259
+ if (inheritedTags) {
160260
+ tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
160261
+ }
160262
+ };
160263
+ for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160264
+ var declaration = declarations_6[_i];
160265
+ _loop_22(declaration);
160176
160266
  }
160177
160267
  }
160178
160268
  return tags;
@@ -160182,18 +160272,24 @@ var ts;
160182
160272
  return ts.emptyArray;
160183
160273
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160184
160274
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160185
- var seenSymbols_1 = new ts.Set();
160186
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160187
- var declaration = declarations_6[_i];
160275
+ var seenSymbols_2 = new ts.Set();
160276
+ var _loop_23 = function (declaration) {
160188
160277
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160189
- if (!seenSymbols_1.has(symbol)) {
160190
- seenSymbols_1.add(symbol);
160278
+ if (!seenSymbols_2.has(symbol)) {
160279
+ seenSymbols_2.add(symbol);
160280
+ if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
160281
+ return symbol.getContextualDocumentationComment(declaration, checker);
160282
+ }
160191
160283
  return symbol.getDocumentationComment(checker);
160192
160284
  }
160193
160285
  });
160194
160286
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160195
160287
  if (inheritedDocs)
160196
160288
  doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
160289
+ };
160290
+ for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
160291
+ var declaration = declarations_7[_i];
160292
+ _loop_23(declaration);
160197
160293
  }
160198
160294
  }
160199
160295
  return doc;
@@ -572,7 +572,7 @@ declare namespace ts {
572
572
  }
573
573
  export interface JSDocContainer {
574
574
  }
575
- export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ClassStaticBlockDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | EmptyStatement | DebuggerStatement | Block | VariableStatement | ExpressionStatement | IfStatement | DoStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | BreakStatement | ContinueStatement | ReturnStatement | WithStatement | SwitchStatement | LabeledStatement | ThrowStatement | TryStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | VariableDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | ImportDeclaration | NamespaceExportDeclaration | ExportAssignment | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | EndOfFileToken;
575
+ export type HasJSDoc = ParameterDeclaration | CallSignatureDeclaration | ClassStaticBlockDeclaration | ConstructSignatureDeclaration | MethodSignature | PropertySignature | ArrowFunction | ParenthesizedExpression | SpreadAssignment | ShorthandPropertyAssignment | PropertyAssignment | FunctionExpression | EmptyStatement | DebuggerStatement | Block | VariableStatement | ExpressionStatement | IfStatement | DoStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | BreakStatement | ContinueStatement | ReturnStatement | WithStatement | SwitchStatement | LabeledStatement | ThrowStatement | TryStatement | FunctionDeclaration | ConstructorDeclaration | MethodDeclaration | VariableDeclaration | PropertyDeclaration | AccessorDeclaration | ClassLikeDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumMember | EnumDeclaration | ModuleDeclaration | ImportEqualsDeclaration | ImportDeclaration | NamespaceExportDeclaration | ExportAssignment | IndexSignatureDeclaration | FunctionTypeNode | ConstructorTypeNode | JSDocFunctionType | ExportDeclaration | NamedTupleMember | ExportSpecifier | EndOfFileToken;
576
576
  export type HasType = SignatureDeclaration | VariableDeclaration | ParameterDeclaration | PropertySignature | PropertyDeclaration | TypePredicateNode | ParenthesizedTypeNode | TypeOperatorNode | MappedTypeNode | AssertionExpression | TypeAliasDeclaration | JSDocTypeExpression | JSDocNonNullableType | JSDocNullableType | JSDocOptionalType | JSDocVariadicType;
577
577
  export type HasTypeArguments = CallExpression | NewExpression | TaggedTemplateExpression | JsxOpeningElement | JsxSelfClosingElement;
578
578
  export type HasInitializer = HasExpressionInitializer | ForStatement | ForInStatement | ForOfStatement | JsxAttribute;
@@ -1702,7 +1702,7 @@ declare namespace ts {
1702
1702
  readonly name: Identifier;
1703
1703
  readonly isTypeOnly: boolean;
1704
1704
  }
1705
- export interface ExportSpecifier extends NamedDeclaration {
1705
+ export interface ExportSpecifier extends NamedDeclaration, JSDocContainer {
1706
1706
  readonly kind: SyntaxKind.ExportSpecifier;
1707
1707
  readonly parent: NamedExports;
1708
1708
  readonly isTypeOnly: boolean;