Skip to content

Pin @types/react and @types/react-dom to 18.x to avoid TS errors from mixed versions#3267

Open
matt-aitken wants to merge 1 commit intomainfrom
pin-react-types
Open

Pin @types/react and @types/react-dom to 18.x to avoid TS errors from mixed versions#3267
matt-aitken wants to merge 1 commit intomainfrom
pin-react-types

Conversation

@matt-aitken
Copy link
Member

I was getting 100s TypeScript errors across the project before this.

@changeset-bot
Copy link

changeset-bot bot commented Mar 25, 2026

⚠️ No Changeset found

Latest commit: 46bceb0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 25, 2026

Walkthrough

The pull request adds version pinning for React type packages in package.json. Two new entries were added to the pnpm.overrides configuration: @types/react pinned to version 18.2.69 and @types/react-dom pinned to version 18.2.7. These override entries are placed alongside existing TypeScript and @types/node overrides. No other package scripts, dependencies, or configuration elements were modified.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is incomplete and missing required sections from the template (checklist, testing details, changelog). Add the full PR description following the template, including the checklist, testing steps, and changelog sections with appropriate content.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: pinning React type packages to version 18.x to resolve TypeScript errors from version mismatches.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pin-react-types

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between c00dae0 and 46bceb0.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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

Comment on lines +91 to +92
"@types/react": "18.2.69",
"@types/react-dom": "18.2.7",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 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
done

Repository: 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-hooks and packages/rsc use 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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant