microsoft / microsoft/TypeScript

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

Aperta
#55,819 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Domain: LS: Symbol Navigation Experience Enhancement Help Wanted Suggestion
Lingua principale
Go
Stelle
111k
Fork
14.3k
Merge medio
1g 19h
PR unite (30g)
117

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Riproduci il comportamento F12 segnalato in TypeScript 5.2.2 e VS Code 1.82.2 usando l’esempio di tipo mappato tramite template literal presente nell’issue. Non viene indicato alcun file del repository né alcun test; traccia la richiesta di definizione del language service per getValueSync, quindi verifica il comportamento rispetto a getValue e documenta o testa il risultato atteso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
typescript, vscode
Ambito
devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.