Skip to content
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

[Bug]: Type error in Dropdown Menu and Menubar #3143

Open
2 tasks done
manasvi-pandey opened this issue Mar 25, 2024 · 3 comments
Open
2 tasks done

[Bug]: Type error in Dropdown Menu and Menubar #3143

manasvi-pandey opened this issue Mar 25, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@manasvi-pandey
Copy link

Describe the bug

After installing the DropdownMenu component from shadcn/ui, there are a lot of type errors which stops the application from building (NextJS application to be specific)

The type errors also occur when we try to use DropdownMenuItem in our code like below

<DropdownMenu>
    <DropdownMenuTrigger>Open</DropdownMenuTrigger>
    <DropdownMenuContent>
        <DropdownMenuLabel>My Account</DropdownMenuLabel>
        <DropdownMenuSeparator />
        <DropdownMenuItem>Profile</DropdownMenuItem>
        <DropdownMenuItem>Billing</DropdownMenuItem>
        <DropdownMenuItem>Team</DropdownMenuItem>
        <DropdownMenuItem>Subscription</DropdownMenuItem>
    </DropdownMenuContent>
</DropdownMenu>

And the error reads as follow
Type '{ children: string; }' has no properties in common with type 'IntrinsicAttributes & Omit<DropdownMenuLabelProps & RefAttributes<HTMLDivElement>, "ref"> & { ...; } & RefAttributes<...>'.

Affected component/components

DropdownMenu, Menubar

How to reproduce

  1. Install DropdownMenu component npx shadcn-ui@latest add dropdown-menu
  2. Navigate to @/components/ui/dropdown-menu

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Browser: Chrome Version 122.0.6261.131 (Official Build) (64-bit)
NextJS Version 14.1.4

Before submitting

  • I've made research efforts and searched the documentation
  • I've searched for existing issues
@manasvi-pandey manasvi-pandey added the bug Something isn't working label Mar 25, 2024
@Merchnest
Copy link

I don't think it's the problem with the shadcn/ui code

@NickMandylas
Copy link

For those who come across this issue – I had the exact same problem in my monorepo (turbo/pnpm workspaces).
The issue was there was a dependency version mismatch between my @app/ui package and my @app/web package for @types/react.

The version in my @app/ui was 18.2.74 whilst in @app/web it was 18.2.75. Updating @app/ui to 18.2.75 resolved the issue.

@muhajirdev
Copy link

muhajirdev commented Apr 27, 2024

Thank you @NickMandylas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants