Skip to content

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

@ttrias

Description

@ttrias

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions