microsoft / microsoft/TypeScript
Issue: TypeScript autocomplete for template literal types ignores user's Quote Style preference
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
🔎 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
💻 Code
type TableName = 't1' | 't2';
type ColumnName = 'id' | 'value';
type TableColumn = `${TableName}.${ColumnName}`;
type Join = {
on: Partial<Record<TableColumn, TableColumn>>;
};
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the template-literal Record example in the linked TypeScript Playground with the editor quote preference set to single quotes. Start by tracing the TypeScript language service autocomplete path for object keys, then verify that accepting a suggested key preserves the configured quote style for both JavaScript and TypeScript preferences.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100