type-alias / @typed/async-data

Refreshing

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

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

Import

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

Signatures

export type Refreshing<A, E> = (Success<A> | Failure<E>) & {
    readonly progress: Progress;
};

Why

This refinement lets consumers distinguish refreshes without losing the previous result.

Ownership and lifetime

This structural view acquires no resources and has the lifetime of the underlying state value.

Property: progress

Progress whose presence marks the retained result as actively refreshing.

Examples

import type { Refreshing } from "@typed/async-data"
const state: Refreshing<number, never> = { _tag: "Success", value: 1, progress: { loaded: 0 } }

Source