Version
main
Platform
Subsystem
stream
What steps will reproduce the bug?
import{Writable}from'node:stream';import{broadcast,fromWritable,push,}from'node:stream/iter';constbadOptions={signal: 'not an AbortSignal'};constclassicWritable=newWritable({write(chunk,encoding,callback){callback();},});constcases=[['push().writer.write()',()=>push().writer.write('x',badOptions)],['push().writer.writev()',()=>push().writer.writev(['x'],badOptions)],['push().writer.end()',()=>push().writer.end(badOptions)],['broadcast().writer.write()',()=>broadcast().writer.write('x',badOptions)],['broadcast().writer.writev()',()=>broadcast().writer.writev(['x'],badOptions)],['broadcast().writer.end()',()=>broadcast().writer.end(badOptions)],['fromWritable().write()',()=>fromWritable(classicWritable).write('x',badOptions)],['fromWritable().writev()',()=>fromWritable(classicWritable).writev(['x'],badOptions)],['fromWritable().end()',()=>fromWritable(classicWritable).end(badOptions)],];for(const[name,run]ofcases){try{constresult=run();if(result?.then){awaitresult;}console.log(`${name}: resolved`);}catch(err){console.log(`${name}: ${err.code??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?
push().writer.write(): ERR_INVALID_ARG_TYPE: ...push().writer.writev(): ERR_INVALID_ARG_TYPE: ...push().writer.end(): ERR_INVALID_ARG_TYPE: ...broadcast().writer.write(): ERR_INVALID_ARG_TYPE: ...broadcast().writer.writev(): ERR_INVALID_ARG_TYPE: ...broadcast().writer.end(): ERR_INVALID_ARG_TYPE: ...fromWritable().write(): ERR_INVALID_ARG_TYPE: ...fromWritable().writev(): ERR_INVALID_ARG_TYPE: ...fromWritable().end(): ERR_INVALID_ARG_TYPE: ...
A proper invalid-argument TypeError for options.signal, ideally Node’s usual ERR_INVALID_ARG_TYPE, because the spec defines WriteOptions.signal as an AbortSignal.
What do you see instead?
push().writer.write(): TypeError: signal?.throwIfAborted is not a functionpush().writer.writev(): TypeError: signal?.throwIfAborted is not a functionpush().writer.end(): resolvedbroadcast().writer.write(): TypeError: signal?.throwIfAborted is not a functionbroadcast().writer.writev(): TypeError: signal?.throwIfAborted is not a functionbroadcast().writer.end(): resolvedfromWritable().write(): resolvedfromWritable().writev(): resolvedfromWritable().end(): resolved
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?
A proper invalid-argument TypeError for
options.signal, ideally Node’s usualERR_INVALID_ARG_TYPE, because the spec definesWriteOptions.signalas anAbortSignal.What do you see instead?
Additional information
No response