@@ -6170,24 +6170,16 @@ namespace ts {
61706170 return undefined;
61716171 }
61726172
6173- function getTypeParametersFromJSDocTemplate(declaration: SignatureDeclaration): TypeParameter[] {
6174- if (declaration.flags & NodeFlags.JavaScriptFile) {
6175- const templateTag = getJSDocTemplateTag(declaration);
6176- if (templateTag) {
6177- return getTypeParametersFromDeclaration(templateTag.typeParameters);
6178- }
6179- }
6180-
6181- return undefined;
6182- }
6183-
61846173 // Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
61856174 // type checking functions).
6186- function getTypeParametersFromDeclaration(typeParameterDeclarations: TypeParameterDeclaration[] ): TypeParameter[] {
6187- const result: TypeParameter[] = [];
6188- forEach(typeParameterDeclarations , node => {
6175+ function getTypeParametersFromDeclaration(declaration: DeclarationWithTypeParameters ): TypeParameter[] {
6176+ let result: TypeParameter[];
6177+ forEach(getEffectiveTypeParameterDeclarations(declaration) , node => {
61896178 const tp = getDeclaredTypeOfTypeParameter(node.symbol);
61906179 if (!contains(result, tp)) {
6180+ if (!result) {
6181+ result = [];
6182+ }
61916183 result.push(tp);
61926184 }
61936185 });
@@ -6383,9 +6375,7 @@ namespace ts {
63836375 const classType = declaration.kind === SyntaxKind.Constructor ?
63846376 getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
63856377 : undefined;
6386- const typeParameters = classType ? classType.localTypeParameters :
6387- declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
6388- getTypeParametersFromJSDocTemplate(declaration);
6378+ const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
63896379 const returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
63906380 const typePredicate = declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ?
63916381 createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
@@ -8166,9 +8156,9 @@ namespace ts {
81668156 case SyntaxKind.ClassExpression:
81678157 case SyntaxKind.InterfaceDeclaration:
81688158 case SyntaxKind.TypeAliasDeclaration:
8169- const declaration = node as DeclarationWithTypeParameters;
8170- if (declaration. typeParameters) {
8171- for (const d of declaration. typeParameters) {
8159+ const typeParameters = getEffectiveTypeParameterDeclarations( node as DeclarationWithTypeParameters) ;
8160+ if (typeParameters) {
8161+ for (const d of typeParameters) {
81728162 if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
81738163 return true;
81748164 }
0 commit comments