mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
fix(48406): resolve JSDoc host of property signature (#48407)
This commit is contained in:
@@ -2825,7 +2825,11 @@ namespace ts {
|
||||
|
||||
export function getHostSignatureFromJSDoc(node: Node): SignatureDeclaration | undefined {
|
||||
const host = getEffectiveJSDocHost(node);
|
||||
return host && isFunctionLike(host) ? host : undefined;
|
||||
if (host) {
|
||||
return isPropertySignature(host) && host.type && isFunctionLike(host.type) ? host.type :
|
||||
isFunctionLike(host) ? host : undefined;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getEffectiveJSDocHost(node: Node): Node | undefined {
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
[
|
||||
{
|
||||
"marker": {
|
||||
"fileName": "/tests/cases/fourslash/quickInfoLink9.ts",
|
||||
"position": 47,
|
||||
"name": ""
|
||||
},
|
||||
"quickInfo": {
|
||||
"kind": "parameter",
|
||||
"kindModifiers": "",
|
||||
"textSpan": {
|
||||
"start": 47,
|
||||
"length": 1
|
||||
},
|
||||
"displayParts": [
|
||||
{
|
||||
"text": "(",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": "parameter",
|
||||
"kind": "text"
|
||||
},
|
||||
{
|
||||
"text": ")",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "a",
|
||||
"kind": "parameterName"
|
||||
},
|
||||
{
|
||||
"text": ":",
|
||||
"kind": "punctuation"
|
||||
},
|
||||
{
|
||||
"text": " ",
|
||||
"kind": "space"
|
||||
},
|
||||
{
|
||||
"text": "number",
|
||||
"kind": "keyword"
|
||||
}
|
||||
],
|
||||
"documentation": []
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,10 @@
|
||||
/// <reference path="fourslash.ts" />
|
||||
|
||||
//// type Foo = {
|
||||
//// /**
|
||||
//// * Text before {@link /**/a} text after
|
||||
//// */
|
||||
//// c: (a: number) => void;
|
||||
//// }
|
||||
|
||||
verify.baselineQuickInfo();
|
||||
Reference in New Issue
Block a user