[React 19] Wrong @types/react*
default version and build fails if the correct version is installed
#65599
Labels
bug
Issue was opened via the bug report template.
create-next-app
Related to our CLI tool for quickly starting a new Next.js application.
Linting
Related to `next lint` or ESLint with Next.js.
TypeScript
Related to types with Next.js.
Link to the code that reproduces this issue
https://github.com/mwskwong/wrong-react-19-types
To Reproduce
next build
and observe the terminal output.Current vs. Expected behavior
Current
When creating a new Next.js project,
types/react@^18
andtypes/react-dom@^18
are used. These types are for React 18, not 19.If we follow https://react.dev/blog/2024/04/25/react-19-upgrade-guide#installing to install the React 19 compatible
@types/react
and@types/react-dom
(already done in the above repo), Next.js will believe@types/react
is not installed when runningnext build
:In CI env, e,g. when deploying on Vercel, the build will straight up fail without the above patching
Expected
Build should be successful.
Provide environment information
Which area(s) are affected? (Select all that apply)
create-next-app, Linting, TypeScript
Which stage(s) are affected? (Select all that apply)
next build (local), Vercel (Deployed)
Additional context
No response
The text was updated successfully, but these errors were encountered: