Value might be an AsyncIterable or just an Iterable.
AsyncIterable
Iterable
Union type useful when you want to accept both AsyncIterable and Iterable values, which is generally in asynchronous functions that can loop over @@asyncIterator or @@iterator values.
const iterable: IsomorphicIterable<number> = [1, 2, 3];for (const item of iterable) { console.log(item); // Works}for await (const item of iterable) { console.log(item); // Also works} Copy
const iterable: IsomorphicIterable<number> = [1, 2, 3];for (const item of iterable) { console.log(item); // Works}for await (const item of iterable) { console.log(item); // Also works}
Type of the items in the iterable.
Value might be an
AsyncIterable
or just anIterable
.Remarks
Union type useful when you want to accept both
AsyncIterable
andIterable
values, which is generally in asynchronous functions that can loop over @@asyncIterator or @@iterator values.Example
See