getJSDocTypeParameterDeclarations: Avoid unnecessary array (#24257)

This commit is contained in:
Andy 2018-05-18 13:53:27 -07:00 committed by GitHub
parent 04a351224c
commit 1df7997014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3114,9 +3114,9 @@ namespace ts {
}
export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray<TypeParameterDeclaration> {
const tags = filter(getJSDocTags(node), isJSDocTemplateTag);
// template tags are only available when a typedef isn't already using them
const tag = find(tags, tag => !(tag.parent.kind === SyntaxKind.JSDocComment && find(tag.parent.tags, isJSDocTypeAlias)));
const tag = find(getJSDocTags(node), (tag): tag is JSDocTemplateTag =>
isJSDocTemplateTag(tag) && !(tag.parent.kind === SyntaxKind.JSDocComment && tag.parent.tags!.some(isJSDocTypeAlias)));
return (tag && tag.typeParameters) || emptyArray;
}