typescript props as object or array
Hey guys, I have a select that can or not be a multi-select
So my select props are
so I can take a SelectItem or an array of those
my problem is in the `setSelectedItem
when I call my component
I got the error
I understand that the problem is something to do with it either being an object or an array and so it has different properties
How can I make it typesafe and satisfy both cases?
3 Replies
my filter in this case is of type
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
oh I didnt thought of that, then I can only pass the multiple on the one that has an array
I mean, it doesnt even need to be a prop at this point I guess, whenever its an array of selected it will be multiple