Skip to content

Commit 503604c

Browse files
authoredOct 11, 2022
Overloads shouldn't gain @deprecated tags of other overloads in quick info (#50904)
* Add test case to check for the propogation of @Deprecation tag to multiple overloads * Implement filter to only include @deprecated tag in first signature after JSDoc comment
1 parent e14a229 commit 503604c

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed
 

‎src/services/symbolDisplay.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,9 @@ namespace ts.SymbolDisplay {
725725

726726
if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) {
727727
documentation = allSignatures[0].getDocumentationComment(typeChecker);
728-
tags = allSignatures[0].getJsDocTags();
728+
tags = allSignatures[0].getJsDocTags().filter(tag => tag.name !== "deprecated"); // should only include @deprecated JSDoc tag on the first overload (#49368)
729729
}
730+
730731
}
731732

732733
function writeTypeParametersOfSymbol(symbol: Symbol, enclosingDeclaration: Node | undefined) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/// <reference path="fourslash.ts" />
2+
// @target: esnext
3+
4+
// @Filename: /a.ts
5+
/////**
6+
//// * A function that gets the length of an array.
7+
//// * @param testParam
8+
//// * @deprecated Use the new method instead.
9+
//// */
10+
////export function getArrayLength(arr: string[]): number;
11+
////export function getArrayLength(arr: boolean[]): number;
12+
13+
// @Filename: /b.ts
14+
////import { getArrayLength } from "/a";
15+
/////*1*/getArrayLength(["hello"]);
16+
/////*2*/getArrayLength([true]);
17+
/////*3*/getArrayLength(["hello"]);
18+
19+
20+
goTo.file("/b.ts");
21+
goTo.marker("1")
22+
verify.quickInfoIs("(alias) getArrayLength(arr: string[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}, {name: "deprecated", text: "Use the new method instead."}])
23+
goTo.marker("2")
24+
verify.quickInfoIs("(alias) getArrayLength(arr: boolean[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}])
25+
goTo.marker("3")
26+
verify.quickInfoIs("(alias) getArrayLength(arr: string[]): number (+1 overload)\nimport getArrayLength", "A function that gets the length of an array.", [{name: "param", text: "testParam"}, {name: "deprecated", text: "Use the new method instead."}])

0 commit comments

Comments
 (0)