Editorial: Narrow ReadableStreamBYOBRequest.view to Uint8Array#1367
Conversation
|
I don't think we will ever want to set I'm not sure if we need to file implementation bugs? This doesn't change anything about the generated glue code for browsers. Or maybe we should file them anyway, e.g. if Node.js wants to update the type in their JSDoc? |
annevk
left a comment
There was a problem hiding this comment.
This would improve the generated code slightly so it might be nice to file bugs, but it's not required as there's no observable difference.
|
Bugs have been filed. Does this need interest from implementers? It's a fairly trivial change, I don't expect anyone to be opposed to it. |
|
I don’t think so. Technically not observable so up to your discretion. (WebKit is interested though in narrower typing generally.) |
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array. Fixes: nodejs#62952
…3477) ## Summary Per the spec change at [whatwg/streams#1367](whatwg/streams#1367), `ReadableStreamBYOBRequest.view` is always a `Uint8Array` — the BYOB controller already constructs it that way internally. Narrow the public type from `ArrayBufferView | null` to `Uint8Array<ArrayBuffer> | null`: - `cli/tsc/dts/lib.deno_web.d.ts` — the user-facing TypeScript declaration. - `ext/web/06_streams.js` — JSDoc on both the internal `[_view]` slot and the `view` getter. Before this PR, code like `const v: Uint8Array = req.view!` failed type-checking with TS2740 against `ArrayBufferView<ArrayBufferLike>`. After, it compiles and rejects assignment to incompatible views (e.g. `DataView`) with a meaningful TS2322. Fixes #33476.
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: nodejs#62952 Signed-off-by: Jah-yee <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: nodejs#62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: nodejs#63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: nodejs#62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: nodejs#63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: nodejs#62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: nodejs#63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: nodejs#62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: nodejs#63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
Follow WHATWG streams spec update: whatwg/streams#1367 ReadableStreamBYOBRequest.view is always constructed as a Uint8Array. This changes the documented return type from ArrayBufferView to Uint8Array per the updated spec. Fixes: #62952 Signed-off-by: Jah-yee <[email protected]> PR-URL: #63017 Reviewed-By: Mattias Buelens <[email protected]> Reviewed-By: Jason Zhang <[email protected]>
ReadableStreamBYOBRequest.viewis always constructed as aUint8Arrayin the specification. Reflect this in the Web IDL.Fixes #1366.
ReadableStreamBYOBRequest.viewtoUint8Arraydenoland/deno#33476ReadableStreamBYOBRequest.viewtoUint8Arraynodejs/node#62952(See WHATWG Working Mode: Changes for more details.)
Preview | Diff