Module / v1.0.0-beta.7

@typed/async-data

31 unique exports available through this public import path, including their members and aliases.

import * as async_data from "@typed/async-data";

Effect outcome conversion

  • fromExit

    variable

    Converts an Effect Exit to Success or Failure without losing its Cause.

  • fromResult

    variable

    Converts an Effect Result to Success or a typed Failure Cause.

Failure transformations

  • mapError

    variable

    Maps typed failures inside the base Cause while preserving defects, interruption, progress, and optimistic history.

Optimistic transitions

  • optimistic

    variable

    Adds an optimistic value above an existing AsyncData history.

Pattern matching

  • match

    variable

    Exhaustively folds every AsyncData variant, in data-first or data-last form.

Refresh transitions

  • startLoading

    variable

    Starts loading while preserving successful, failed, and optimistic history.

  • stopLoading

    variable

    Stops loading or refreshing without discarding optimistic history.

Runtime validation

  • isAsyncData

    variable

    Validates the runtime structure of an unknown AsyncData value.

State construction

  • failure

    variable

    Creates a failed state while preserving the complete Effect Cause.

  • loading

    variable

    Creates a loading state with optional progress.

  • success

    variable

    Creates a successful state with optional refresh progress.

State extraction

  • getCause

    function

    Returns the complete Cause only when the current state is a Failure.

  • getError

    function

    Returns the first typed failure found in a Failure Cause.

  • getSuccess

    function

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

State inspection

  • isFailure

    variable

    Tests whether an AsyncData value contains an Effect Cause.

  • isLoading

    variable

    Tests whether an AsyncData value is loading without a prior result.

  • isNoData

    variable

    Tests whether an AsyncData value is NoData.

  • isOptimistic

    variable

    Tests whether an AsyncData value is an optimistic history node.

  • isPending

    variable

    Tests whether the base state is loading or refreshing through optimistic history.

  • isRefreshing

    variable

    Tests whether a success or failure carries active refresh progress.

  • isSuccess

    variable

    Tests whether an AsyncData value contains a successful value.

State models

  • AsyncData

    type-alias

    The complete renderer-independent state machine for asynchronous data.

  • Failure

    interface

    Represents an Effect failure, optionally while a retry refreshes it.

  • Loading

    interface

    Represents active work that has not produced a prior value or failure.

  • NoData

    interface

    Represents an asynchronous value before work or a result exists.

  • Optimistic

    interface

    Represents an optimistic value together with the exact state it replaced.

  • Progress

    interface

    Reports completed work and, when known, the total amount of work.

  • Refreshing

    type-alias

    A success or failure that retains progress for an active refresh.

  • Success

    interface

    Represents a successfully produced value, optionally while it refreshes.

Value transformations

  • flatMap

    variable

    Replaces a successful or outer optimistic value with another AsyncData value.

  • map

    variable

    Maps successful and every optimistic value while preserving state structure.