(it: T)
| 49 | export type AsyncGeneratorValue<T> = T extends AsyncGenerator<infer U> ? U : never; |
| 50 | |
| 51 | export async function toArrayAsync<T extends AsyncGenerator<unknown>>(it: T): Promise<AsyncGeneratorValue<T>[]> { |
| 52 | const arr: AsyncGeneratorValue<T>[] = []; |
| 53 | for await (const o of it) { |
| 54 | arr.push(o as AsyncGeneratorValue<T>); |
| 55 | } |
| 56 | |
| 57 | return arr; |
| 58 | } |
| 59 | |
| 60 | export async function takeResult<T extends Result, U extends AsyncGenerator<ResponseMessage<T>>>(it: U): Promise<T> { |
| 61 | for await (const o of it) { |
no outgoing calls
no test coverage detected
searching dependent graphs…