@@ -5355,9 +5355,9 @@ namespace ts {
5355
5355
return unknownType;
5356
5356
}
5357
5357
5358
- const declaration = <JSDocTypedefTag | TypeAliasDeclaration>find(symbol.declarations, d =>
5359
- d.kind === SyntaxKind.JSDocTypedefTag || d.kind === SyntaxKind.TypeAliasDeclaration);
5360
- const typeNode = declaration.kind === SyntaxKind.JSDocTypedefTag ? declaration.typeExpression : declaration.type;
5358
+ const declaration = <JSDocTypedefTag | JSDocCallbackTag | TypeAliasDeclaration>find(symbol.declarations, d =>
5359
+ isJSDocTypeAlias(d) || d.kind === SyntaxKind.TypeAliasDeclaration);
5360
+ const typeNode = isJSDocTypedefTag( declaration) ? declaration.typeExpression : isJSDocCallbackTag(declaration) ? declaration.signature : declaration.type;
5361
5361
// If typeNode is missing, we will error in checkJSDocTypedefTag.
5362
5362
let type = typeNode ? getTypeFromTypeNode(typeNode) : unknownType;
5363
5363
@@ -7575,24 +7575,25 @@ namespace ts {
7575
7575
*/
7576
7576
function getTypeFromTypeAliasReference(node: NodeWithTypeArguments, symbol: Symbol, typeArguments: Type[]): Type {
7577
7577
const type = getDeclaredTypeOfSymbol(symbol);
7578
+ // TODO: call getEffectiveTypeParameterDeclarations here and upgrade it to understand in-comment template tags as type parameters
7578
7579
const typeParameters = getSymbolLinks(symbol).typeParameters;
7579
7580
if (typeParameters) {
7580
7581
const numTypeArguments = length(node.typeArguments);
7581
7582
const minTypeArgumentCount = getMinTypeArgumentCount(typeParameters);
7582
7583
if (numTypeArguments < minTypeArgumentCount || numTypeArguments > typeParameters.length) {
7583
7584
error(node,
7584
- minTypeArgumentCount === typeParameters.length
7585
- ? Diagnostics.Generic_type_0_requires_1_type_argument_s
7586
- : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
7587
- symbolToString(symbol),
7588
- minTypeArgumentCount,
7589
- typeParameters.length);
7585
+ minTypeArgumentCount === typeParameters.length
7586
+ ? Diagnostics.Generic_type_0_requires_1_type_argument_s
7587
+ : Diagnostics.Generic_type_0_requires_between_1_and_2_type_arguments,
7588
+ symbolToString(symbol),
7589
+ minTypeArgumentCount,
7590
+ typeParameters.length);
7590
7591
return unknownType;
7591
7592
}
7592
7593
return getTypeAliasInstantiation(symbol, typeArguments);
7593
7594
}
7594
7595
return checkNoTypeArguments(node, symbol) ? type : unknownType;
7595
- }
7596
+ }
7596
7597
7597
7598
function getTypeReferenceName(node: TypeReferenceType): EntityNameOrEntityNameExpression | undefined {
7598
7599
switch (node.kind) {
0 commit comments