Mark the `typescript` peer dependency as optional

オープン 初心者向け
#2,364 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
json, typescript
領域
build-system

調査の方向性

@tanstack/db と、issue に記載されている他の 14 個のパッケージのパッケージマニフェストを調べてください。まず、それぞれの peerDependencies と、既存の peerDependenciesMeta エントリーを確認してください。TypeScript の peer dependency を optional にし、バージョン要件は維持してください。15 個すべてのマニフェストに optional のメタデータがあり、JavaScript の利用者が TypeScript を必須の peer dependency としてインストールしなくてよくなれば完了です。

索引モデルが 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時間
マージ済み PR(30日)
132

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

TanStack/db のほかの issue

TanStack/db の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。