Skip to content

Type Alias: AsyncAtomState<TData, TError>

API / @xmachines/play-atom / AsyncAtomState

type AsyncAtomState<TData, TError> =
| {
status: "pending";
}
| {
data: TData;
status: "done";
}
| {
error: TError;
status: "error";
};

Defined in: play-atom/src/types.ts:157

The state of an atom that reads a promise

createAsyncAtom holds this shape. Read status first, and the compiler then gives you data or error.

Type Parameters

Type ParameterDefault type
TData-
TErrorunknown