microsoft / microsoft/TypeScript

Autocompletion of Template Literal Types with unresolved types.

Open
#61,217 0 comments 0 reactions 0 assignees View on GitHub
Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

**Extension**: Typescript Language Features
**Feature**: Autocompletion of Template Literal Types with unresolved types.

Hi,

Currently the autocompletion for template literal types stops working as soon as an ambiguous type is used in the template, like number or string.

![Image](https://github.com/user-attachments/assets/5ca015f0-15c3-4084-8529-7c53f942fde5)

![Image](https://github.com/user-attachments/assets/dadc1e91-52c3-4805-9722-7cf6ac56e0d7)

My idea is, that instead of proposing nothing at all, the autocompletion feature can be extended to propose a snippet with a template literal string and tabstops for the parameters or alternatively a normal string. String unions could be replaced with choices. The end result after selecting the completion would look like something like that:

![Image](https://github.com/user-attachments/assets/a812388f-e44c-43fe-b27b-3acb55667dd8)

This could be for example helpful with APIs that typed their Ressource pathes using parametrized template literals.

Contributor guide

Open the contributing guide

Research direction

Start with the TypeScript Language Features extension and reproduce the template-literal completion cases described in the report. Compare behavior for unresolved types, then clarify whether completion should produce a snippet with tab stops, a normal string, or union choices; done means the selected completion behaves consistently for these cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
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.