microsoft / microsoft/TypeScript

Issue: TypeScript autocomplete for template literal types ignores user's Quote Style preference

Open
#63,603 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Domain: LS: Completion Lists
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

https://www.typescriptlang.org/play/?#code/C4TwDgpgBAKghgIwDYQHJwLbQLxQOTACMeUAPvsAEx4DcAUKJFAMID2SArhgHbpZS48ASwAmJcngBucThFoNw0eMghtOPAVAAGAEgDeylHwgBfAHT61XXplNb6jaAClWQ7pr10oUVtwBcUAAKcABOwEIyADwAShAAxqwhIpGGquzWADSwiChWPAB8+fQm9AncAM7AUMAQlQEubh5ePv5Qnt5QzSZ0JUA

💻 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.