Microsoft/TypeScript

Derived class constructor parameter incorrectly inherits JSDoc from parent class's field of the same name

Open

#62.069 geöffnet am 15. Juli 2025

Auf GitHub ansehen
 (0 Kommentare) (1 Reaktion) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: JSDocHelp Wanted

Repository-Metriken

Stars
 (48.455 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (9 gemergte PRs in 30 T)

Beschreibung

🔎 Search Terms

inheritance, JSDoc,

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play/?ssl=11&ssc=55&pln=11&pc=56#code/MYGwhgzhAEBCkFNoG8BQ0PQPQCofXU2nwBUALASxiujGgBMEJgAnCgBwBcKB7AO2g8AZtAAGEHgFsEAMQoIQ9UdAoDOZJKPgQEy0JAgA6QpnwmM+AAKN2LBMDCcE9AkWJZzE6XIX0AXNAQnGx8AObQALzQAOQA7mSOCABuCCzRANyoAL6oqPpQ0AAiqRQpLggAHk589DDaSGhEWFjQ5DTiUrLyisoJMHw86qrhnDwMY7EU6mJeXb7KqtDqSABGiND5EAA05s2BY1OBZDwArorQA5wqfBpsV1MwAFIAyoU8wMZEwPxBLCfAoxYAApZj5FAFfsMAJQocxECAndipIFQzJuTDfPgSEAIQwgHihEGdMH0VHmHJZIA

💻 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.

Contributor Guide