Genel bakış
constCore Result

Result

Namespace-style collection of core result helpers.

Signature

tsSignature
export const Result = {
ok,
err,
from,
isOk,
isErr,
match,
unwrap,
unwrapOr,
};

Imports

tsImport
import { Result } from "@/lib/flow/core/result";
import { Result } from "@/lib/flow";

Details

This object is convenient when passing the result toolkit as a single value. The individual

named functions remain the preferred imports for tree-shakeable application code.

err

Re-exports core result helpers used by advanced record internals.

re-export
from

Converts a structural result-like value into a branded Flow result.

function
isErr

Narrows a result to the failed variant.

function
isOk

Narrows a result to the successful variant.

function
match

Exhaustively handles both result variants and returns one value.

function
ok

Re-exports core result helpers used by advanced record internals.

re-export
unwrap

Returns the success value or throws the error value.

function
unwrapOr

Returns the success value or a fallback.

function
when

Branches between two behaviors using a predicate function.

function

Source

tsflow/core/result.ts:210-219
export const Result = {
ok,
err,
from,
isOk,
isErr,
match,
unwrap,
unwrapOr,
};