-
Notifications
You must be signed in to change notification settings - Fork 910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript Error: Slot Component Incompatibility with Next.js 15/React 19 #3199
Comments
Same issues here any fix? |
Yeh, I couldn't really think of anything other than |
Are y'all using bun? I think this is because bun doesn't support nested resolutions/overrides: oven-sh/bun#6608. Switching to PNPM fixed this for me. |
Could this be why my FormContext seems to be leaking to 'nested' forms in my Shadcn form? edit: i don't think it's related. |
This is a type mismatch issue local to your project, not something that could be resolved by radix-ui until they upgrade to React 19. You can fix it locally by adding either resolutions for yarn or overrides for npm/pnpm. // yarn
{
"resolutions": {
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
}
} // npm/pnpm
{
"overrides": {
"@types/react": "npm:types-react@19.0.0-rc.1",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.1"
}
} |
Bug report
Current Behavior
When using the
Slot
component from@radix-ui/react-slot
in a Next.js 15 project (potentially related to React 19 compatibility), TypeScript throws type errors indicating that the Slot component cannot be used as a JSX element. This affects form components and other UI elements that utilize the Slot primitive.Expected behavior
The Slot component should work correctly as a JSX element without TypeScript errors, maintaining compatibility with Next.js 15 and React 19.
Reproducible example
Create a Next.js 15 project
Install @radix-ui/react-slot
Try to use the Slot component in a form component like so:
Suggested solution
Additional context
This issue specifically affects form components that use the Slot primitive for composition. The error suggests there might be an incompatibility between the ReactNode types being used by Radix UI and those provided by React 19.
Your environment
The text was updated successfully, but these errors were encountered: