CombinatorsasTryasTry CallableasTry<T>(x: T): AsTry<T>Take an expression and evaluate it. When the expression throws it will be converted to a Try Failure. ExampleasTry("foobar")// => "foobar"asTry(() => "foobar")// => "foobar"asTry(async () => "foobar")// => Promise<"foobar">Type parametersT: unknownThe expression type.Parametersx: TThe expression to evaluate.Returns AsTry<T>The unpacked value.
Take an expression and evaluate it. When the expression throws it will be converted to a
Try
Failure
.Example