microsoft / microsoft/TypeScript
Show function return type inlay hints even for JS functions that have explicit type annotations
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
Suggestion
🔍 Search Terms
- inlay hints
- return type
- function like
- JavaScript
⭐ Suggestion
Currently the javascript.inlayHints.functionLikeReturnTypes.enabled setting in VS Code adds inlay hints to JS functions that do not have an explicit @return annotation:
// Shown here
function foo() /* : number */ {
return 1;
}
// But not here here
/** @return {number} */
function foo() {
return 1;
}
This feels inconsistent, since I now have to look in different locations for the type information
I propose adding a new option that always enables these return types in JS files, even if there is an @return type annotation.
In the example above, this would result in the inlay hints showing on both functions:
function foo() /* : number */ {
return 1;
}
/** @return {number} */
function foo() /* : number */ {
return 1;
}
This lets me read the code more like standard TypeScript
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia tracciando l'impostazione esistente javascript.inlayHints.functionLikeReturnTypes.enabled e il modo in cui i tipi restituiti vengono soppressi quando è presente un'annotazione @return. Definisci l'interazione della nuova opzione con questa impostazione, quindi verifica che sia le funzioni JavaScript annotate sia quelle non annotate mostrino suggerimenti inline del tipo restituito quando è abilitata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript, typescript
- Ambito
- developer-experience, tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100