mapRight
Callable
Type parameters
- E: Either<unknown, unknown>
The type of the Either.
- T
The type of the transformed
Right
value.
Parameters
x: E
The
Either
value to map.f: (r: E extends Right<R> ? R : never) => T
The transformation function to apply to the
Right
value.
Returns E extends Right<unknown> ? Right<T> : E
An
Either
object where theRight
has been transformed if present, or the originalLeft
.- E: Either<unknown, unknown>
Applies a transformation function to the
Right
value of anEither
type, if present. If the input is aLeft
, it remains unchanged.Example