Next.js Discord

Discord Forum

(React 19) Type 'ReactPortal' is not assignable to type 'ReactNode'.

Unanswered
Asiatic Lion posted this in #help-forum
Open in Discord
Avatar
Asiatic LionOP
I've updated my app to Next 15 with React 19 RC using the codemod, and I see this issue where I'm using createPortal.

ts: Type 'false | ReactPortal' is not assignable to type 'ReactNode'.
Type 'ReactPortal' is not assignable to type 'ReactNode'.
Type 'import("/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index").ReactPortal' is not assignable to type 'React.ReactPortal'.
Types of property 'children' are incompatible.
Type 'import("/node_modules/.pnpm/@types+react@18.3.3/node_modules/@types/react/index").ReactNode' is not assignable to type 'React.ReactNode'.
Type 'ReactElement<any, string | JSXElementConstructor<any>>' is not assignable to type 'ReactNode'.
Property 'children' is missing in type 'ReactElement<any, string | JSXElementConstructor<any>>' but required in type 'ReactPortal'.

My @types/react and @types/react-dom are set to

{
  "@types/react": "npm:types-react@19.0.0-rc.1",
  "@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
}


Same with pnpm overrides.
Image

4 Replies

Avatar
Asiatic LionOP
I can cast as ReactNode which makes the error go away, but wondering if I'm doing something wrong or if the types are just wrong/mismatched.
Avatar
I wonder why they just believe in word "stable" when something is relased 😓
Avatar
Tomistoma
Same issue here
Avatar
Braconid wasp
Same issue here