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

Make MultiSelect.value any[] instead of (string|number)[] #1485

Open
ttrias opened this issue Nov 14, 2024 · 0 comments
Open

Make MultiSelect.value any[] instead of (string|number)[] #1485

ttrias opened this issue Nov 14, 2024 · 0 comments

Comments

@ttrias
Copy link

ttrias commented Nov 14, 2024

Describe the bug

Currently, the value property of a MultiSelect object is defined as a (string|number)[]. However, SelectOptionType<any> allows the selected values to be complex objects. I am wrapping MultiSelect with a generic component, and I get an error trying to bind value to a T[]. Note that Select.value is of type any, so the binding there isn't problematic.

Note that this error isn't a showstopper, since it doesn't actually cause a build error; it just looks ugly in the IDE.

From Rider:

Types of property value are incompatible.
Type T[] is not assignable to type (string | number)[]
Type T is not assignable to type string | number

Reproduction

https://github.com/ttrias/flowbite-svelte-issue-template

The lib\Test component uses the MultiSelect component with a T[]. Everything works, but Rider and VS Code both show a TypeScript error because T[] and (string|number)[] are not compatible.

Flowbite version and System Info

System:
    OS: macOS 15.1
    CPU: (10) arm64 Apple M1 Max
    Memory: 206.13 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 23.1.0 - /opt/homebrew/bin/node
    npm: 10.9.0 - /opt/homebrew/bin/npm
    pnpm: 9.12.3 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 130.0.6723.117
    Safari: 18.1
  npmPackages:
    flowbite-svelte: ^0.46.23 => 0.46.23 
    svelte: ^4.2.19 => 4.2.19 
    vite: ^5.4.11 => 5.4.11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant