@@ -6170,24 +6170,16 @@ namespace ts {
6170
6170
return undefined;
6171
6171
}
6172
6172
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
-
6184
6173
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
6185
6174
// 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 => {
6189
6178
const tp = getDeclaredTypeOfTypeParameter(node.symbol);
6190
6179
if (!contains(result, tp)) {
6180
+ if (!result) {
6181
+ result = [];
6182
+ }
6191
6183
result.push(tp);
6192
6184
}
6193
6185
});
@@ -6383,9 +6375,7 @@ namespace ts {
6383
6375
const classType = declaration.kind === SyntaxKind.Constructor ?
6384
6376
getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
6385
6377
: undefined;
6386
- const typeParameters = classType ? classType.localTypeParameters :
6387
- declaration.typeParameters ? getTypeParametersFromDeclaration(declaration.typeParameters) :
6388
- getTypeParametersFromJSDocTemplate(declaration);
6378
+ const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
6389
6379
const returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
6390
6380
const typePredicate = declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ?
6391
6381
createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
@@ -8166,9 +8156,9 @@ namespace ts {
8166
8156
case SyntaxKind.ClassExpression:
8167
8157
case SyntaxKind.InterfaceDeclaration:
8168
8158
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) {
8172
8162
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
8173
8163
return true;
8174
8164
}
0 commit comments