JSDoc `@private` on constructor without parameters is omitted in declaration files

Offen
#58,653 0 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Bereich
compilers

Rechercherichtung

Beginne mit der verknüpften TypeScript Playground-Reproduktion unter Verwendung von foo.js und vergleiche die erzeugte Deklarationsdatei mit der erwarteten Ausgabe. Verfolge, wie der @private JSDoc des parameterlosen Konstruktors während der Deklarationsgenerierung dargestellt wird. Als erledigt gilt die Aufgabe, wenn die erzeugte .d.ts den privaten Konstruktor und seine Dokumentation beibehält, ohne das gemeldete Zugriffsverhalten des Konstruktors zu ändern.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Bug Domain: Declaration Emit
🔎 Search Terms

jsdoc private constructor

🕗 Version & Regression Information
  • This is the behavior in every version I tried back through TS 3.8 where JSDoc support was added, and I reviewed the FAQ for entries about JSDoc
⏯ Playground Link

https://www.typescriptlang.org/play/?target=99&module=1&ts=5.5.0-beta&ssl=8&ssc=10&pln=1&pc=1&filetype=js#code/MYGwhgzhAEBiD29oG8BQ0PQPQCofs2h2gAEAHAJwEsA3MAFwFMDMcsXph4A7CeigK7B68CgAoAlCgC+qWam6MA7nESSgA

💻 Code
// foo.js
class Foo {
    /**
     * @private
     */
    constructor() {}
}

new Foo()
// Constructor of class 'Foo' is private and only accessible within the class declaration.(2673)
🙁 Actual behavior

Emits the declaration file:

declare class Foo {
}
🙂 Expected behavior

Should emit the declaration file:

declare class Foo {
    /**
     * @private
     */
    private constructor();
}
Additional information about the issue

I ran into this as it was requested that TypeDoc add a new JSDoc tag to work around this issue. This seems wrong since the declaration file doesn't accurately describe the types within the file, but it's also very unfortunate that it results in the loss of any documentation added to the constructor.

https://github.com/TypeStrong/typedoc/issues/2577

Vorherrschende Sprache
Go
Sterne
111k
Forks
14.4k
Ø Merge
1 T. 15 Std.
Gemergte PRs (30 T.)
106

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/TypeScript

Alle Issues in microsoft/TypeScript

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.