fx-flow v0.7.0 / flow / toTry
Function: toTry()
toTry<
A
>(fn
): (...args
) =>TryDoResult
<ReturnType
<A
>>
Convert fn
to (...args) => tryDo(() => fn(...args))
Type parameters
• A extends AnyFunction
Parameters
• fn: A
Returns
Function
Parameters
• ...args: Parameters
<A
>
Returns
Example
typescript
const obj = {}
toTry(() => obj.a.b)() // get a failure Result