Skip to content

Commit e5ca3e4

Browse files
authored
fix(48406): resolve JSDoc host of property signature (#48407)
1 parent 3b12284 commit e5ca3e4

File tree

3 files changed

+67
-1
lines changed

3 files changed

+67
-1
lines changed

src/compiler/utilities.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2825,7 +2825,11 @@ namespace ts {
28252825

28262826
export function getHostSignatureFromJSDoc(node: Node): SignatureDeclaration | undefined {
28272827
const host = getEffectiveJSDocHost(node);
2828-
return host && isFunctionLike(host) ? host : undefined;
2828+
if (host) {
2829+
return isPropertySignature(host) && host.type && isFunctionLike(host.type) ? host.type :
2830+
isFunctionLike(host) ? host : undefined;
2831+
}
2832+
return undefined;
28292833
}
28302834

28312835
export function getEffectiveJSDocHost(node: Node): Node | undefined {
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[
2+
{
3+
"marker": {
4+
"fileName": "/tests/cases/fourslash/quickInfoLink9.ts",
5+
"position": 47,
6+
"name": ""
7+
},
8+
"quickInfo": {
9+
"kind": "parameter",
10+
"kindModifiers": "",
11+
"textSpan": {
12+
"start": 47,
13+
"length": 1
14+
},
15+
"displayParts": [
16+
{
17+
"text": "(",
18+
"kind": "punctuation"
19+
},
20+
{
21+
"text": "parameter",
22+
"kind": "text"
23+
},
24+
{
25+
"text": ")",
26+
"kind": "punctuation"
27+
},
28+
{
29+
"text": " ",
30+
"kind": "space"
31+
},
32+
{
33+
"text": "a",
34+
"kind": "parameterName"
35+
},
36+
{
37+
"text": ":",
38+
"kind": "punctuation"
39+
},
40+
{
41+
"text": " ",
42+
"kind": "space"
43+
},
44+
{
45+
"text": "number",
46+
"kind": "keyword"
47+
}
48+
],
49+
"documentation": []
50+
}
51+
}
52+
]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
//// type Foo = {
4+
//// /**
5+
//// * Text before {@link /**/a} text after
6+
//// */
7+
//// c: (a: number) => void;
8+
//// }
9+
10+
verify.baselineQuickInfo();

0 commit comments

Comments
 (0)