You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@types/react@^18 in dependencies breaks type-checking in React 19 projects #2594
Since 3.33.0, braintrust lists @types/react: ^18.3.1 under dependencies. As far as I can tell it is only needed for the braintrust/custom-views type definitions (dist/custom-views.d.ts imports ReactNode from react), which came in with #2191.
Because it is a hard dependency, every consumer gets React 18 types installed, including projects that don't use custom views or don't use React at all. In a React 19 project, this can break tsc.
What happened
We use pnpm (workspace) and React 19 (@types/react@19). After upgrading braintrust from 3.32.0 to 3.35.0, pnpm hoisted @types/react@18.3.31 into node_modules/.pnpm/node_modules. Packages that import types from react without declaring @types/react themselves (in our case @sentry/react) then resolved React 18 types, while our own code used React 19 types. tsc --noEmit failed with errors like this:
error TS2322: Type 'React.ReactNode' is not assignable to type 'import(".../@types+react@18.3.31/node_modules/@types/react/index").ReactNode'.
Type 'ReactElement<unknown, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<unknown, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.
We work around it with a pnpm override ("braintrust>@types/react": "^19"), or by staying on 3.32.0.
Versions
braintrust: 3.33.0 – 3.37.1 (not in 3.32.0)
@types/react in the project: 19.2.x
Package manager: pnpm 11 (workspace)
Suggestion
Declare @types/react (and react, if needed) as an optional peer dependency, for example:
That way, projects that use custom views get the @types/react they already have, whatever its version, and other projects don't get React types installed at all.
Activity
AbhiPrasad commentedon Oct 9, 2026
thanks for the issue Masashi Tomooka (@tmokmss) - we'll fix this.
github-actions commentedon Oct 9, 2026
A release containing the fix/implementation for this issue has been published:
Included via #2596.