function / @typed/async-data

getSuccess

Returns the current successful or optimistic value as an Effect Option.

Package version
1.0.0-beta.13
Category
State extraction
Since
1.0.0

Import

import { getSuccess } from "@typed/async-data";

Signatures

export declare function getSuccess<A, E>(data: AsyncData<A, E>): Option.Option<A>;

Why

Option distinguishes an absent value from a present undefined payload and composes with Effect’s data APIs.

Ownership and lifetime

This pure lookup acquires no resources and does not retain the state.

Examples

import { getSuccess, success } from "@typed/async-data"
const value = getSuccess(success(1))

See Effect Option.

Source