microsoft / microsoft/TypeScript

Parameter hints while overriding methods

Aperta
#42,668 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Awaiting More Feedback Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

Suggestion

It would be nice to get parameter hints while overriding methods or implementing abstract methods.

🔍 Search Terms

  • parameter hints
  • overriding methods
  • abstract parameters

✅ 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 implementing an abstract class or overriding an existing class's methods, it would be great to be able to see the parameter hints for that method in the editor.

📃 Motivating Example

abstract class A {
  abstract foo(param1: string, param2: number, param3: boolean): void;
}

class B extends A {
  foo(/*trigger parameter hints here, see nothing*/)
}

type AA = {
  foo(param1: string, param2: number, param3: boolean): void;
}

const BB: AA = {
  foo(/*trigger parameter hints here, see lovely results*/)
}

Playground. (use Ctrl/Cmd+Shift+Space to trigger parameter hints)
image

💻 Use Cases

I'd use this when implementing abstract classes to remember the parameters I get to use.

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

Inizia dagli esempi TypeScript e dal Playground collegato per riprodurre i suggerimenti dei parametri durante l'implementazione di metodi astratti o sovrascritti. L'issue non indica file del repository né test, quindi traccia il comportamento dei suggerimenti dei parametri dell'editor e aggiungi una copertura che mostri che le firme vengono proposte sia nei casi di metodi di classe sia in quelli di letterali di oggetto.

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

Valutazione

Stack tecnologico
typescript
Ambito
developer-experience
Tipo di issue
Funzionalità
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.