diff --git a/src/services/services.ts b/src/services/services.ts index 2df3b75ae6cb7..b17e761efe92e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -121,6 +121,7 @@ import { getSnapshotText, getSourceFileOfNode, getSourceMapper, + getSyntacticModifierFlags, getTokenPosOfNode, getTouchingPropertyName, getTouchingToken, @@ -1051,7 +1052,7 @@ function getDocumentationComment(declarations: readonly Declaration[] | undefine } function findBaseOfDeclaration(checker: TypeChecker, declaration: Declaration, cb: (symbol: Symbol) => T[] | undefined): T[] | undefined { - const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor ? declaration.parent.parent : declaration.parent; + const classOrInterfaceDeclaration = declaration.parent?.kind === SyntaxKind.Constructor && getSyntacticModifierFlags(declaration) & ModifierFlags.AccessibilityModifier ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; const isStaticMember = hasStaticModifier(declaration); diff --git a/tests/cases/fourslash/jsDocDontInheritFromSameNamedPropertyOnParameter1.ts b/tests/cases/fourslash/jsDocDontInheritFromSameNamedPropertyOnParameter1.ts new file mode 100644 index 0000000000000..93d6eacf50e60 --- /dev/null +++ b/tests/cases/fourslash/jsDocDontInheritFromSameNamedPropertyOnParameter1.ts @@ -0,0 +1,21 @@ +/// + +// https://github.com/microsoft/TypeScript/issues/62069 + +//// class Base { +//// /** +//// * This is a description of `someField` in the `Base` class. +//// * +//// * @deprecated +//// */ +//// someField: string = "whatever"; +//// } +//// +//// class Derived extends Base { +//// constructor(someField: string) { +//// super(); +//// console.log(someField/*1*/); +//// } +//// } + +verify.quickInfoAt("1", "(parameter) someField: string", undefined);