variable / @typed/async-data

isSuccess

Tests whether an AsyncData value contains a successful value.

Package version
1.0.0-beta.7
Category
State inspection
Since
1.0.0

Import

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

Signatures

export declare const isSuccess: <A, E>(asyncData: AsyncData<A, E>) => asyncData is Success<A>;

Why

This refinement separates settled or refreshing success from optimistic state.

Ownership and lifetime

This pure predicate acquires no resources and does not retain its argument.

Examples

import { isSuccess, success } from "@typed/async-data"
isSuccess(success(1))

Source