🧩 Yields the items of each async iterable in turn.

Syntax

TypeScript
import { concatIterAsync } from '@opentf/std';
concatIterAsync<T>(...iterables: AsyncIterable<T>[]): AsyncGenerator<T>

Parameters

  • ...iterables: The async iterables to concatenate.

Returns

A new async generator over all of them, in order.

Each source is only started once the one before it is exhausted, so a consumer that stops early never touches the later ones. Use mergeStreams instead when the sources should run at the same time.

Examples

TypeScript
const all = concatIterAsync(streamToIter(head), streamToIter(tail));

await toArrayIterAsync(all) //=> [...head, ...tail]
Last updated on
Edit this page