fix(45907): don't use static member name to inherit JSDocs from instance members (#46274)

This commit is contained in:
Oleksandr T
2021-11-09 01:05:08 +02:00
committed by GitHub
parent 9713cc1a75
commit a05d851dc3
2 changed files with 11 additions and 3 deletions

View File

@@ -599,10 +599,11 @@ namespace ts {
}
function findBaseOfDeclaration<T>(checker: TypeChecker, declaration: Declaration, cb: (symbol: Symbol) => T[] | undefined): T[] | undefined {
if (hasStaticModifier(declaration)) return;
const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor ? declaration.parent.parent : declaration.parent;
if (!classOrInterfaceDeclaration) {
return;
}
if (!classOrInterfaceDeclaration) return;
return firstDefined(getAllSuperTypeNodes(classOrInterfaceDeclaration), superTypeNode => {
const symbol = checker.getPropertyOfType(checker.getTypeAtLocation(superTypeNode), declaration.symbol.name);
return symbol ? cb(symbol) : undefined;