How can I type onChange ? #5971
Unanswered
SebUndefined
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Is it possible to type onChange properly. I followed the instructions defined here so I ended up with
As the options are of type
SelectableValue<T>[]
, I would expect that the onChange method would adapt herself but instead, I have the following errorTS2322: Type
is not assignable to type
Types of property onChange are incompatible.
Type
((value: SelectableValue<T>, actionMeta: ActionMeta<SelectableValue<T>>) => void) | ((value: SelectableValue<T>[], actionMeta: ActionMeta<...>) => void) | undefined
is not assignable to type
((newValue: unknown, actionMeta: ActionMeta<unknown>) => void) | undefined
Type
(value: SelectableValue<T>, actionMeta: ActionMeta<SelectableValue<T>>) => void
is not assignable to type
(newValue: unknown, actionMeta: ActionMeta<unknown>) => void
Types of parameters value and newValue are incompatible.
Type unknown is not assignable to type SelectableValue
Is it possible to achieve such method ? Or do I have to do a switch case depending on the ActionMeta... Doc is pretty poor about this subject...
Complete Code of the wrapper
And a simple call (from another wrapper which use react hook form
Beta Was this translation helpful? Give feedback.
All reactions