import { SetStateAction } from 'react'; /** * State that supports asynchronous state transitions * State transitions may be enqueued and then completed in FIFO order via transition or transitionAll */ export interface QueuedTransitionState { /** * Current state value */ readonly current: S; /** * enqueue a state transition - either a literal value or a function (prev) => next */ readonly enqueue: (action: SetStateAction) => void; /** * process one queued transition */ readonly transition: () => void; /** * process all queued transitions */ readonly transitionAll: () => void; } declare function useQueuedState(): QueuedTransitionState; /** * State is always a defined S if an initial state is provided */ declare function useQueuedState(initialState: S): QueuedTransitionState; export default useQueuedState;