microsoft / microsoft/TypeScript
VSCode not respecting declaration map without absolute sourceRoot
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.3k
- 平均マージ
- 2日 4時間
- マージ済み PR(30日)
- 132
説明
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.
コントリビューションガイド
調査の方向性
pnpm-workspace-exampleを使用してapps/web/src/app/page.tsxからLink.d.tsへのナビゲーションを再現し、次にpackages/ui/tsconfig.jsonをsourceRootの絶対値および相対値で比較します。declaration mapがどのように解決されるかを調査し、per-app paths overridesなしで相対設定がpackages/ui/src/components/Link.tsxへ移動することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript, vscode
- 領域
- developer-experience, tooling
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100