Skip to main content

matchW()

matchW<E, B, A, C>(onLeft, onRight): (ma) => B | C

Pattern matches on an Either with widened return types.


Type Parameters​

E: E​

The error type.

B: B​

The return type for Left.

A: A​

The success type.

C: C​

The return type for Right.


Parameters​

onLeft: (e) => B​

Handler for Left case.

onRight: (a) => C​

Handler for Right case.


Returns​

A function that takes an Either and returns B or C.


Since​

2.0.0