(x: unknown)
| 32 | } |
| 33 | |
| 34 | export function isAsyncGenerator(x: unknown): x is AsyncGenerator { |
| 35 | return ( |
| 36 | x != null && |
| 37 | typeof x === "object" && |
| 38 | typeof (x as AsyncGenerator).next === "function" |
| 39 | ); |
| 40 | } |
| 41 | |
| 42 | export async function consumeAsyncGenerator<T, TReturn>( |
| 43 | generator: AsyncGenerator<T, TReturn>, |