microsoft / microsoft/TypeScript
Support labels in template string
Nessuno ha ancora preso questa issue.
- Lingua principale
- Go
- Stelle
- 111k
- Fork
- 14.3k
- Merge medio
- 1g 19h
- PR unite (30g)
- 117
Descrizione
🔍 Search Terms
template string label
template string name
interpolation label
✅ 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
The idea is to allow the addition of labels into a template literal.
This has no effect on the type itself in any way, the sole purpose is to give a better DX.
These labels would be shown by IntelliSense in order to provide the same experience as labels for the tuple labels.
📃 Motivating Example
// Template literal today
type Options = {
name: `${string}/${string}`;
}
// With labels
type Options = {
name: `${scope: string}/${baseName: string}`;
}
💻 Use Cases
This would offer a slightly better DX.
Right now you can document the parts of the template in a JSDoc comment, but the JSDoc is not preserve by IntelliSense in some cases.
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 con l’esempio motivante di template literal e confrontalo con il comportamento esistente di IntelliSense per le etichette delle tuple a cui si fa riferimento nell’issue. Il lavoro è completato quando le etichette dei template literal migliorano la documentazione di IntelliSense senza modificare il tipo né il comportamento del JavaScript emesso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- compilers, 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