Closed ryanleecode closed 3 years ago
@ryanleecode , Does matchP
meet your needs (this was the intention)?
myCallback(matchP({ nothing: () => 0 }, (rest) => {
// rest inferred as {_type: 'left', value: number } | { 'right', value: number }
return rest.value;
}))
Which also makes it compose well in a pipe
:
pipe(
value,
matchP({...}, rest => {...})
)
Oh i totally missed that. I
stands for inverted, I see!
Yup, in all fairness, the documentation could explain the differences between them!
This signature should be reversed imo. so you can specific the matchers and have it still work in a callback.
i.e.