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] - Listbox dynamic items type issue #1503

Closed
phev8 opened this issue Aug 26, 2023 · 2 comments · Fixed by #1544 or #1514
Closed

[BUG] - Listbox dynamic items type issue #1503

phev8 opened this issue Aug 26, 2023 · 2 comments · Fixed by #1544 or #1514
Assignees
Labels
🐛 Type: Bug Something isn't working

Comments

@phev8
Copy link

phev8 commented Aug 26, 2023

NextUI Version

v2.1.7

Describe the bug

Using the exact example from the doc:

<Listbox
        items={items}
        aria-label="Dynamic Actions"
        onAction={(key) => alert(key)}
      >
        {(item) => (
          <ListboxItem
            key={item.key}
            color={item.key === "delete" ? "danger" : "default"}
            className={item.key === "delete" ? "text-danger" : ""}
          >
            {item.label}
          </ListboxItem>
        )}
</Listbox>

gives a type error:

Type '(item: any) => Element' is not assignable to type 'ReactNode'.ts(2322)
ParticipantList.tsx(73, 22): Did you mean to call this expression?

The same "items" approach works with tables and other components but not with the new Listbox.

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

Using typescript project.

Expected behavior

Should not warn, expect the behaviour as it is with Table for example. (It works there)

Screenshots or Videos

No response

Operating System Version

macOS

Browser

Chrome

@phev8 phev8 added the 🐛 Type: Bug Something isn't working label Aug 26, 2023
@jrgarciadev jrgarciadev self-assigned this Aug 31, 2023
@Alex20180512
Copy link

@phev8

I wasn't found type error from https://stackblitz.com/edit/vitejs-vite-qmivxs?file=src%2FApp.tsx mini repo. Can you provide a mini repo ?

@phev8
Copy link
Author

phev8 commented Sep 1, 2023

Here is one, just used the basic NextJS setup, installed NextUI following the docs.
When running npm run build I get the mentioned type error:
https://codesandbox.io/p/sandbox/youthful-sunset-jhq4v6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Type: Bug Something isn't working
Projects
None yet
3 participants