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

Select's "multiple" typing is incorrect as it doesn't allow true #188

Closed
mattf96s opened this issue Nov 23, 2023 · 1 comment · Fixed by #184
Closed

Select's "multiple" typing is incorrect as it doesn't allow true #188

mattf96s opened this issue Nov 23, 2023 · 1 comment · Fixed by #184

Comments

@mattf96s
Copy link

I think the Multiple generic needs to be passed into the CreateSelectProps from melt-ui.

From a very quick initial exploration, changing the Props definition to pass in whether the Select is multiple solves the issue.

type Props<Value = unknown, Multiple extends boolean = false> = Expand<OmitOpen<Omit<CreateSelectProps<Value, Multiple>, "selected" | "defaultSelected" | "onSelectedChange">> & {
    selected?: CreateSelectProps["defaultSelected"] & {};
    onSelectedChange?: OnChangeFn<CreateSelectProps["defaultSelected"]>;
    open?: boolean & {};
    onOpenChange?: OnChangeFn<boolean>;
}>;
@huntabyte
Copy link
Owner

Closed by #184. You can now pass an array of Selected objects as the items prop and it will infer the type for the onSelectedChange fn as well as for multiple.

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

Successfully merging a pull request may close this issue.

2 participants