Mark the `typescript` peer dependency as optional

Đang mở Phù hợp với người mới
#2,364 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

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

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
json, typescript
Lĩnh vực
build-system

Hướng nghiên cứu

Kiểm tra các tệp manifest của gói @tanstack/db và 14 gói khác được liệt kê trong issue. Trước tiên, hãy kiểm tra peerDependencies của chúng và mọi mục hiện có trong peerDependenciesMeta. Đánh dấu peer dependency của TypeScript là tùy chọn nhưng vẫn giữ nguyên yêu cầu về phiên bản; hoàn tất khi cả 15 tệp manifest đều có siêu dữ liệu tùy chọn và người dùng JavaScript không còn phải cài đặt TypeScript dưới dạng peer dependency bắt buộc.

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

Mô tả

  • I've validated the bug against the latest version of DB packages

Describe the bug

@tanstack/db declares "typescript": ">=4.7" in peerDependencies without a peerDependenciesMeta entry, so the peer is required. Fourteen other packages in this repo declare the same peer: db-ivm, query-db-collection, convex-db-collection, rxdb-db-collection, trailbase-db-collection, db-sqlite-persistence-core and the browser, Capacitor, Cloudflare Durable Objects, Electron, Expo, Node, React Native and Tauri SQLite persistence packages.

None of these packages import typescript, so the peer only states the minimum TypeScript version for the published types. Because it is required, npm, pnpm (with its default auto-install-peers) and Bun install TypeScript for every consumer, including JavaScript projects and projects that type-check with a different compiler.

To Reproduce

mkdir repro && cd repro && npm init -y
npm install @tanstack/db
npm ls typescript

npm ls typescript lists [email protected], pulled in by @tanstack/db and @tanstack/db-ivm. On macOS arm64, TypeScript and its native binary take about 30 MB of the 43 MB node_modules.

Expected behavior

Only projects that use TypeScript install it. Marking the peer as optional keeps the version requirement for them:

"peerDependenciesMeta": {
  "typescript": { "optional": true }
}

Additional context

The other TanStack libraries (@tanstack/query-core, @tanstack/router-core, @tanstack/form-core, @tanstack/store) declare no TypeScript peer. Happy to send a PR that adds peerDependenciesMeta to the 15 packages.

Ngôn ngữ chính
TypeScript
Star
4k
Fork
280
Merge trung bình
1 ngày 10 giờ
Pull request đã merge (30 ngày)
132

Chuẩn bị môi trường

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.

Issue khác của TanStack/db

Tất cả issue của TanStack/db

Issue tương tự

Thêm issue về TypeScript

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.