Function: mapError()
Applies a transformation function to the error value of a Result or ResultAsync. If the input is a Success, it will be returned unchanged.
Type Param
The input Result or ResultAsync.
Type Param
The transformed error value type.
Examples
See
pipe - It is recommended to use this function with the pipe function for better readability and composability.
Call Signature
mapError<
R1,E2>(fn): (result) =>ResultFor<R1,InferSuccess<R1>,E2>
Type Parameters
R1
R1 extends ResultMaybeAsync<any, any>
E2
E2
Parameters
fn
(a) => E2
Returns
(
result):ResultFor<R1,InferSuccess<R1>,E2>
Parameters
result
R1
Returns
ResultFor<R1, InferSuccess<R1>, E2>
Call Signature
mapError<
E1,E2>(fn): <R1>(result) =>ResultFor<R1,InferSuccess<R1>,E2>
Type Parameters
E1
E1
E2
E2
Parameters
fn
(a) => E2
Returns
<
R1>(result):ResultFor<R1,InferSuccess<R1>,E2>
Type Parameters
R1
R1 extends ResultMaybeAsync<any, E1>
Parameters
result
R1
Returns
ResultFor<R1, InferSuccess<R1>, E2>
