You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've spent a couple of days trying to figure out the types now, and maybe I'm just fundamentally misunderstanding something, but I've tried to follow the directions on for a custom multi-select. I'm also trying to cover the case where it's a single select but for the purposes of this we can assume that it's a multi-select. The docs state that the following should be the type signature for a custom onChange handler:
But as you will be able to see here in my demo, this gets a type error when I then assign it to a custom select:
Type '(option: readonly Option[], actionMeta: ActionMeta<Option>) => void' is not assignable to type '(newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void'.
For some reason the type is (newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void instead of (option: readonly Option[], actionMeta: ActionMeta<Option>) => void as described in the docs and I don't understand why. I also get the following error when I assign isMulti:
Type 'boolean' is not assignable to type 'IsMulti'.
'boolean' is assignable to the constraint of type 'IsMulti', but 'IsMulti' could be instantiated with a different subtype of constraint 'boolean'.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I've spent a couple of days trying to figure out the types now, and maybe I'm just fundamentally misunderstanding something, but I've tried to follow the directions on for a custom multi-select. I'm also trying to cover the case where it's a single select but for the purposes of this we can assume that it's a multi-select. The docs state that the following should be the type signature for a custom
onChange
handler:I create a custom select as per the example in the docs:
But as you will be able to see here in my demo, this gets a type error when I then assign it to a custom select:
For some reason the type is
(newValue: OnChangeValue<Option, IsMulti>, actionMeta: ActionMeta<Option>) => void
instead of(option: readonly Option[], actionMeta: ActionMeta<Option>) => void
as described in the docs and I don't understand why. I also get the following error when I assignisMulti
:Beta Was this translation helpful? Give feedback.
All reactions