microsoft / microsoft/TypeScript
Issue: TypeScript autocomplete for template literal types ignores user's Quote Style preference
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.3k
- Merge medio
- 2 d 4 h
- PR fusionados (30 d)
- 132
Descripción
### 🔎 Search Terms
List of keywords : "double", "quote", "preference", "style", "autcomplete", "template", "literral"
### 🕗 Version & Regression Information
TS Version : 6.0.3 or 7.0-rc
### ⏯ Playground Link
https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKghgIwDYQHJwLbQLxQOTACMeUAPvsAEx4DcAUKJFAMID2SArhgHbpZS48ASwAmJcngBucThFoNw0eMghtOPAVAAGAEgDeylHwgBfAHT61XXplNb6jaAClWQ7pr10oUVtwBcUAAKcABOwEIyADwAShAAxqwhIpGGquzWADSwiChWPAB8+fQm9AncAM7AUMAQlQEubh5ePv5Qnt5QzSZ0JUA
### 💻 Code
```ts
type TableName = 't1' | 't2';
type ColumnName = 'id' | 'value';
type TableColumn = `${TableName}.${ColumnName}`;
type Join = {
on: Partial>;
};
const test: Join = {
on: {
// Trigger autocomplete inside the object
}
};
```
### 🙁 Actual behavior
The key is inserted using double quotes (e.g., "t1.id": ...), overriding the user's preference for single quotes.
### 🙂 Expected behavior
The key should be inserted using the quote style defined in the editor's preferences (e.g., single quotes if 'single' is selected).
### Additional information about the issue
When using template literal types as keys in a Record or object mapping, the TypeScript language service's autocomplete functionality consistently forces double quotes (") when inserting the suggested keys, regardless of the user's configured javascript.preferences.quoteStyle or typescript.preferences.quoteStyle settings.
https://github.com/user-attachments/assets/e562b5ab-bbd7-48bd-96f8-a9181f03ba2e
This behavior is inconsistent with how standard string keys or property names are handled and complicates code consistency when working with complex template literal types in type-safe mappings.
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
Reproduce el ejemplo de template-literal Record en el TypeScript Playground enlazado, con la preferencia de comillas del editor configurada en comillas simples. Empieza siguiendo la ruta de autocompletado del TypeScript language service para las claves de objeto y, después, verifica que aceptar una clave sugerida conserve el estilo de comillas configurado tanto para las preferencias de JavaScript como para las de TypeScript.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- developer-experience
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Activo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 68/100