fx-flow v0.7.0 / flow / andThen
Function: andThen()
andThen(fn, result)
andThen<
A
,R
>(fn
,result
):ResultReturnValue
<R
>
Call fn
if result
is success.
Type parameters
• A
• R extends MaybePromise
<Result
<unknown
>>
Parameters
• fn
• result: Result
<A
>
Returns
Example
typescript
const userInfo = (await andThen(queryUserInfo, ok(userId))).unwrap()
// with flow
const userInfo = (await flow(ok(userId), andThen(queryUserInfo))).unwrap()
Source
packages/core/src/flow/andThen.ts:18
andThen(fn)
andThen<
A
,R
>(fn
): (result
) =>ResultReturnValue
<R
>
Type parameters
• A
• R extends MaybePromise
<Result
<unknown
>>
Parameters
• fn
Returns
Function
Parameters
• result: Result
<A
>