Import
import { Progress } from "@typed/async-data";Signatures
export interface Progress {
readonly loaded: number;
readonly total?: number | undefined;
}Why
Progress belongs to the value so loading and refreshing states can carry the same transportable measurement.
Ownership and lifetime
This plain object acquires no resources. Its readonly fields are a TypeScript constraint; the runtime value is not frozen.
Property: loaded
The finite amount of work completed so far.
Property: loaded: Why
A required counter lets consumers render useful progress even when the total is unknown.
Property: loaded: Ownership and lifetime
Inherits the resource-free lifetime of its enclosing Progress value.
Property: total
The finite total amount of work, when the producer knows it.
Property: total: Why
Optionality distinguishes indeterminate work from a known total without inventing a sentinel value.
Property: total: Ownership and lifetime
Inherits the resource-free lifetime of its enclosing Progress value.
Examples
import type { Progress } from "@typed/async-data"
const progress: Progress = { loaded: 4, total: 10 }