typescript 4.6.0-dev.20220122 → 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,15 +69,21 @@ 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.20220122";
72
+ ts.version = ts.versionMajorMinor + ".0-dev.20220126";
73
73
  var NativeCollections;
74
74
  (function (NativeCollections) {
75
+ var globals = typeof globalThis !== "undefined" ? globalThis :
76
+ typeof global !== "undefined" ? global :
77
+ typeof self !== "undefined" ? self :
78
+ undefined;
75
79
  function tryGetNativeMap() {
76
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
80
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
81
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
77
82
  }
78
83
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
79
84
  function tryGetNativeSet() {
80
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
85
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
86
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
81
87
  }
82
88
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
83
89
  })(NativeCollections || (NativeCollections = {}));
@@ -10667,10 +10673,13 @@ var ts;
10667
10673
  function packageIdIsEqual(a, b) {
10668
10674
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
10669
10675
  }
10670
- function packageIdToString(_a) {
10671
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
10672
- var fullName = subModuleName ? name + "/" + subModuleName : name;
10673
- 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;
10674
10683
  }
10675
10684
  ts.packageIdToString = packageIdToString;
10676
10685
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -11556,7 +11565,8 @@ var ts;
11556
11565
  node.kind === 212 ||
11557
11566
  node.kind === 213 ||
11558
11567
  node.kind === 211 ||
11559
- node.kind === 253) ?
11568
+ node.kind === 253 ||
11569
+ node.kind === 274) ?
11560
11570
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
11561
11571
  ts.getLeadingCommentRanges(text, node.pos);
11562
11572
  return ts.filter(commentRanges, function (comment) {
@@ -29193,7 +29203,8 @@ var ts;
29193
29203
  return finishNode(node, pos);
29194
29204
  }
29195
29205
  function parseExportSpecifier() {
29196
- return parseImportOrExportSpecifier(274);
29206
+ var hasJSDoc = hasPrecedingJSDocComment();
29207
+ return withJSDoc(parseImportOrExportSpecifier(274), hasJSDoc);
29197
29208
  }
29198
29209
  function parseImportSpecifier() {
29199
29210
  return parseImportOrExportSpecifier(269);
@@ -35492,14 +35503,12 @@ var ts;
35492
35503
  }
35493
35504
  var binder = createBinder();
35494
35505
  function bindSourceFile(file, options) {
35495
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35496
35506
  ts.performance.mark("beforeBind");
35497
35507
  ts.perfLogger.logStartBindFile("" + file.fileName);
35498
35508
  binder(file, options);
35499
35509
  ts.perfLogger.logStopBindFile();
35500
35510
  ts.performance.mark("afterBind");
35501
35511
  ts.performance.measure("Bind", "beforeBind", "afterBind");
35502
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35503
35512
  }
35504
35513
  ts.bindSourceFile = bindSourceFile;
35505
35514
  function createBinder() {
@@ -35546,7 +35555,9 @@ var ts;
35546
35555
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
35547
35556
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
35548
35557
  if (!file.locals) {
35558
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind", "bindSourceFile", { path: file.path }, true);
35549
35559
  bind(file);
35560
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
35550
35561
  file.symbolCount = symbolCount;
35551
35562
  file.classifiableNames = classifiableNames;
35552
35563
  delayedBindJSDocTypedefTag();
@@ -39135,6 +39146,9 @@ var ts;
39135
39146
  suggestionDiagnostics.add(diagnostic);
39136
39147
  return diagnostic;
39137
39148
  }
39149
+ function isDeprecatedSymbol(symbol) {
39150
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728);
39151
+ }
39138
39152
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
39139
39153
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
39140
39154
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -50260,7 +50274,7 @@ var ts;
50260
50274
  }
50261
50275
  var prop = getPropertyOfType(objectType, propName);
50262
50276
  if (prop) {
50263
- if (accessFlags & 64 && accessNode && prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(accessNode, prop)) {
50277
+ if (accessFlags & 64 && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
50264
50278
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
50265
50279
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
50266
50280
  }
@@ -58410,9 +58424,9 @@ var ts;
58410
58424
  markAliasReferenced(symbol, node);
58411
58425
  }
58412
58426
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
58413
- var sourceSymbol = localOrExportSymbol.flags & 2097152 ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
58414
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 && isUncalledFunctionReference(node, sourceSymbol)) {
58415
- 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);
58416
58430
  }
58417
58431
  var declaration = localOrExportSymbol.valueDeclaration;
58418
58432
  if (declaration && localOrExportSymbol.flags & 32) {
@@ -60944,7 +60958,7 @@ var ts;
60944
60958
  }
60945
60959
  }
60946
60960
  else {
60947
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 && isUncalledFunctionReference(node, prop)) {
60961
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
60948
60962
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
60949
60963
  }
60950
60964
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -69629,7 +69643,6 @@ var ts;
69629
69643
  return true;
69630
69644
  }
69631
69645
  function checkAliasSymbol(node) {
69632
- var _a;
69633
69646
  var symbol = getSymbolOfNode(node);
69634
69647
  var target = resolveAlias(symbol);
69635
69648
  if (target !== unknownSymbol) {
@@ -69676,10 +69689,45 @@ var ts;
69676
69689
  }
69677
69690
  }
69678
69691
  }
69679
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728); }))) {
69680
- 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;
69681
69728
  }
69682
69729
  }
69730
+ return targetSymbol;
69683
69731
  }
69684
69732
  function checkImportBinding(node) {
69685
69733
  checkCollisionsForDeclarationName(node, node.name);
@@ -95574,13 +95622,13 @@ var ts;
95574
95622
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
95575
95623
  addFileToFilesByName(dupFile, path, redirectedPath);
95576
95624
  addFileIncludeReason(dupFile, reason);
95577
- sourceFileToPackageName.set(path, packageId.name);
95625
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95578
95626
  processingOtherFiles.push(dupFile);
95579
95627
  return dupFile;
95580
95628
  }
95581
95629
  else if (file) {
95582
95630
  packageIdToSourceFile.set(packageIdKey, file);
95583
- sourceFileToPackageName.set(path, packageId.name);
95631
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
95584
95632
  }
95585
95633
  }
95586
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.20220122";
103
+ ts.version = ts.versionMajorMinor + ".0-dev.20220126";
104
104
  /* @internal */
105
105
  var Comparison;
106
106
  (function (Comparison) {
@@ -111,13 +111,18 @@ var ts;
111
111
  /* @internal */
112
112
  var NativeCollections;
113
113
  (function (NativeCollections) {
114
+ var globals = typeof globalThis !== "undefined" ? globalThis :
115
+ typeof global !== "undefined" ? global :
116
+ typeof self !== "undefined" ? self :
117
+ undefined;
114
118
  /**
115
119
  * Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
116
120
  */
117
121
  function tryGetNativeMap() {
118
122
  // Internet Explorer's Map doesn't support iteration, so don't use it.
123
+ var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
119
124
  // eslint-disable-next-line no-in-operator
120
- return typeof Map !== "undefined" && "entries" in Map.prototype && new Map([[0, 0]]).size === 1 ? Map : undefined;
125
+ return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
121
126
  }
122
127
  NativeCollections.tryGetNativeMap = tryGetNativeMap;
123
128
  /**
@@ -125,8 +130,9 @@ var ts;
125
130
  */
126
131
  function tryGetNativeSet() {
127
132
  // Internet Explorer's Set doesn't support iteration, so don't use it.
133
+ var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
128
134
  // eslint-disable-next-line no-in-operator
129
- return typeof Set !== "undefined" && "entries" in Set.prototype && new Set([0]).size === 1 ? Set : undefined;
135
+ return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
130
136
  }
131
137
  NativeCollections.tryGetNativeSet = tryGetNativeSet;
132
138
  })(NativeCollections || (NativeCollections = {}));
@@ -14057,10 +14063,13 @@ var ts;
14057
14063
  function packageIdIsEqual(a, b) {
14058
14064
  return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
14059
14065
  }
14060
- function packageIdToString(_a) {
14061
- var name = _a.name, subModuleName = _a.subModuleName, version = _a.version;
14062
- var fullName = subModuleName ? name + "/" + subModuleName : name;
14063
- 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;
14064
14073
  }
14065
14074
  ts.packageIdToString = packageIdToString;
14066
14075
  function typeDirectiveIsEqualTo(oldResolution, newResolution) {
@@ -15061,7 +15070,8 @@ var ts;
15061
15070
  node.kind === 212 /* FunctionExpression */ ||
15062
15071
  node.kind === 213 /* ArrowFunction */ ||
15063
15072
  node.kind === 211 /* ParenthesizedExpression */ ||
15064
- node.kind === 253 /* VariableDeclaration */) ?
15073
+ node.kind === 253 /* VariableDeclaration */ ||
15074
+ node.kind === 274 /* ExportSpecifier */) ?
15065
15075
  ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
15066
15076
  ts.getLeadingCommentRanges(text, node.pos);
15067
15077
  // True if the comment starts with '/**' but not if it is '/**/'
@@ -36212,7 +36222,8 @@ var ts;
36212
36222
  return finishNode(node, pos);
36213
36223
  }
36214
36224
  function parseExportSpecifier() {
36215
- return parseImportOrExportSpecifier(274 /* ExportSpecifier */);
36225
+ var hasJSDoc = hasPrecedingJSDocComment();
36226
+ return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
36216
36227
  }
36217
36228
  function parseImportSpecifier() {
36218
36229
  return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
@@ -43417,14 +43428,12 @@ var ts;
43417
43428
  }
43418
43429
  var binder = createBinder();
43419
43430
  function bindSourceFile(file, options) {
43420
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
43421
43431
  ts.performance.mark("beforeBind");
43422
43432
  ts.perfLogger.logStartBindFile("" + file.fileName);
43423
43433
  binder(file, options);
43424
43434
  ts.perfLogger.logStopBindFile();
43425
43435
  ts.performance.mark("afterBind");
43426
43436
  ts.performance.measure("Bind", "beforeBind", "afterBind");
43427
- ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43428
43437
  }
43429
43438
  ts.bindSourceFile = bindSourceFile;
43430
43439
  function createBinder() {
@@ -43484,7 +43493,9 @@ var ts;
43484
43493
  ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
43485
43494
  ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
43486
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);
43487
43497
  bind(file);
43498
+ ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
43488
43499
  file.symbolCount = symbolCount;
43489
43500
  file.classifiableNames = classifiableNames;
43490
43501
  delayedBindJSDocTypedefTag();
@@ -47751,6 +47762,9 @@ var ts;
47751
47762
  suggestionDiagnostics.add(diagnostic);
47752
47763
  return diagnostic;
47753
47764
  }
47765
+ function isDeprecatedSymbol(symbol) {
47766
+ return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
47767
+ }
47754
47768
  function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
47755
47769
  var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
47756
47770
  return addDeprecatedSuggestionWorker(declarations, diagnostic);
@@ -60537,7 +60551,7 @@ var ts;
60537
60551
  }
60538
60552
  var prop = getPropertyOfType(objectType, propName);
60539
60553
  if (prop) {
60540
- 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)) {
60541
60555
  var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
60542
60556
  addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
60543
60557
  }
@@ -69940,9 +69954,9 @@ var ts;
69940
69954
  markAliasReferenced(symbol, node);
69941
69955
  }
69942
69956
  var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
69943
- var sourceSymbol = localOrExportSymbol.flags & 2097152 /* Alias */ ? resolveAlias(localOrExportSymbol) : localOrExportSymbol;
69944
- if (sourceSymbol.declarations && getDeclarationNodeFlagsFromSymbol(sourceSymbol) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, sourceSymbol)) {
69945
- 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);
69946
69960
  }
69947
69961
  var declaration = localOrExportSymbol.valueDeclaration;
69948
69962
  if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
@@ -72954,7 +72968,7 @@ var ts;
72954
72968
  }
72955
72969
  }
72956
72970
  else {
72957
- if (prop.declarations && getDeclarationNodeFlagsFromSymbol(prop) & 134217728 /* Deprecated */ && isUncalledFunctionReference(node, prop)) {
72971
+ if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
72958
72972
  addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
72959
72973
  }
72960
72974
  checkPropertyNotUsedBeforeDeclaration(prop, node, right);
@@ -83123,7 +83137,6 @@ var ts;
83123
83137
  return true;
83124
83138
  }
83125
83139
  function checkAliasSymbol(node) {
83126
- var _a;
83127
83140
  var symbol = getSymbolOfNode(node);
83128
83141
  var target = resolveAlias(symbol);
83129
83142
  if (target !== unknownSymbol) {
@@ -83179,11 +83192,46 @@ var ts;
83179
83192
  }
83180
83193
  }
83181
83194
  }
83182
- if (ts.isImportSpecifier(node) && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.every(function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); }))) {
83183
- 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
+ }
83184
83200
  }
83185
83201
  }
83186
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
+ }
83187
83235
  function checkImportBinding(node) {
83188
83236
  checkCollisionsForDeclarationName(node, node.name);
83189
83237
  checkAliasSymbol(node);
@@ -115841,14 +115889,14 @@ var ts;
115841
115889
  redirectTargetsMap.add(fileFromPackageId.path, fileName);
115842
115890
  addFileToFilesByName(dupFile, path, redirectedPath);
115843
115891
  addFileIncludeReason(dupFile, reason);
115844
- sourceFileToPackageName.set(path, packageId.name);
115892
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115845
115893
  processingOtherFiles.push(dupFile);
115846
115894
  return dupFile;
115847
115895
  }
115848
115896
  else if (file) {
115849
115897
  // This is the first source file to have this packageId.
115850
115898
  packageIdToSourceFile.set(packageIdKey, file);
115851
- sourceFileToPackageName.set(path, packageId.name);
115899
+ sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
115852
115900
  }
115853
115901
  }
115854
115902
  addFileToFilesByName(file, path, redirectedPath);
@@ -141281,6 +141329,8 @@ var ts;
141281
141329
  }
141282
141330
  if (flags & 16 /* Function */)
141283
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.
141284
141334
  if (flags & 32768 /* GetAccessor */)
141285
141335
  return "getter" /* memberGetAccessorElement */;
141286
141336
  if (flags & 65536 /* SetAccessor */)
@@ -141367,9 +141417,24 @@ var ts;
141367
141417
  }
141368
141418
  // Class at constructor site need to be shown as constructor apart from property,method, vars
141369
141419
  if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
141370
- // 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
141371
141421
  if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
141372
- 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
+ }
141373
141438
  }
141374
141439
  var signature = void 0;
141375
141440
  type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
@@ -141683,6 +141748,8 @@ var ts;
141683
141748
  }
141684
141749
  // For properties, variables and local vars: show the type
141685
141750
  if (symbolKind === "property" /* memberVariableElement */ ||
141751
+ symbolKind === "getter" /* memberGetAccessorElement */ ||
141752
+ symbolKind === "setter" /* memberSetAccessorElement */ ||
141686
141753
  symbolKind === "JSX attribute" /* jsxAttribute */ ||
141687
141754
  symbolFlags & 3 /* Variable */ ||
141688
141755
  symbolKind === "local var" /* localVariableElement */ ||
@@ -141753,7 +141820,7 @@ var ts;
141753
141820
  }
141754
141821
  }
141755
141822
  if (tags.length === 0 && !hasMultipleSignatures) {
141756
- tags = symbol.getJsDocTags(typeChecker);
141823
+ tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
141757
141824
  }
141758
141825
  if (documentation.length === 0 && documentationFromAlias) {
141759
141826
  documentation = documentationFromAlias;
@@ -159957,13 +160024,11 @@ var ts;
159957
160024
  switch (context === null || context === void 0 ? void 0 : context.kind) {
159958
160025
  case 171 /* GetAccessor */:
159959
160026
  if (!this.contextualGetAccessorDocumentationComment) {
159960
- this.contextualGetAccessorDocumentationComment = ts.emptyArray;
159961
160027
  this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
159962
160028
  }
159963
160029
  return this.contextualGetAccessorDocumentationComment;
159964
160030
  case 172 /* SetAccessor */:
159965
160031
  if (!this.contextualSetAccessorDocumentationComment) {
159966
- this.contextualSetAccessorDocumentationComment = ts.emptyArray;
159967
160032
  this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
159968
160033
  }
159969
160034
  return this.contextualSetAccessorDocumentationComment;
@@ -159973,10 +160038,26 @@ var ts;
159973
160038
  };
159974
160039
  SymbolObject.prototype.getJsDocTags = function (checker) {
159975
160040
  if (this.tags === undefined) {
159976
- this.tags = ts.JsDoc.getJsDocTagsFromDeclarations(this.declarations, checker);
160041
+ this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
159977
160042
  }
159978
160043
  return this.tags;
159979
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
+ };
159980
160061
  return SymbolObject;
159981
160062
  }());
159982
160063
  var TokenObject = /** @class */ (function (_super) {
@@ -160146,10 +160227,7 @@ var ts;
160146
160227
  return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
160147
160228
  };
160148
160229
  SignatureObject.prototype.getJsDocTags = function () {
160149
- if (this.jsDocTags === undefined) {
160150
- this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
160151
- }
160152
- return this.jsDocTags;
160230
+ return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
160153
160231
  };
160154
160232
  return SignatureObject;
160155
160233
  }());
@@ -160161,12 +160239,30 @@ var ts;
160161
160239
  function hasJSDocInheritDocTag(node) {
160162
160240
  return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
160163
160241
  }
160164
- function getJsDocTagsOfSignature(declaration, checker) {
160165
- var tags = ts.JsDoc.getJsDocTagsFromDeclarations([declaration], checker);
160166
- if (tags.length === 0 || hasJSDocInheritDocTag(declaration)) {
160167
- 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; });
160168
- if (inheritedTags) {
160169
- 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);
160170
160266
  }
160171
160267
  }
160172
160268
  return tags;
@@ -160176,18 +160272,24 @@ var ts;
160176
160272
  return ts.emptyArray;
160177
160273
  var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
160178
160274
  if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
160179
- var seenSymbols_1 = new ts.Set();
160180
- for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
160181
- var declaration = declarations_6[_i];
160275
+ var seenSymbols_2 = new ts.Set();
160276
+ var _loop_23 = function (declaration) {
160182
160277
  var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
160183
- if (!seenSymbols_1.has(symbol)) {
160184
- 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
+ }
160185
160283
  return symbol.getDocumentationComment(checker);
160186
160284
  }
160187
160285
  });
160188
160286
  // TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
160189
160287
  if (inheritedDocs)
160190
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);
160191
160293
  }
160192
160294
  }
160193
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;