Microsoft/TypeScript
在 GitHub 查看Derived class constructor parameter incorrectly inherits JSDoc from parent class's field of the same name
Open
#62,069 建立於 2025年7月15日
BugDomain: JSDocHelp Wanted
倉庫指標
- Star
- (48,455 star)
- PR 合併指標
- (平均合併 6天 17小時) (30 天內合併 9 個 PR)
描述
🔎 Search Terms
inheritance, JSDoc,
🕗 Version & Regression Information
- This is the behavior in every version I tried
⏯ Playground Link
💻 Code
class Base {
/**
* This is a description of `someField` in the `Base` class.
*
* @deprecated
*/
someField: string = 'whatever';
}
class Derived extends Base {
// This `someField` has nothing to do with `someField` in the base class,
// so it should not inherit its JSDoc.
constructor(someField: string) {
super();
console.log(someField);
}
}
🙁 Actual behavior
Hovering shows the JSDoc from the parent class
🙂 Expected behavior
Hovering should not show any JSDoc description
Additional information about the issue
This impacts https://github.com/typescript-eslint/typescript-eslint/issues/11394, since we look for @deprecated JSDoc attributes via the API, which are showing up spuriously in this case.