ConstAsyncIterableOrIteratorSchema.parse(
(async function* () {
yield 1;
})(),
); // ✓ Valid
AsyncIterableOrIteratorSchema.parse([1, 2, 3]); // ✓ Valid (sync iterable works)
AsyncIterableOrIteratorSchema.parse(Readable.from([1, 2, 3])); // ✓ Valid
AsyncIterableOrIteratorSchema.parse(42); // ✗ Throws validation error
Schema matching either an async iterable or async iterator. Also accepts sync iterables (can be consumed async).
This permissive union schema accepts values that can be iterated asynchronously, including:
Symbol.asyncIterator)next())Symbol.iterator) - these can be consumed via async iterationThis flexibility allows async assertions to work uniformly with various iterable types.