microsoft / microsoft/TypeScript

regression in "key remapping breaks definition navigation"

Open
#56,019 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Symbol Navigation Experience Enhancement Help Wanted Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

🔎 Search Terms

key remapping breaks goto definition navigation mapped type
key remap goto def
breaks definition navigation

🕗 Version & Regression Information
  • This changed between versions 4.3.5 and 4.4.4

This looks like a regression of the resolution from #47813.

⏯ Playground Link

https://www.typescriptlang.org/play?ts=4.1.5#code/JYOwLgpgTgZghgYwgAgGIHt3IN4ChkHIAOU6R0YAngFzIDOYUoA5rgL665XnIBSArgwCycIgEkwAHgAqAPmQBeHAG0ACslDIA1hEroYyaQF1aABg7cUI8WADqwMAAsAShAC2omfKXY1GkNq6+obIcHTI6hAAHpAgACbhDEwgzMgA-MgABh5E5HEA+gAk2Kpsmci0IBAAbtAmyOaceITIADYQYMjM6GDoACIQMACEtALCohKSGOiy+ITdvQMwAHQkZBSU7E1zBO2dC-2DI8jWEvZOrjlTmLMtAPR3DcgAtMgALMumywCsyCA99H4uXQUEgcR2yAe72WAEYfi9oQBmeHoLQQqEfTEAamQACJ-sg4oNQA5gOgAjB0Px4riIQclsscnl8mtyKDNhwgA

💻 Code
interface Foo {
    property: string
}

type MapItWithRemap<T> = {[P in keyof T as P extends string ? `mapped_${P}` : never]: 0}

{
    let gotoDef!: MapItWithRemap<Foo>
    // 0 - 4.0.5 not supported
    // 4.1.5 - 4.3.5 ok
    // 4.4.4+ "no definition found for 'mapped_property'"
    gotoDef.mapped_property
}
🙁 Actual behavior

goto definition cannot find originating property declaration

🙂 Expected behavior

goto definition can find originating property declaration

Additional information about the issue

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the mapped-type example in the linked TypeScript Playground and compare behavior across versions 4.3.5 and 4.4.4. Trace the definition-navigation path for gotoDef.mapped_property, using the reported #47813 resolution as context; done means navigation reaches Foo.property again.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.