diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index ab0afb12820..a84e8eb8538 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1540,27 +1540,9 @@ namespace ts { } export function getJSDocParameterTags(param: ParameterDeclaration): JSDocParameterTag[] | undefined { - const func = param.parent; - const tags = getJSDocTags(func); - if (!tags) return undefined; - - if (!param.name) { - // this is an anonymous jsdoc param from a `function(type1, type2): type3` specification - const paramIndex = func.parameters.indexOf(param); - Debug.assert(paramIndex !== -1); - let curParamIndex = 0; - for (const tag of tags) { - if (isJSDocParameterTag(tag)) { - if (curParamIndex === paramIndex) { - return [tag]; - } - curParamIndex++; - } - } - } - else if (param.name.kind === SyntaxKind.Identifier) { - const name = (param.name as Identifier).text; - return tags.filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && tag.name.text === name) as JSDocParameterTag[]; + if (param.name && isIdentifier(param.name)) { + const name = param.name.text; + return getJSDocTags(param.parent).filter((tag): tag is JSDocParameterTag => isJSDocParameterTag(tag) && tag.name.text === name) as JSDocParameterTag[]; } else { // TODO: it's a destructured parameter, so it should look up an "object type" series of multiple lines