- Notifications
You must be signed in to change notification settings - Fork85
Open
Description
I was trying write something like
const[callback,flag]=useEventCallback<React.MouseEvent<HTMLElement>|boolean,boolean>($events=>$events.pipe(mapTo(false)),false)callback(true)
And there was type error.
Argument of type 'true' is not assignable to parameter of type 'false & true & MouseEvent<HTMLElement, MouseEvent>'. Type 'true' is not assignable to type 'false'.ts(2345)
Checking the source
exporttypeVoidableEventCallback<EventValue>=EventValueextendsvoid ?()=>void :(e:EventValue)=>void |
It seems like for example
typeCallback=VoidableEventCallback<string|boolean>
will be resolved as
typeCallback=((e:string)=>void)|((e:false)=>void)|((e:true)=>void)
which meanse
has to bestring & boolean
. Is this a bug or am I missing something here?
Metadata
Metadata
Assignees
Labels
No labels