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 +69 -21
- package/lib/tsserver.js +144 -42
- package/lib/tsserverlibrary.d.ts +2 -2
- package/lib/tsserverlibrary.js +144 -42
- package/lib/typescript.d.ts +2 -2
- package/lib/typescript.js +144 -42
- package/lib/typescriptServices.d.ts +2 -2
- package/lib/typescriptServices.js +144 -42
- package/lib/typingsInstaller.js +69 -21
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220126";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -305,13 +305,18 @@ var ts;
|
|
|
305
305
|
/* @internal */
|
|
306
306
|
var NativeCollections;
|
|
307
307
|
(function (NativeCollections) {
|
|
308
|
+
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
309
|
+
typeof global !== "undefined" ? global :
|
|
310
|
+
typeof self !== "undefined" ? self :
|
|
311
|
+
undefined;
|
|
308
312
|
/**
|
|
309
313
|
* Returns the native Map implementation if it is available and compatible (i.e. supports iteration).
|
|
310
314
|
*/
|
|
311
315
|
function tryGetNativeMap() {
|
|
312
316
|
// Internet Explorer's Map doesn't support iteration, so don't use it.
|
|
317
|
+
var gMap = globals === null || globals === void 0 ? void 0 : globals.Map;
|
|
313
318
|
// eslint-disable-next-line no-in-operator
|
|
314
|
-
return typeof
|
|
319
|
+
return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined;
|
|
315
320
|
}
|
|
316
321
|
NativeCollections.tryGetNativeMap = tryGetNativeMap;
|
|
317
322
|
/**
|
|
@@ -319,8 +324,9 @@ var ts;
|
|
|
319
324
|
*/
|
|
320
325
|
function tryGetNativeSet() {
|
|
321
326
|
// Internet Explorer's Set doesn't support iteration, so don't use it.
|
|
327
|
+
var gSet = globals === null || globals === void 0 ? void 0 : globals.Set;
|
|
322
328
|
// eslint-disable-next-line no-in-operator
|
|
323
|
-
return typeof
|
|
329
|
+
return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined;
|
|
324
330
|
}
|
|
325
331
|
NativeCollections.tryGetNativeSet = tryGetNativeSet;
|
|
326
332
|
})(NativeCollections || (NativeCollections = {}));
|
|
@@ -14251,10 +14257,13 @@ var ts;
|
|
|
14251
14257
|
function packageIdIsEqual(a, b) {
|
|
14252
14258
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
14253
14259
|
}
|
|
14254
|
-
function
|
|
14255
|
-
var name = _a.name, subModuleName = _a.subModuleName
|
|
14256
|
-
|
|
14257
|
-
|
|
14260
|
+
function packageIdToPackageName(_a) {
|
|
14261
|
+
var name = _a.name, subModuleName = _a.subModuleName;
|
|
14262
|
+
return subModuleName ? name + "/" + subModuleName : name;
|
|
14263
|
+
}
|
|
14264
|
+
ts.packageIdToPackageName = packageIdToPackageName;
|
|
14265
|
+
function packageIdToString(packageId) {
|
|
14266
|
+
return packageIdToPackageName(packageId) + "@" + packageId.version;
|
|
14258
14267
|
}
|
|
14259
14268
|
ts.packageIdToString = packageIdToString;
|
|
14260
14269
|
function typeDirectiveIsEqualTo(oldResolution, newResolution) {
|
|
@@ -15255,7 +15264,8 @@ var ts;
|
|
|
15255
15264
|
node.kind === 212 /* FunctionExpression */ ||
|
|
15256
15265
|
node.kind === 213 /* ArrowFunction */ ||
|
|
15257
15266
|
node.kind === 211 /* ParenthesizedExpression */ ||
|
|
15258
|
-
node.kind === 253 /* VariableDeclaration */
|
|
15267
|
+
node.kind === 253 /* VariableDeclaration */ ||
|
|
15268
|
+
node.kind === 274 /* ExportSpecifier */) ?
|
|
15259
15269
|
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
|
|
15260
15270
|
ts.getLeadingCommentRanges(text, node.pos);
|
|
15261
15271
|
// True if the comment starts with '/**' but not if it is '/**/'
|
|
@@ -36406,7 +36416,8 @@ var ts;
|
|
|
36406
36416
|
return finishNode(node, pos);
|
|
36407
36417
|
}
|
|
36408
36418
|
function parseExportSpecifier() {
|
|
36409
|
-
|
|
36419
|
+
var hasJSDoc = hasPrecedingJSDocComment();
|
|
36420
|
+
return withJSDoc(parseImportOrExportSpecifier(274 /* ExportSpecifier */), hasJSDoc);
|
|
36410
36421
|
}
|
|
36411
36422
|
function parseImportSpecifier() {
|
|
36412
36423
|
return parseImportOrExportSpecifier(269 /* ImportSpecifier */);
|
|
@@ -43611,14 +43622,12 @@ var ts;
|
|
|
43611
43622
|
}
|
|
43612
43623
|
var binder = createBinder();
|
|
43613
43624
|
function bindSourceFile(file, options) {
|
|
43614
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
|
|
43615
43625
|
ts.performance.mark("beforeBind");
|
|
43616
43626
|
ts.perfLogger.logStartBindFile("" + file.fileName);
|
|
43617
43627
|
binder(file, options);
|
|
43618
43628
|
ts.perfLogger.logStopBindFile();
|
|
43619
43629
|
ts.performance.mark("afterBind");
|
|
43620
43630
|
ts.performance.measure("Bind", "beforeBind", "afterBind");
|
|
43621
|
-
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
43622
43631
|
}
|
|
43623
43632
|
ts.bindSourceFile = bindSourceFile;
|
|
43624
43633
|
function createBinder() {
|
|
@@ -43678,7 +43687,9 @@ var ts;
|
|
|
43678
43687
|
ts.Debug.attachFlowNodeDebugInfo(unreachableFlow);
|
|
43679
43688
|
ts.Debug.attachFlowNodeDebugInfo(reportedUnreachableFlow);
|
|
43680
43689
|
if (!file.locals) {
|
|
43690
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("bind" /* Bind */, "bindSourceFile", { path: file.path }, /*separateBeginAndEnd*/ true);
|
|
43681
43691
|
bind(file);
|
|
43692
|
+
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
43682
43693
|
file.symbolCount = symbolCount;
|
|
43683
43694
|
file.classifiableNames = classifiableNames;
|
|
43684
43695
|
delayedBindJSDocTypedefTag();
|
|
@@ -47945,6 +47956,9 @@ var ts;
|
|
|
47945
47956
|
suggestionDiagnostics.add(diagnostic);
|
|
47946
47957
|
return diagnostic;
|
|
47947
47958
|
}
|
|
47959
|
+
function isDeprecatedSymbol(symbol) {
|
|
47960
|
+
return !!(getDeclarationNodeFlagsFromSymbol(symbol) & 134217728 /* Deprecated */);
|
|
47961
|
+
}
|
|
47948
47962
|
function addDeprecatedSuggestion(location, declarations, deprecatedEntity) {
|
|
47949
47963
|
var diagnostic = ts.createDiagnosticForNode(location, ts.Diagnostics._0_is_deprecated, deprecatedEntity);
|
|
47950
47964
|
return addDeprecatedSuggestionWorker(declarations, diagnostic);
|
|
@@ -60731,7 +60745,7 @@ var ts;
|
|
|
60731
60745
|
}
|
|
60732
60746
|
var prop = getPropertyOfType(objectType, propName);
|
|
60733
60747
|
if (prop) {
|
|
60734
|
-
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations &&
|
|
60748
|
+
if (accessFlags & 64 /* ReportDeprecated */ && accessNode && prop.declarations && isDeprecatedSymbol(prop) && isUncalledFunctionReference(accessNode, prop)) {
|
|
60735
60749
|
var deprecatedNode = (_a = accessExpression === null || accessExpression === void 0 ? void 0 : accessExpression.argumentExpression) !== null && _a !== void 0 ? _a : (ts.isIndexedAccessTypeNode(accessNode) ? accessNode.indexType : accessNode);
|
|
60736
60750
|
addDeprecatedSuggestion(deprecatedNode, prop.declarations, propName);
|
|
60737
60751
|
}
|
|
@@ -70134,9 +70148,9 @@ var ts;
|
|
|
70134
70148
|
markAliasReferenced(symbol, node);
|
|
70135
70149
|
}
|
|
70136
70150
|
var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
|
|
70137
|
-
var
|
|
70138
|
-
if (
|
|
70139
|
-
addDeprecatedSuggestion(node,
|
|
70151
|
+
var targetSymbol = checkDeprecatedAliasedSymbol(localOrExportSymbol, node);
|
|
70152
|
+
if (isDeprecatedSymbol(targetSymbol) && isUncalledFunctionReference(node, targetSymbol) && targetSymbol.declarations) {
|
|
70153
|
+
addDeprecatedSuggestion(node, targetSymbol.declarations, node.escapedText);
|
|
70140
70154
|
}
|
|
70141
70155
|
var declaration = localOrExportSymbol.valueDeclaration;
|
|
70142
70156
|
if (declaration && localOrExportSymbol.flags & 32 /* Class */) {
|
|
@@ -73148,7 +73162,7 @@ var ts;
|
|
|
73148
73162
|
}
|
|
73149
73163
|
}
|
|
73150
73164
|
else {
|
|
73151
|
-
if (
|
|
73165
|
+
if (isDeprecatedSymbol(prop) && isUncalledFunctionReference(node, prop) && prop.declarations) {
|
|
73152
73166
|
addDeprecatedSuggestion(right, prop.declarations, right.escapedText);
|
|
73153
73167
|
}
|
|
73154
73168
|
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
|
|
@@ -83317,7 +83331,6 @@ var ts;
|
|
|
83317
83331
|
return true;
|
|
83318
83332
|
}
|
|
83319
83333
|
function checkAliasSymbol(node) {
|
|
83320
|
-
var _a;
|
|
83321
83334
|
var symbol = getSymbolOfNode(node);
|
|
83322
83335
|
var target = resolveAlias(symbol);
|
|
83323
83336
|
if (target !== unknownSymbol) {
|
|
@@ -83373,11 +83386,46 @@ var ts;
|
|
|
83373
83386
|
}
|
|
83374
83387
|
}
|
|
83375
83388
|
}
|
|
83376
|
-
if (ts.isImportSpecifier(node)
|
|
83377
|
-
|
|
83389
|
+
if (ts.isImportSpecifier(node)) {
|
|
83390
|
+
var targetSymbol = checkDeprecatedAliasedSymbol(symbol, node);
|
|
83391
|
+
if (isDeprecatedAliasedSymbol(targetSymbol) && targetSymbol.declarations) {
|
|
83392
|
+
addDeprecatedSuggestion(node, targetSymbol.declarations, targetSymbol.escapedName);
|
|
83393
|
+
}
|
|
83378
83394
|
}
|
|
83379
83395
|
}
|
|
83380
83396
|
}
|
|
83397
|
+
function isDeprecatedAliasedSymbol(symbol) {
|
|
83398
|
+
return !!symbol.declarations && ts.every(symbol.declarations, function (d) { return !!(ts.getCombinedNodeFlags(d) & 134217728 /* Deprecated */); });
|
|
83399
|
+
}
|
|
83400
|
+
function checkDeprecatedAliasedSymbol(symbol, location) {
|
|
83401
|
+
if (!(symbol.flags & 2097152 /* Alias */))
|
|
83402
|
+
return symbol;
|
|
83403
|
+
var targetSymbol = resolveAlias(symbol);
|
|
83404
|
+
if (targetSymbol === unknownSymbol)
|
|
83405
|
+
return targetSymbol;
|
|
83406
|
+
while (symbol.flags & 2097152 /* Alias */) {
|
|
83407
|
+
var target = getImmediateAliasedSymbol(symbol);
|
|
83408
|
+
if (target) {
|
|
83409
|
+
if (target === targetSymbol)
|
|
83410
|
+
break;
|
|
83411
|
+
if (target.declarations && ts.length(target.declarations)) {
|
|
83412
|
+
if (isDeprecatedAliasedSymbol(target)) {
|
|
83413
|
+
addDeprecatedSuggestion(location, target.declarations, target.escapedName);
|
|
83414
|
+
break;
|
|
83415
|
+
}
|
|
83416
|
+
else {
|
|
83417
|
+
if (symbol === targetSymbol)
|
|
83418
|
+
break;
|
|
83419
|
+
symbol = target;
|
|
83420
|
+
}
|
|
83421
|
+
}
|
|
83422
|
+
}
|
|
83423
|
+
else {
|
|
83424
|
+
break;
|
|
83425
|
+
}
|
|
83426
|
+
}
|
|
83427
|
+
return targetSymbol;
|
|
83428
|
+
}
|
|
83381
83429
|
function checkImportBinding(node) {
|
|
83382
83430
|
checkCollisionsForDeclarationName(node, node.name);
|
|
83383
83431
|
checkAliasSymbol(node);
|
|
@@ -116035,14 +116083,14 @@ var ts;
|
|
|
116035
116083
|
redirectTargetsMap.add(fileFromPackageId.path, fileName);
|
|
116036
116084
|
addFileToFilesByName(dupFile, path, redirectedPath);
|
|
116037
116085
|
addFileIncludeReason(dupFile, reason);
|
|
116038
|
-
sourceFileToPackageName.set(path, packageId
|
|
116086
|
+
sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
|
|
116039
116087
|
processingOtherFiles.push(dupFile);
|
|
116040
116088
|
return dupFile;
|
|
116041
116089
|
}
|
|
116042
116090
|
else if (file) {
|
|
116043
116091
|
// This is the first source file to have this packageId.
|
|
116044
116092
|
packageIdToSourceFile.set(packageIdKey, file);
|
|
116045
|
-
sourceFileToPackageName.set(path, packageId
|
|
116093
|
+
sourceFileToPackageName.set(path, ts.packageIdToPackageName(packageId));
|
|
116046
116094
|
}
|
|
116047
116095
|
}
|
|
116048
116096
|
addFileToFilesByName(file, path, redirectedPath);
|
|
@@ -141892,6 +141940,8 @@ var ts;
|
|
|
141892
141940
|
}
|
|
141893
141941
|
if (flags & 16 /* Function */)
|
|
141894
141942
|
return isLocalVariableOrFunction(symbol) ? "local function" /* localFunctionElement */ : "function" /* functionElement */;
|
|
141943
|
+
// 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.
|
|
141944
|
+
// So, even when the location is just on the declaration of setter, this function returns getter.
|
|
141895
141945
|
if (flags & 32768 /* GetAccessor */)
|
|
141896
141946
|
return "getter" /* memberGetAccessorElement */;
|
|
141897
141947
|
if (flags & 65536 /* SetAccessor */)
|
|
@@ -141978,9 +142028,24 @@ var ts;
|
|
|
141978
142028
|
}
|
|
141979
142029
|
// Class at constructor site need to be shown as constructor apart from property,method, vars
|
|
141980
142030
|
if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
|
|
141981
|
-
// If
|
|
142031
|
+
// If symbol is accessor, they are allowed only if location is at declaration identifier of the accessor
|
|
141982
142032
|
if (symbolKind === "getter" /* memberGetAccessorElement */ || symbolKind === "setter" /* memberSetAccessorElement */) {
|
|
141983
|
-
|
|
142033
|
+
var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; });
|
|
142034
|
+
if (declaration) {
|
|
142035
|
+
switch (declaration.kind) {
|
|
142036
|
+
case 171 /* GetAccessor */:
|
|
142037
|
+
symbolKind = "getter" /* memberGetAccessorElement */;
|
|
142038
|
+
break;
|
|
142039
|
+
case 172 /* SetAccessor */:
|
|
142040
|
+
symbolKind = "setter" /* memberSetAccessorElement */;
|
|
142041
|
+
break;
|
|
142042
|
+
default:
|
|
142043
|
+
ts.Debug.assertNever(declaration);
|
|
142044
|
+
}
|
|
142045
|
+
}
|
|
142046
|
+
else {
|
|
142047
|
+
symbolKind = "property" /* memberVariableElement */;
|
|
142048
|
+
}
|
|
141984
142049
|
}
|
|
141985
142050
|
var signature = void 0;
|
|
141986
142051
|
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location);
|
|
@@ -142294,6 +142359,8 @@ var ts;
|
|
|
142294
142359
|
}
|
|
142295
142360
|
// For properties, variables and local vars: show the type
|
|
142296
142361
|
if (symbolKind === "property" /* memberVariableElement */ ||
|
|
142362
|
+
symbolKind === "getter" /* memberGetAccessorElement */ ||
|
|
142363
|
+
symbolKind === "setter" /* memberSetAccessorElement */ ||
|
|
142297
142364
|
symbolKind === "JSX attribute" /* jsxAttribute */ ||
|
|
142298
142365
|
symbolFlags & 3 /* Variable */ ||
|
|
142299
142366
|
symbolKind === "local var" /* localVariableElement */ ||
|
|
@@ -142364,7 +142431,7 @@ var ts;
|
|
|
142364
142431
|
}
|
|
142365
142432
|
}
|
|
142366
142433
|
if (tags.length === 0 && !hasMultipleSignatures) {
|
|
142367
|
-
tags = symbol.
|
|
142434
|
+
tags = symbol.getContextualJsDocTags(enclosingDeclaration, typeChecker);
|
|
142368
142435
|
}
|
|
142369
142436
|
if (documentation.length === 0 && documentationFromAlias) {
|
|
142370
142437
|
documentation = documentationFromAlias;
|
|
@@ -160568,13 +160635,11 @@ var ts;
|
|
|
160568
160635
|
switch (context === null || context === void 0 ? void 0 : context.kind) {
|
|
160569
160636
|
case 171 /* GetAccessor */:
|
|
160570
160637
|
if (!this.contextualGetAccessorDocumentationComment) {
|
|
160571
|
-
this.contextualGetAccessorDocumentationComment = ts.emptyArray;
|
|
160572
160638
|
this.contextualGetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
160573
160639
|
}
|
|
160574
160640
|
return this.contextualGetAccessorDocumentationComment;
|
|
160575
160641
|
case 172 /* SetAccessor */:
|
|
160576
160642
|
if (!this.contextualSetAccessorDocumentationComment) {
|
|
160577
|
-
this.contextualSetAccessorDocumentationComment = ts.emptyArray;
|
|
160578
160643
|
this.contextualSetAccessorDocumentationComment = getDocumentationComment(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
160579
160644
|
}
|
|
160580
160645
|
return this.contextualSetAccessorDocumentationComment;
|
|
@@ -160584,10 +160649,26 @@ var ts;
|
|
|
160584
160649
|
};
|
|
160585
160650
|
SymbolObject.prototype.getJsDocTags = function (checker) {
|
|
160586
160651
|
if (this.tags === undefined) {
|
|
160587
|
-
this.tags =
|
|
160652
|
+
this.tags = getJsDocTagsOfDeclarations(this.declarations, checker);
|
|
160588
160653
|
}
|
|
160589
160654
|
return this.tags;
|
|
160590
160655
|
};
|
|
160656
|
+
SymbolObject.prototype.getContextualJsDocTags = function (context, checker) {
|
|
160657
|
+
switch (context === null || context === void 0 ? void 0 : context.kind) {
|
|
160658
|
+
case 171 /* GetAccessor */:
|
|
160659
|
+
if (!this.contextualGetAccessorTags) {
|
|
160660
|
+
this.contextualGetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isGetAccessor), checker);
|
|
160661
|
+
}
|
|
160662
|
+
return this.contextualGetAccessorTags;
|
|
160663
|
+
case 172 /* SetAccessor */:
|
|
160664
|
+
if (!this.contextualSetAccessorTags) {
|
|
160665
|
+
this.contextualSetAccessorTags = getJsDocTagsOfDeclarations(ts.filter(this.declarations, ts.isSetAccessor), checker);
|
|
160666
|
+
}
|
|
160667
|
+
return this.contextualSetAccessorTags;
|
|
160668
|
+
default:
|
|
160669
|
+
return this.getJsDocTags(checker);
|
|
160670
|
+
}
|
|
160671
|
+
};
|
|
160591
160672
|
return SymbolObject;
|
|
160592
160673
|
}());
|
|
160593
160674
|
var TokenObject = /** @class */ (function (_super) {
|
|
@@ -160757,10 +160838,7 @@ var ts;
|
|
|
160757
160838
|
return this.documentationComment || (this.documentationComment = getDocumentationComment(ts.singleElementArray(this.declaration), this.checker));
|
|
160758
160839
|
};
|
|
160759
160840
|
SignatureObject.prototype.getJsDocTags = function () {
|
|
160760
|
-
|
|
160761
|
-
this.jsDocTags = this.declaration ? getJsDocTagsOfSignature(this.declaration, this.checker) : [];
|
|
160762
|
-
}
|
|
160763
|
-
return this.jsDocTags;
|
|
160841
|
+
return this.jsDocTags || (this.jsDocTags = getJsDocTagsOfDeclarations(ts.singleElementArray(this.declaration), this.checker));
|
|
160764
160842
|
};
|
|
160765
160843
|
return SignatureObject;
|
|
160766
160844
|
}());
|
|
@@ -160772,12 +160850,30 @@ var ts;
|
|
|
160772
160850
|
function hasJSDocInheritDocTag(node) {
|
|
160773
160851
|
return ts.getJSDocTags(node).some(function (tag) { return tag.tagName.text === "inheritDoc"; });
|
|
160774
160852
|
}
|
|
160775
|
-
function
|
|
160776
|
-
|
|
160777
|
-
|
|
160778
|
-
|
|
160779
|
-
|
|
160780
|
-
|
|
160853
|
+
function getJsDocTagsOfDeclarations(declarations, checker) {
|
|
160854
|
+
if (!declarations)
|
|
160855
|
+
return ts.emptyArray;
|
|
160856
|
+
var tags = ts.JsDoc.getJsDocTagsFromDeclarations(declarations, checker);
|
|
160857
|
+
if (checker && (tags.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
160858
|
+
var seenSymbols_1 = new ts.Set();
|
|
160859
|
+
var _loop_22 = function (declaration) {
|
|
160860
|
+
var inheritedTags = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
160861
|
+
var _a;
|
|
160862
|
+
if (!seenSymbols_1.has(symbol)) {
|
|
160863
|
+
seenSymbols_1.add(symbol);
|
|
160864
|
+
if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
|
|
160865
|
+
return symbol.getContextualJsDocTags(declaration, checker);
|
|
160866
|
+
}
|
|
160867
|
+
return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined;
|
|
160868
|
+
}
|
|
160869
|
+
});
|
|
160870
|
+
if (inheritedTags) {
|
|
160871
|
+
tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true);
|
|
160872
|
+
}
|
|
160873
|
+
};
|
|
160874
|
+
for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) {
|
|
160875
|
+
var declaration = declarations_6[_i];
|
|
160876
|
+
_loop_22(declaration);
|
|
160781
160877
|
}
|
|
160782
160878
|
}
|
|
160783
160879
|
return tags;
|
|
@@ -160787,18 +160883,24 @@ var ts;
|
|
|
160787
160883
|
return ts.emptyArray;
|
|
160788
160884
|
var doc = ts.JsDoc.getJsDocCommentsFromDeclarations(declarations, checker);
|
|
160789
160885
|
if (checker && (doc.length === 0 || declarations.some(hasJSDocInheritDocTag))) {
|
|
160790
|
-
var
|
|
160791
|
-
|
|
160792
|
-
var declaration = declarations_6[_i];
|
|
160886
|
+
var seenSymbols_2 = new ts.Set();
|
|
160887
|
+
var _loop_23 = function (declaration) {
|
|
160793
160888
|
var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) {
|
|
160794
|
-
if (!
|
|
160795
|
-
|
|
160889
|
+
if (!seenSymbols_2.has(symbol)) {
|
|
160890
|
+
seenSymbols_2.add(symbol);
|
|
160891
|
+
if (declaration.kind === 171 /* GetAccessor */ || declaration.kind === 172 /* SetAccessor */) {
|
|
160892
|
+
return symbol.getContextualDocumentationComment(declaration, checker);
|
|
160893
|
+
}
|
|
160796
160894
|
return symbol.getDocumentationComment(checker);
|
|
160797
160895
|
}
|
|
160798
160896
|
});
|
|
160799
160897
|
// TODO: GH#16312 Return a ReadonlyArray, avoid copying inheritedDocs
|
|
160800
160898
|
if (inheritedDocs)
|
|
160801
160899
|
doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc);
|
|
160900
|
+
};
|
|
160901
|
+
for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) {
|
|
160902
|
+
var declaration = declarations_7[_i];
|
|
160903
|
+
_loop_23(declaration);
|
|
160802
160904
|
}
|
|
160803
160905
|
}
|
|
160804
160906
|
return doc;
|
package/lib/typescript.d.ts
CHANGED
|
@@ -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;
|