They even return the same shape of object. BYOB readers are still experimental, I think we can flatten these bindings into a single Reader.t and it will work just fine (we also need to fix the return type of the read method).
Note that we'll probably have to use the same module rec trick to avoid creating a full nested module, this is a cool idea that we might be able to leverage elsewhere. Instead of var ModuleName = {} which tree shaking can't remove, it only generates var ModuleName which I would hope can be removed.
I'm not sure where the inspiration for the current bindings came from, but in them "byob" readers don't have a
read
method. This is not true:https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamBYOBReader/read
They even return the same shape of object. BYOB readers are still experimental, I think we can flatten these bindings into a single
Reader.t
and it will work just fine (we also need to fix the return type of theread
method).Note that we'll probably have to use the same
module rec
trick to avoid creating a full nested module, this is a cool idea that we might be able to leverage elsewhere. Instead ofvar ModuleName = {}
which tree shaking can't remove, it only generatesvar ModuleName
which I would hope can be removed.