microsoft / microsoft/TypeScript
How to jump to the definition of a template string type in VSCode?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
- VS Code Version: 1.82.2
- OS Version: win11
I’m using TypeScript 5.2.2 and VSCode 1.82.2, and I have a problem with jumping to the definition of a template string type.
Here is my code:
type Test<T extends object> = {
[K in keyof T]: () => void
} & {
[K in keyof T as `${string & K}Sync`]: () => void
}
const a = {
getValue() {}
}
const b = {} as Test<typeof a>
b.getValueSync()
b.getValue()
I want to jump to the definition of the Test type, but when I press F12 on getValueSync, nothing happens. However, when I press F12 on getValue, it works fine and jumps to the definition of a.getValue.
I wonder if this is a bug or a limitation of VSCode or TypeScript, and how can I solve it. Any help or suggestion would be appreciated. Thank you.
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 reported F12 behavior in TypeScript 5.2.2 and VS Code 1.82.2 using the template-literal mapped type example in the issue. No repository file or test is named; trace the language-service definition request for getValueSync, then verify the behavior against getValue and document or test the expected result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100