TypeScript icon indicating copy to clipboard operation
TypeScript copied to clipboard

VSCode not respecting declaration map without absolute sourceRoot

Open ishchhabra opened this issue 6 months ago • 3 comments

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.101.2
  • OS Version: MacOS 15.1.1

Steps to Reproduce:

  1. Clone https://github.com/ishchhabra/pnpm-workspace-example
  2. Open apps/web/src/app/page.tsx and CMD+Click on Link. It'll open the Link.d.ts file (from dist).

If I add "sourceRoot": "/Volumes/Development/pnpm-workspace-example/packages/ui/src" to packages/ui/tsconfig.json, it takes me to the Link.tsx file in packages/ui/src/components, however, using "sourceRoot": "./src" takes user to the declaration file in dist/.

I am able to workaround by adding "@packages/ui": ["../../packages/ui/src"] in paths in the tsconfig for apps/web, however that is not ideal since that requires defining paths in every app that uses the package.

ishchhabra avatar Jul 05 '25 15:07 ishchhabra

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.101.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

Just tried with latest version of VSCode as well. Same behavior.

ishchhabra avatar Jul 05 '25 15:07 ishchhabra

🤖 Thank you for your issue! I've done some analysis to help get you started. This response is automatically generated; feel free to 👍 or 👎 this comment according to its usefulness.


Similar Issues

Here are the most similar issues I found:

If your issue is a duplicate of one of these, feel free to close this issue. Otherwise, no action is needed. Thanks!

RyanCavanaugh avatar Oct 15 '25 21:10 RyanCavanaugh