microsoft / microsoft/TypeScript

Support labels in template string

Open
#57,385 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔍 Search Terms

template string label
template string name
interpolation label

✅ Viability Checklist
⭐ 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.

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

Start with the motivating template-literal example and compare it with the existing tuple-label IntelliSense behavior referenced in the issue. The work is done when template literal labels improve IntelliSense documentation without changing the type or emitted JavaScript behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.