microsoft / microsoft/TypeScript
Go-to-definition should only show relevant definitions when value & type have same name
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Go
- Sterne
- 111k
- Forks
- 14.3k
- Ø Merge
- 1 T. 19 Std.
- Gemergte PRs (30 T.)
- 117
Beschreibung
🔎 Search Terms
"go to definition", "same identifier", "value", "type"
🕗 Version & Regression Information
Always was the case, AFAIK
⏯ Playground Link
💻 Code
type t = {}
const t = {}
function f(arg: t) { } // going to definition on `t` here gives definitions of both - type and value `t`, even though value `t` cannot be used in this place: tsc - error TS2749: 't' refers to a value, but is being used as a type here. Did you mean 'typeof t'?
🙁 Actual behavior
"Go to definition" on a param type t shows 2 definitions - value & type which have same name - even though the value's definition is completely irrelevant.
🙂 Expected behavior
"Go to definition" shows only relevant definition of type t
Additional information about the issue
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Playground-Reproduktion und der go-to-definition-Anfrage für das t in function f(arg: t). Verfolge, wie der language service Definitionen auflöst, wenn ein Typ und ein Wert denselben Namen haben; als erledigt gilt die Aufgabe, wenn das Ergebnis nur die Typdefinition enthält und relevante Definitionen in anderen Kontexten erhalten bleiben.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 45/100