export type Entry = { args: Args; resolve: (value: R | PromiseLike) => void; reject: (err: unknown) => void; }; export type SerialQueue = { f: (...args: Args) => Promise; entries: Entry[]; /** * Called after the last entry settled (or after `rejectAll`). Errors thrown * by the hook are rethrown asynchronously as uncaught exceptions; they never * affect the entries or the queue. */ drained?: () => void; /** Entry whose `f` is currently in flight, if any. */ running?: Entry; };