microsoft / microsoft/TypeScript

Show jsdoc for `keyof` when used as a parameter.

Aperta
#52,730 0 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: LS: Completion Lists Experience Enhancement Help Wanted Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Suggestion

🔍 Search Terms

  • keyof jsdoc
  • "keyof jsdoc"

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

When using keyof as a parameter for a function and the key has jsdoc, it would be nice if the jsdoc would show with the completion item in the editor. Currently it only shows the the item and no description of the item.

📃 Motivating Example

export interface ExampleInterface {
  /** Description of example 1. */
  example_one: string;
  /** Description of example 2. */
  example_two: string;
}

function example(usage: keyof ExampleInterface) {
  // Do something
}

// Show description of item in editor (`|` represents the cursor).
example('example_t|')

💻 Use Cases

With a library, the user may not know what the values mean without doing research. It would help if they could see the jsdoc for the item.

As seen here where something such as _ansestor has a meaning that someone may not know what it means without doing a web search.

image

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Non sono indicati né il file di implementazione né il test. Inizia tracciando la gestione del completamento dell’editor per un parametro keyof usando l’esempio TypeScript motivante, quindi individua i test di completamento pertinenti. Si considera completato quando gli elementi di completamento per le chiavi di ExampleInterface includono le descrizioni JSDoc delle loro proprietà.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript
Ambito
developer-experience
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.