Mark the `typescript` peer dependency as optional

未关闭 适合新手
#2,364 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
json, typescript
领域
build-system

调研方向

检查 @tanstack/db 以及 issue 中列出的另外 14 个包的清单文件。先查看它们的 peerDependencies 和现有的 peerDependenciesMeta 条目。将 TypeScript peer 依赖标记为可选,同时保留其版本要求;当全部 15 个清单文件都包含可选元数据,且 JavaScript 使用者不再需要将 TypeScript 作为必需的 peer 依赖安装时,即完成。

由索引模型根据 Issue 内容生成。

描述

  • 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.

主要语言
TypeScript
星标
4k
派生
280
平均合并
1 天 10 小时
30 天内合并 PR
132

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TanStack/db 的其他 Issue

查看 TanStack/db 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。