Skip to content

Commit c2bbfaf

Browse files
committed
Fix getParameterSymbolFromJSDoc
1 parent ecdc4b3 commit c2bbfaf

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/compiler/utilities.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1606,8 +1606,19 @@ namespace ts {
16061606
return undefined;
16071607
}
16081608
const name = node.name.escapedText;
1609-
const func = getJSDocHost(node);
1610-
if (!isFunctionLike(func)) {
1609+
const decl = getJSDocHost(node);
1610+
let func: FunctionLike;
1611+
if (isExpressionStatement(decl) && isBinaryExpression(decl.expression) && isFunctionLike(decl.expression.right)) {
1612+
func = decl.expression.right;
1613+
}
1614+
else if (isVariableStatement(decl) && decl.declarationList.declarations.length === 1 && isVariableDeclaration(decl.declarationList.declarations[0])
1615+
&& isFunctionLike(decl.declarationList.declarations[0].initializer)) {
1616+
func = decl.declarationList.declarations[0].initializer as FunctionLike;
1617+
}
1618+
else if (isFunctionLike(decl)) {
1619+
func = decl;
1620+
}
1621+
else {
16111622
return undefined;
16121623
}
16131624
const parameter = find(func.parameters, p =>

0 commit comments

Comments
 (0)