Open
Description
I have been looking at the maybe
source code and trying to work out how to improve the typing of the .filter()
method but I haven't worked anything out. The problem is below. Is it possible to fix this within maybe
or is flow not able to handle this anyway yet?
maybe(getUserType()) // => 'admin' | 'customer'
.filter(userType => userType !== 'admin')
.forEach((userType: 'customer') => // => flow complains that userType is 'admin' | 'customer'
doSomethingOnlyCustomerCanDo(userType)
)
Metadata
Metadata
Assignees
Labels
No labels