Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: go to definition not working with project references and disableSourceOfProjectReferenceRedirect #5580

Open
1 task done
relsunkaev opened this issue Mar 22, 2024 · 4 comments
Labels
🐛 bug: unconfirmed ⏳ close if no activity Will be closed if no activity happens within a few weeks

Comments

@relsunkaev
Copy link

relsunkaev commented Mar 22, 2024

Provide environment information

System:
  OS: macOS 14.3.1
  CPU: (10) arm64 Apple M1 Pro
  Memory: 112.91 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Binaries:
  Node: 16.18.1 - ~/Library/Caches/fnm_multishells/66181_1711122384805/bin/node
  Yarn: 1.22.19 - ~/Library/Caches/fnm_multishells/66181_1711122384805/bin/yarn
  npm: 9.2.0 - ~/Library/Caches/fnm_multishells/66181_1711122384805/bin/npm
  pnpm: 7.26.2 - ~/Library/Caches/fnm_multishells/66181_1711122384805/bin/pnpm
Browsers:
  Chrome: 123.0.6312.59
  Edge: 122.0.2365.92
  Safari: 17.3.1
npmPackages:
  typescript: ^5.4.3 => 5.4.3

Describe the bug

As described in the title, when using project references with disableSourceOfProjectReferenceRedirect set to true and declaration maps enabled, go to definition stops working. Works fine if disableSourceOfProjectReferenceRedirect is set to false.

It seems going to definition just brings you to the closing bracket of the outermost router.

Link to reproduction

https://github.com/relsunkaev/ts-declaration-map-repro

To reproduce

Try going to definition of a router from api client. See where that gets ya.

Additional information

I have a suspicion that this is a typescript bug, but wanted to check with you guys first before submitting an issue there. Our repo has gotten quite large and disableSourceOfProjectReferenceRedirect is the difference between waiting 5-10 seconds on every change and instant feedback in VSCode

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd be down to file a PR fixing this bug!

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@KATT
Copy link
Member

KATT commented Mar 22, 2024

I'm very excited to see the outcome of your work here, but I honestly don't know if this is how TypeScript is meant to work with disableSourceOfProjectReferenceRedirect or not

I wonder if I can make a wild @mattpocock appear? 👀

@KATT
Copy link
Member

KATT commented Apr 25, 2024

I doubt this has anything to do with tRPC and rather how disableSourceOfProjectReferenceRedirect works...?

@KATT KATT added the ⏳ close if no activity Will be closed if no activity happens within a few weeks label Apr 25, 2024
@relsunkaev
Copy link
Author

I don't think this is an issue with tRPC but I also don't think that this is how disableSourceOfProjectReferenceRedirect with declaration maps is supposed to work.

I wasn't able to reproduce this issue outside of using tRPC in my couple hours of digging into this. I am able to import a type and go to definition using a simpler version of the "router type in client" pattern. It seems there is something about tRPC's types that trips up declaration map generation.

@KATT
Copy link
Member

KATT commented May 1, 2024

Can you share a repo of what did work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug: unconfirmed ⏳ close if no activity Will be closed if no activity happens within a few weeks
Projects
None yet
Development

No branches or pull requests

2 participants