microsoft / microsoft/TypeScript
feat: support generic type name: `Record<name: string, value: string>`
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.4k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔍 Search Terms
generic type name
✅ Viability Checklist
- 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 isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
⭐ Suggestion
support Record<name: string, value: string>
📃 Motivating Example
Without Reocrd, we can write:
interface Obj {
[name: string]: string
}
Although value: string is still missing here, we have name info, but we can't archive same thing via Record util.
💻 Use Cases
- What do you want to use this for?
All generic types
- What shortcomings exist with current approaches?
I don't see any downsides
- What workarounds are you using in the meantime?
No type name
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 confrontando la sintassi proposta Record<name: string, value: string> con la firma di indice dell’interfaccia che la motiva e con il tipo utility Record esistente. Il lavoro è completato quando il comportamento previsto dei nomi di tipo generici è specificato con sufficiente chiarezza da poter valutare il suo impatto sul controllo dei tipi; l’issue non indica alcun file o test da eseguire.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100