Microsoft/TypeScript

Declaration emit of private properties should strip jsdoc

Open

#58.145 geöffnet am 10. Apr. 2024

Auf GitHub ansehen
 (1 Kommentar) (3 Reaktionen) (0 zugewiesene Personen)TypeScript (6.726 Forks)batch import
BugDomain: Declaration EmitHelp Wanted

Repository-Metriken

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

Beschreibung

🔎 Search Terms

jsdoc dts declaration emit private properties property

🕗 Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBAYwDYEMDOa4DEITgbwCg4S4B6AKgrgBUALAS0ybhTjAFcAjJBhOALbAYdCABMAdHAplipTjz7tuvBAFlhosQAoAlAQC+hOSUrV6LFmzBQGANxQxggzeIA0rAHZi4AdwZISHBczmgwtmBgwD4MnnAizmLAyChQjgwQcQBmAcBSMibstg5ORfaOwBoi4nqGhAZAA

💻 Code

export class Foo {
    /** This is a public method. */
    public publicMethod() {}

    /** This is a private method, and will be stripped in the declaration file. */
    private privateMethod() {}
}

🙁 Actual behavior

export declare class Foo {
    /** This is a public method. */
    publicMethod(): void;
    /** This is a private method, and will be stripped in the declaration file. */
    private privateMethod;
}

Note the jsdoc on the private method.

🙂 Expected behavior

export declare class Foo {
    /** This is a public method. */
    publicMethod(): void;
    private privateMethod;
}

Additional information about the issue

It sure seems like this info should be stripped; after all, the type information is gone, leaving only a marker to inform child classes.

This causes TypeScript's own dts files to be filled with private method jsdoc. https://github.com/microsoft/TypeScript/pull/57492/files#r1559884318

Contributor Guide