fix(50117): Using @extends in JavaScript + JSDoc removes method documentations (#50256)

* fix(50117): show jsdoc from an inherited members

* show jsdoc from inherited members from class expressions
This commit is contained in:
Oleksandr T
2022-12-13 01:22:03 +02:00
committed by GitHub
parent d54f52e0de
commit 8f2a38f44b
5 changed files with 200 additions and 6 deletions

View File

@@ -260,6 +260,7 @@ import {
isImportTypeNode,
isInterfaceDeclaration,
isJSDoc,
isJSDocAugmentsTag,
isJSDocFunctionType,
isJSDocLinkLike,
isJSDocMemberName,
@@ -2763,7 +2764,7 @@ export function isExpressionNode(node: Node): boolean {
case SyntaxKind.MetaProperty:
return true;
case SyntaxKind.ExpressionWithTypeArguments:
return !isHeritageClause(node.parent);
return !isHeritageClause(node.parent) && !isJSDocAugmentsTag(node.parent);
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) {
node = node.parent;
@@ -6117,11 +6118,18 @@ export interface ClassImplementingOrExtendingExpressionWithTypeArguments {
}
/** @internal */
export function tryGetClassImplementingOrExtendingExpressionWithTypeArguments(node: Node): ClassImplementingOrExtendingExpressionWithTypeArguments | undefined {
return isExpressionWithTypeArguments(node)
&& isHeritageClause(node.parent)
&& isClassLike(node.parent.parent)
? { class: node.parent.parent, isImplements: node.parent.token === SyntaxKind.ImplementsKeyword }
: undefined;
if (isExpressionWithTypeArguments(node)) {
if (isHeritageClause(node.parent) && isClassLike(node.parent.parent)) {
return { class: node.parent.parent, isImplements: node.parent.token === SyntaxKind.ImplementsKeyword };
}
if (isJSDocAugmentsTag(node.parent)) {
const host = getEffectiveJSDocHost(node.parent);
if (host && isClassLike(host)) {
return { class: host, isImplements: false };
}
}
}
return undefined;
}
/** @internal */