Skip to content

Editorial: Narrow ReadableStreamBYOBRequest.view to Uint8Array#1367

Merged
MattiasBuelens merged 3 commits into
whatwg:mainfrom
MattiasBuelens:byobrequest-view-uint8array
Apr 25, 2026
Merged

Editorial: Narrow ReadableStreamBYOBRequest.view to Uint8Array#1367
MattiasBuelens merged 3 commits into
whatwg:mainfrom
MattiasBuelens:byobrequest-view-uint8array

Conversation

@MattiasBuelens

@MattiasBuelens MattiasBuelens commented Apr 12, 2026

Copy link
Copy Markdown
Collaborator

ReadableStreamBYOBRequest.view is always constructed as a Uint8Array in the specification. Reflect this in the Web IDL.

Fixes #1366.

(See WHATWG Working Mode: Changes for more details.)


Preview | Diff

@MattiasBuelens
MattiasBuelens requested review from domenic and ricea April 12, 2026 17:06
@MattiasBuelens

Copy link
Copy Markdown
Collaborator Author

I don't think we will ever want to set ReadableStreamBYOBRequest.view to anything other than a Uint8Array? This has always been a Uint8Array since e601d69, I don't expect we want to change that in the future.

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 annevk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@MattiasBuelens

Copy link
Copy Markdown
Collaborator Author

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.

@annevk

annevk commented Apr 25, 2026

Copy link
Copy Markdown
Member

I don’t think so. Technically not observable so up to your discretion. (WebKit is interested though in narrower typing generally.)

@MattiasBuelens
MattiasBuelens merged commit 91038b3 into whatwg:main Apr 25, 2026
3 checks passed
@MattiasBuelens
MattiasBuelens deleted the byobrequest-view-uint8array branch April 25, 2026 13:12
Jah-yee pushed a commit to Jah-yee/node that referenced this pull request Apr 25, 2026
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
bartlomieju pushed a commit to denoland/deno that referenced this pull request Apr 25, 2026
…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.
Jah-yee added a commit to Jah-yee/node that referenced this pull request Apr 29, 2026
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]>
nodejs-github-bot pushed a commit to nodejs/node that referenced this pull request May 11, 2026
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]>
aduh95 pushed a commit to nodejs/node that referenced this pull request May 19, 2026
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]>
aduh95 pushed a commit to nodejs/node that referenced this pull request May 19, 2026
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]>
aduh95 pushed a commit to nodejs/node that referenced this pull request May 23, 2026
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]>
araujogui pushed a commit to araujogui/node that referenced this pull request May 26, 2026
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]>
aduh95 pushed a commit to nodejs/node that referenced this pull request Jun 18, 2026
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]>
juanarbol pushed a commit to juanarbol/node that referenced this pull request Jul 16, 2026
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]>
juanarbol pushed a commit to juanarbol/node that referenced this pull request Jul 16, 2026
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]>
juanarbol pushed a commit to juanarbol/node that referenced this pull request Jul 16, 2026
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]>
juanarbol pushed a commit to nodejs/node that referenced this pull request Jul 17, 2026
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]>
juanarbol pushed a commit to nodejs/node that referenced this pull request Jul 17, 2026
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]>
juanarbol pushed a commit to nodejs/node that referenced this pull request Jul 19, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Specification unclear on type of byobRequest.view

2 participants