🧩 Collects all items from an async iterator into an array.
Syntax
TypeScript
import { toArrayIterAsync } from '@opentf/std'; toArrayIterAsync<T>(iter: AsyncIterable<T>): Promise<T[]>
Parameters
iter: The async iterable to collect.
Returns
A promise that resolves to an array of all items.
Examples
TypeScript
async function* gen() { yield 1; yield 2; } await toArrayIterAsync(gen()) //=> [1, 2]