ui
ui copied to clipboard
Using the button component with asChild prop with
hey, can you please elaborate more about this issue ?
I'm getting what's likely a similar error:
Type '{ disabled?: boolean | undefined; form?: string | undefined; formAction?: string | ((formData: FormData) => void) | undefined; formEncType?: string | undefined; formMethod?: string | undefined; ... 272 more ...; ref: ForwardedRef<...>; }' is not assignable to type 'SlotProps'. Types of property 'children' are incompatible. Type 'React.ReactNode' is not assignable to type 'import("/Users/ryanhunter/projects/causal-flow-ts/causal-flow/node_modules/.pnpm/@[email protected]/node_modules/@types/react/index").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'.
seemed to have happened after I did pnpm install, while primarily using bun install.
I deleted node modules and did bun install again and it fixed.
I almost created an issue in radix-ui/primitives, but I solved the problem. It is just a resolution mismatch issue when you update one package when another package with peerDependencies isn't updated yet. It's the problem of the package manager.
Happy news, welcome 2024, and @shadcn you can close each similar issue with this.
The solution for this particular problem is always the same, due to the package manager resolution problem, here's the steps:
- delete
node_modules - delete lockfile (in my case it's
bun.lockb) - install (in my case
bun iorbun install) - run
tscto make sure (in my casebunx tsc)
Works like a charm.
If you're still having issues, I had to manually make sure my "resolutions" field was matching my types/react version in my "devDependencies":
"resolutions": {
"@types/react": "18.2.8"
},
thanks @dragonkhoi
I'm having the same issue still with latest versions of the dependent libraries. But only when I deploy to Vercel. At first locally I just had a @ts-ignore to get through the issue, but when I pushed to Vercel it threw an error about the ts-ignore being unneeded/unused, when I follow steps above it then started throwing the error in Vercel, but not locally. :\
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.
I almost created an issue in radix-ui/primitives, but I solved the problem. It is just a resolution mismatch issue when you update one package when another package with peerDependencies isn't updated yet. It's the problem of the package manager.
Happy news, welcome 2024, and @shadcn you can close each similar issue with this.
The solution for this particular problem is always the same, due to the package manager resolution problem, here's the steps:
- delete
node_modules- delete lockfile (in my case it's
bun.lockb)- install (in my case
bun iorbun install)- run
tscto make sure (in my casebunx tsc)Works like a charm.
Yeah, it's working for me. Thanks.