ConstSyncIterableOrIteratorSchema.parse([1, 2, 3]); // ✓ Valid (iterable)
SyncIterableOrIteratorSchema.parse([1, 2, 3][Symbol.iterator]()); // ✓ Valid (iterator)
SyncIterableOrIteratorSchema.parse(
(function* () {
yield 1;
})(),
); // ✓ Valid (both)
SyncIterableOrIteratorSchema.parse(42); // ✗ Throws validation error
Schema matching either a sync iterable or sync iterator.
This union schema accepts values that implement either the iterable protocol (has
Symbol.iterator) or the iterator protocol (hasnext()method). This is useful for assertions that can work with either form, allowing users to pass arrays, generators, or raw iterators interchangeably.