Skip to content

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

ResultReturnValue<R>

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()

More examples

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>

Returns

ResultReturnValue<R>

Source

packages/core/src/flow/anyway.ts:21

Released under the MIT License.