Skip to content

Commit

Permalink
getJSDocTypeParameterDeclarations: Avoid unnecessary array (#24257)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy authored May 18, 2018
1 parent 04a3512 commit 1df7997
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 1df7997

Please sign in to comment.