Skip to content

Commit 0a8ddca

Browse files
author
Andy
authored
getJSDocParameterTags: no need to handle JSDocFunctionType, just return undefined (microsoft#16837)
* getJSDocParameterTags: no need to handle JSDocFunctionType, just return undefined * Fix type error
1 parent fb89d47 commit 0a8ddca

1 file changed

Lines changed: 3 additions & 21 deletions

File tree

src/compiler/utilities.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,27 +1540,9 @@ namespace ts {
15401540
}
15411541

15421542
export function getJSDocParameterTags(param: ParameterDeclaration): JSDocParameterTag[] | undefined {
1543-
const func = param.parent;
1544-
const tags = getJSDocTags(func);
1545-
if (!tags) return undefined;
1546-
1547-
if (!param.name) {
1548-
// this is an anonymous jsdoc param from a `function(type1, type2): type3` specification
1549-
const paramIndex = func.parameters.indexOf(param);
1550-
Debug.assert(paramIndex !== -1);
1551-
let curParamIndex = 0;
1552-
for (const tag of tags) {
1553-
if (isJSDocParameterTag(tag)) {
1554-
if (curParamIndex === paramIndex) {
1555-
return [tag];
1556-
}
1557-
curParamIndex++;
1558-
}
1559-
}
1560-
}
1561-
else if (param.name.kind === SyntaxKind.Identifier) {
1562-
const name = (param.name as Identifier).text;
1563-
return tags.filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && tag.name.text === name) as JSDocParameterTag[];
1543+
if (param.name && isIdentifier(param.name)) {
1544+
const name = param.name.text;
1545+
return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && tag.name.text === name) as JSDocParameterTag[];
15641546
}
15651547
else {
15661548
// TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines

0 commit comments

Comments
 (0)