microsoft / microsoft/TypeScript
Go-to-definition should only show relevant definitions when value & type have same name
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 117
Description
🔎 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
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
Start with the Playground reproduction and the go-to-definition request for the t in function f(arg: t). Trace how the language service resolves definitions when a type and value share a name; done means the result contains only the type definition, while preserving relevant definitions in other contexts.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100