From 1df79970144489924daa2fa1ef056d847488a8a5 Mon Sep 17 00:00:00 2001 From: Andy Date: Fri, 18 May 2018 13:53:27 -0700 Subject: [PATCH] getJSDocTypeParameterDeclarations: Avoid unnecessary array (#24257) --- src/compiler/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 300c6421dbc60..df19a8948c722 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -3114,9 +3114,9 @@ namespace ts { } export function getJSDocTypeParameterDeclarations(node: DeclarationWithTypeParameters): ReadonlyArray { - 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; }