method Result.prototype.mapErr Result.prototype.mapErr<F extends BaseError>(fn: (error: E) => F): Result<T, F> Transforms the Err value using a mapper function, leaving Ok untouched. Examples Example 1 const result = Result.err(new ValidationError("Failed")) .mapErr(e => new NetworkError({ cause: e })); Type Parameters F extends BaseError The type of the transformed error Parameters fn: (error: E) => F Function to transform the Err value Return Type Result<T, F> A new Result with the transformed error, or the original Ok