microsoft / microsoft/TypeScript

VSCode not respecting declaration map without absolute sourceRoot

Đang mở
#62,009 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

7.0 LS Migration
Ngôn ngữ chính
Go
Star
111k
Fork
14.3k
Merge trung bình
2 ngày 4 giờ
Pull request đã merge (30 ngày)
132

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Tái hiện việc điều hướng từ apps/web/src/app/page.tsx đến Link.d.ts bằng pnpm-workspace-example, sau đó so sánh packages/ui/tsconfig.json với các giá trị sourceRoot tuyệt đối và tương đối. Kiểm tra cách declaration map được phân giải và xác minh rằng thiết lập tương đối điều hướng đến packages/ui/src/components/Link.tsx mà không có per-app paths overrides.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript, vscode
Lĩnh vực
developer-experience, tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.