You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How often does it reproduce? Is there a required condition?
Every run on both versions tested. The failure occurs when next() or return() returns a function object. It also reproduces with an async iterator.
What is the expected behavior? Why is that the expected behavior?
The read should fulfill with { value: 'hello', done: false }, and cancellation should fulfill with undefined. Functions are objects under ECMAScript, so they satisfy the iterator result object check. Web IDL iterator rules
What do you see instead?
Both operations reject with TypeError [ERR_INVALID_STATE]. The read says iterator.next() must fulfill with an object. Cancellation reports the same error for iterator.return().
Additional information
Node.js main already accepts functions as the iterator itself, but the two checks on the results of next() and return() only accept typeof result === 'object'. Deno 2.9.6 accepted all four read and cancellation cases with sync and async iterators. Node.js source
Run the snippet yourself before submitting and use your own wording for the prose fields. In Additional information, disclose that AI helped investigate the bug and prepare the reproduction, then say what you personally verified. Node.js AI guidelines
Activity