import type { Maybe } from "../functional/maybe"; import type { MaybePromise } from "../functional/maybe_promise"; /** Host hooks for the shared async-chain update algorithm. */ export interface UpdateChain { getCurrent(): T; setCurrent(value: T): void; getPending(): Maybe>; setPending(p: Maybe>): void; notify(): void; } /** * Shared `update()` logic for State and Store. * * Async updates chain: a second update issued while a previous async update is * still in flight runs against the previous update's result, not against the * snapshot at issue time. `set` clears `pending` to cancel any in-flight links. * * If a link rejects, the chain is unwedged — when the rejected link is still * the tail, `pending` is cleared so the next `update()` starts a fresh chain * instead of chaining off a rejected promise (which would never commit again). * The error is re-thrown so it surfaces rather than being silently swallowed. */ export declare function chainUpdate(host: UpdateChain, fn: (current: T) => MaybePromise): void;