fx-flow v0.7.0 / flow / anyway
Function: anyway()
anyway(fn, result)
anyway<
A
,R
>(fn
,result
):ResultReturnValue
<R
>
Call fn
anyway.
Type parameters
• A
• R extends MaybePromise
<Result
<unknown
>>
Parameters
• fn
• result: Result
<A
>
Returns
Example
typescript
const userInfo = (await anyway(queryUserInfo, err(userId))).unwrap() // throw an error
// with flow
const data = (await flow(ok(filePath), andThen(readFileToStr), anyway(closeIO))).unwrap()
Source
packages/core/src/flow/anyway.ts:17
anyway(fn)
anyway<
A
,R
>(fn
): (result
) =>ResultReturnValue
<R
>
Type parameters
• A
• R extends MaybePromise
<Result
<unknown
>>
Parameters
• fn
Returns
Function
Parameters
• result: Result
<A
>