Pin @types/react and @types/react-dom to 18.x to avoid TS errors from mixed versions#3267
Pin @types/react and @types/react-dom to 18.x to avoid TS errors from mixed versions#3267matt-aitken wants to merge 1 commit intomainfrom
Conversation
|
WalkthroughThe pull request adds version pinning for React type packages in Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@package.json`:
- Around line 91-92: The pnpm.overrides currently pins `@types/react` and
`@types/react-dom` to 18.2.69 which silently downgrades packages under references/
(d3-chat, realtime-streams, realtime-hooks-test, d3-openai-agents) that declare
^19 and also masks compatibility for packages/react-hooks and packages/rsc that
use "*" — decide and implement one of two fixes: either remove the global
override and only add per-package overrides for the specific packages that must
remain on 18, or keep the override but change the four references/* packages to
explicit `@types/react/`@types/react-dom ^18 or remove their ^19 constraint;
additionally replace "*" in packages/react-hooks and packages/rsc with explicit
version ranges (e.g., ^18 || ^19) if they must support multiple React versions,
and update pnpm.overrides entries to target only the package names that truly
require the 18.x types (use the pnpm.overrides key names and package names
d3-chat, realtime-streams, realtime-hooks-test, d3-openai-agents,
packages/react-hooks, packages/rsc to locate the changes).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f4f00c61-2d7f-4881-97b3-c1d08711397d
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (1)
package.json
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (26)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (8, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (7, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (4, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (5, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (2, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (3, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (7, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (8, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (2, 8)
- GitHub Check: units / webapp / 🧪 Unit Tests: Webapp (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (1, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (6, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (4, 8)
- GitHub Check: units / internal / 🧪 Unit Tests: Internal (5, 8)
- GitHub Check: e2e / 🧪 CLI v3 tests (ubuntu-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - pnpm)
- GitHub Check: e2e / 🧪 CLI v3 tests (windows-latest - npm)
- GitHub Check: sdk-compat / Cloudflare Workers
- GitHub Check: units / packages / 🧪 Unit Tests: Packages (1, 1)
- GitHub Check: sdk-compat / Node.js 22.12 (ubuntu-latest)
- GitHub Check: sdk-compat / Deno Runtime
- GitHub Check: sdk-compat / Node.js 20.20 (ubuntu-latest)
- GitHub Check: sdk-compat / Bun Runtime
- GitHub Check: typecheck / typecheck
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{js,ts,jsx,tsx,json,md,yaml,yml}
📄 CodeRabbit inference engine (AGENTS.md)
Format code using Prettier before committing
Files:
package.json
🧠 Learnings (7)
📓 Common learnings
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:14.566Z
Learning: Applies to packages/**/*.{ts,tsx,js,jsx} : Add a changeset via `pnpm run changeset:add` when modifying any public package (`packages/*` or `integrations/*`) - default to patch for bug fixes and minor changes
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-15T10:48:02.687Z
Learning: Use pnpm as the package manager (version 10.23.0 or later) and Node.js 20.20.0
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:14.566Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use pnpm for package management in this monorepo (version 10.23.0) with Turborepo for orchestration - run commands from root with `pnpm run`
📚 Learning: 2026-03-23T06:24:14.566Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:14.566Z
Learning: Applies to packages/**/*.{ts,tsx,js,jsx} : Add a changeset via `pnpm run changeset:add` when modifying any public package (`packages/*` or `integrations/*`) - default to patch for bug fixes and minor changes
Applied to files:
package.json
📚 Learning: 2026-01-15T10:48:02.687Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-15T10:48:02.687Z
Learning: Use pnpm as the package manager (version 10.23.0 or later) and Node.js 20.20.0
Applied to files:
package.json
📚 Learning: 2026-03-23T06:24:14.566Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:14.566Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use pnpm for package management in this monorepo (version 10.23.0) with Turborepo for orchestration - run commands from root with `pnpm run`
Applied to files:
package.json
📚 Learning: 2026-03-23T06:24:14.566Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:14.566Z
Learning: Applies to packages/**/*.{ts,tsx,js,jsx} : For public packages (`packages/*`), use `pnpm run build --filter <package>` for verification
Applied to files:
package.json
📚 Learning: 2026-03-23T06:24:25.028Z
Learnt from: CR
Repo: triggerdotdev/trigger.dev PR: 0
File: apps/webapp/CLAUDE.md:0-0
Timestamp: 2026-03-23T06:24:25.028Z
Learning: Never run `pnpm run build --filter webapp` to verify changes. For the webapp (which is an app, not a public package), use typecheck instead: `pnpm run typecheck --filter webapp` (~1-2 minutes)
Applied to files:
package.json
📚 Learning: 2025-11-26T14:40:07.146Z
Learnt from: ericallam
Repo: triggerdotdev/trigger.dev PR: 2710
File: packages/schema-to-json/package.json:0-0
Timestamp: 2025-11-26T14:40:07.146Z
Learning: Node.js 24+ has native TypeScript support and can execute .ts files directly without tsx or ts-node for scripts that use only erasable TypeScript syntax (type annotations, interfaces, etc.). The trigger.dev repository uses Node.js 24.11.1+ and scripts like updateVersion.ts can be run with `node` instead of `tsx`.
Applied to files:
package.json
| "@types/react": "18.2.69", | ||
| "@types/react-dom": "18.2.7", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Find all packages declaring React types and check for React 19 API usage
echo "=== Packages declaring `@types/react` ==="
fd -t f "package.json" | xargs rg -l "@types/react" | while read -r file; do
echo -e "\n📦 $file"
cat "$file" | jq -r '.devDependencies["@types/react"] // .dependencies["@types/react"] // empty' | sed 's/^/ `@types`\/react: /'
cat "$file" | jq -r '.devDependencies["@types/react-dom"] // .dependencies["@types/react-dom"] // empty' | sed 's/^/ `@types`\/react-dom: /'
done
echo -e "\n=== Searching for React 19 API usage in d3-chat ==="
rg -n --type=ts --type=tsx -g 'references/d3-chat/**/*' '\b(useActionState|useFormStatus|useOptimistic|use\(|startTransition|experimental_taintObjectReference)\b' || echo "No React 19 API usage found"
echo -e "\n=== Checking if affected packages are public ==="
for pkg in packages/react-hooks packages/cli-v3; do
if [ -f "$pkg/package.json" ]; then
echo -e "\n📦 $pkg"
cat "$pkg/package.json" | jq -r 'if .private == true then " Private: true" else " Public or not specified (likely public)" end'
fi
doneRepository: triggerdotdev/trigger.dev
Length of output: 1220
React version override affects multiple packages and needs clarification on intended scope.
The pnpm.overrides pins all packages to React 18 types, but several packages in references/ explicitly declare React 19 types: d3-chat, realtime-streams, realtime-hooks-test, and d3-openai-agents (all using ^19). While a search found no React 19 API usage in d3-chat, the override will still silently downgrade all four packages.
Additionally, packages/react-hooks and packages/rsc use wildcards ("*") for both type packages, which now pin to 18.2.69. If these packages are meant to support multiple React versions, pinning them this way may mask compatibility issues.
Clarify:
- Is the downgrade of React 19 packages intentional, or should they remain unpinned?
- Should
packages/react-hooksandpackages/rscuse explicit version constraints instead of wildcards?
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@package.json` around lines 91 - 92, The pnpm.overrides currently pins
`@types/react` and `@types/react-dom` to 18.2.69 which silently downgrades packages
under references/ (d3-chat, realtime-streams, realtime-hooks-test,
d3-openai-agents) that declare ^19 and also masks compatibility for
packages/react-hooks and packages/rsc that use "*" — decide and implement one of
two fixes: either remove the global override and only add per-package overrides
for the specific packages that must remain on 18, or keep the override but
change the four references/* packages to explicit `@types/react/`@types/react-dom
^18 or remove their ^19 constraint; additionally replace "*" in
packages/react-hooks and packages/rsc with explicit version ranges (e.g., ^18 ||
^19) if they must support multiple React versions, and update pnpm.overrides
entries to target only the package names that truly require the 18.x types (use
the pnpm.overrides key names and package names d3-chat, realtime-streams,
realtime-hooks-test, d3-openai-agents, packages/react-hooks, packages/rsc to
locate the changes).
I was getting 100s TypeScript errors across the project before this.