microsoft / microsoft/TypeScript
Support labels in template string
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 117
Descripción
🔍 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.
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza con el ejemplo motivador de template literal y compáralo con el comportamiento existente de IntelliSense para etiquetas de tuplas al que se hace referencia en el issue. El trabajo estará terminado cuando las etiquetas de template literal mejoren la documentación de IntelliSense sin cambiar el tipo ni el comportamiento del JavaScript generado.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- compilers, developer-experience
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100