Closed
Labels
streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Description
Version
main
Platform
macOS 26.5.0
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?
syncfromSync() 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 ObjectAdditional information
No response
Metadata
Metadata
Assignees
Labels
streamIssues and PRs related to Node.js streams.Issues and PRs related to Node.js streams.
Activity
stream: prefer sync iterator in fromSync
stream: prefer sync iterator in fromSync
stream: prefer sync iterator in fromSync
stream: prefer sync iterator in fromSync