Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import { fromSync, textSync } from 'node:stream/iter';
const input = {
*[Symbol.iterator]() {
yield new TextEncoder().encode('sync');
},
async *[Symbol.asyncIterator]() {
yield new TextEncoder().encode('async');
},
};
try {
console.log(textSync(fromSync(input)));
} catch (err) {
console.log(`${err.name}: ${err.message}`);
}
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
fromSync() currently rejects any object with Symbol.asyncIterator before checking for Symbol.iterator. Per Spec §8.2, only async-only inputs should be rejected here; a dual sync+async iterable should be accepted through its synchronous iterator.
What do you see instead?
TypeError: The "input" argument must be an a synchronous input (not AsyncIterable). Received an instance of Object
Additional information
No response
Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
syncfromSync()currently rejects any object withSymbol.asyncIteratorbefore checking forSymbol.iterator. Per Spec §8.2, only async-only inputs should be rejected here; a dual sync+async iterable should be accepted through its synchronous iterator.What do you see instead?
TypeError: The "input" argument must be an a synchronous input (not AsyncIterable). Received an instance of ObjectAdditional information
No response