/** * Races reads across several hooks. A read that lands while no race is waiting * is kept until one claims it: the owner awaits steps between races, and a * resume arriving then must not be dropped or re-issued. Claims follow array * order because separate hooks carry no order between them. */ export interface ChannelReader { readonly channel: C; readonly iterator: AsyncIterator; /** Reads that have landed and not yet been claimed, oldest first. */ readonly landed: IteratorResult[]; failure?: { readonly error: unknown; }; pending?: Promise; } export declare function createChannelReader(channel: C, iterable: AsyncIterable): ChannelReader; type ChannelReadResult = R extends ChannelReader ? { readonly channel: C; readonly next: IteratorResult; } : never; type ChannelRead[]> = ChannelReadResult; /** * Channel reads wake the loop with `undefined` after buffering their result; * a cancel wins the race outright. */ export declare function raceChannelReads[]>(readers: R): Promise>; export declare function raceChannelReads[]>(readers: R, cancelled: Promise<"cancel"> | undefined): Promise | "cancel">; export {};