CombinatorstryToErrortryToError CallabletryToError<T>(x: T): T extends Failure ? never : Success<T>Convert the Try to a its value, where Success is converted to the value, and Failure is thrown`. ExampletryToError("foobar")// => "foobar"tryToError(new Error("foobar"))// => throw Error("foobar") @param x - The Try to transform.Type parametersT: unknownThe value type.Parametersx: TReturns T extends Failure ? never : Success<T>
Convert the
Try
to a its value, whereSuccess
is converted to the value, andFailure
is thrown`.Example
@param x - The
Try
to transform.