mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
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:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user