@@ -6178,7 +6178,7 @@ namespace ts {
6178
6178
return undefined;
6179
6179
}
6180
6180
6181
- function getTypeParametersFromJSDocTemplate(declaration: SignatureDeclaration ): TypeParameterDeclaration[] {
6181
+ function getTypeParametersFromJSDocTemplate(declaration: DeclarationWithTypeParameters ): TypeParameterDeclaration[] {
6182
6182
if (declaration.flags & NodeFlags.JavaScriptFile) {
6183
6183
const templateTag = getJSDocTemplateTag(declaration);
6184
6184
return templateTag && templateTag.typeParameters;
@@ -6188,9 +6188,9 @@ namespace ts {
6188
6188
6189
6189
// Return list of type parameters with duplicates removed (duplicate identifier errors are generated in the actual
6190
6190
// type checking functions).
6191
- function getTypeParametersFromDeclaration(typeParameterDeclarations: TypeParameterDeclaration[] ): TypeParameter[] {
6191
+ function getTypeParametersFromDeclaration(declaration: DeclarationWithTypeParameters ): TypeParameter[] {
6192
6192
let result: TypeParameter[];
6193
- forEach(typeParameterDeclarations , node => {
6193
+ forEach(declaration.typeParameters || getTypeParametersFromJSDocTemplate(declaration) , node => {
6194
6194
const tp = getDeclaredTypeOfTypeParameter(node.symbol);
6195
6195
if (!contains(result, tp)) {
6196
6196
if (!result) {
@@ -6391,8 +6391,7 @@ namespace ts {
6391
6391
const classType = declaration.kind === SyntaxKind.Constructor ?
6392
6392
getDeclaredTypeOfClassOrInterface(getMergedSymbol((<ClassDeclaration>declaration.parent).symbol))
6393
6393
: undefined;
6394
- const typeParameters = classType ? classType.localTypeParameters :
6395
- getTypeParametersFromDeclaration(declaration.typeParameters || getTypeParametersFromJSDocTemplate(declaration));
6394
+ const typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
6396
6395
const returnType = getSignatureReturnTypeFromDeclaration(declaration, isJSConstructSignature, classType);
6397
6396
const typePredicate = declaration.type && declaration.type.kind === SyntaxKind.TypePredicate ?
6398
6397
createTypePredicateFromTypePredicateNode(declaration.type as TypePredicateNode) :
@@ -8166,8 +8165,8 @@ namespace ts {
8166
8165
case SyntaxKind.ClassExpression:
8167
8166
case SyntaxKind.InterfaceDeclaration:
8168
8167
case SyntaxKind.TypeAliasDeclaration:
8169
- const typeParameters = ( node as DeclarationWithTypeParameters).typeParameters ||
8170
- getTypeParametersFromJSDocTemplate(node as SignatureDeclaration );
8168
+ const declaration = node as DeclarationWithTypeParameters;
8169
+ const typeParameters = declaration.typeParameters || getTypeParametersFromJSDocTemplate(declaration );
8171
8170
if (typeParameters) {
8172
8171
for (const d of typeParameters) {
8173
8172
if (contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) {
0 commit comments