Microsoft/TypeScript

How to jump to the definition of a template string type in VSCode?

Open

#55,819 建立於 2023年9月21日

在 GitHub 查看
 (0 留言) (0 反應) (0 負責人)TypeScript (6,726 fork)batch import
Domain: LS: Symbol NavigationExperience EnhancementHelp WantedSuggestion

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

  • 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.

貢獻者指南