Signature help shows no JSDoc for a `const` with a function type annotation

Offen
#64,937 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

@MadalinWolf arbeitet bereits daran.

Seit 24.10.2026.

  • #64949 von @MadalinWolf — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
70/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
typescript
Bereich
tooling

Rechercherichtung

Start with the TypeScript language service code that provides signature help, then trace how it gets JSDoc for a function-typed const declaration. Compare the reported behavior for the declaration without an initializer, the declaration with an initializer, and an arrow function. Reproduce the case in the linked playground and add or update a regression test; done means signature help shows both the function and parameter documentation.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Bug Domain: LS: Signature Help
🔎 Search Terms

signature, parameter hints, jsdoc, const, type annotation, function type, @param

🕗 Version & Regression Information
  • This changed between versions 6.0.3 and 7.0.2 (also in 7.1.0-dev.20261023.1)
⏯ Playground Link

https://www.typescriptlang.org/play/?#code/PQKhCgAIUhBATeBnSB7AdgU0gF1ZAQ0nQFcBbAI0wCcA6KGAAQAcDqCzIA3AgGxOwAVABbZSlGrnwFEaLFPrRg4eJgDGvNtjUYkOQogDyWAFyQAFD36Yz4qtQCUkALwA+YuXsBucOBnxjTCA

💻 Code
/**
 * Adds one to a number.
 * @param value The number to add one to.
 */
declare const addOne: (value: number) => number;

addOne(1);
//     ^ trigger signature help here
🙁 Actual behavior

Signature help shows addOne(value: number): number with no description and no documentation for value. Hover on addOne does show the JSDoc.

(Type ( in the playground to ensure JSDoc is shown for the parameter in TS 6)

🙂 Expected behavior

Signature help shows "Adds one to a number." and "The number to add one to." for value, like 6.0.3 does.

Additional information about the issue

The same happens with an initializer, like const addOne: (value: number) => number = otherFunction.

(const addOne = (value: number) => value + 1 works: the docs come from the arrow function)

Vorherrschende Sprache
Go
Sterne
112k
Forks
15.4k
Ø Merge
3 T. 1 Std.
Gemergte PRs (30 T.)
136

Entwicklungsumgebung

In Codespaces öffnen

Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.

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.