Re: [whatwg/streams] Misuse of `Assert` in spec (Issue #1327)

This specification, like many other web specifications, uses [Web IDL](https://webidl.spec.whatwg.org/) for its interface definitions. Therefore, by defining the parameter types of the `pipeTo` method [in the IDL of section 4.2.1](https://streams.spec.whatwg.org/#rs-class-definition), the Web IDL machinery will perform the appropriate type checks in the JavaScript bindings. Thus, these invariants are in fact fulfilled when `pipeTo` calls `ReadableStreamPipeTo`.

The reason why we still have these assertions is because we also expose [the "pipe to" algorithm](https://streams.spec.whatwg.org/#readablestream-pipe) for use by other specifications (e.g. fetch). In that case, it's the responsibility of the calling specification to make sure the inputs are correctly typed.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/issues/1327#issuecomment-2348072522
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/streams/issues/1327/2348072522@github.com>

Received on Friday, 13 September 2024 05:39:10 UTC