recoverTry
recoverTry<
U,T>(x,recover):AsTry<U> |T
Map the value of the Try when it is a Failure.
Example
recoverTry("foobar", s => `${s}${s}`)// => "foobar"
recoverTry(new Error("foobar"), s => "bar")// => "bar"Type Parameters
• U
The transformed type.
• T extends unknown
The input type.
Parameters
x
T
The Try to transform.
recover
(e) => U
The failure transform.
Returns
AsTry<U> | T