Skip to content

fix(api): correct ReadableStreamDefaultController.desiredSize value type#44536

Open
gords2 wants to merge 1 commit into
mdn:mainfrom
gords2:fix/desiredsize-value-type
Open

fix(api): correct ReadableStreamDefaultController.desiredSize value type#44536
gords2 wants to merge 1 commit into
mdn:mainfrom
gords2:fix/desiredsize-value-type

Conversation

@gords2

@gords2 gords2 commented Jun 21, 2026

Copy link
Copy Markdown

Fixes #44486

The Value section claimed desiredSize is "An integer", which is inaccurate on two counts (both raised in the issue):

  • It can be nullReadableStreamDefaultController.desiredSize returns null when the stream has errored (and 0 when it is closed), per the spec algorithm.
  • It is not necessarily an integer — the default controller computes desiredSize from the queuing strategy's size() results. A custom queuing strategy can return non-integer sizes, so desiredSize can be non-integer too.

Updated the description to state the type as "A number, or null" and to explain the negative / non-integer / null / closed cases.

desiredSize is not always an integer: with a custom queuing strategy the
chunk sizes (and therefore desiredSize) can be non-integer. It is also
null when the stream has errored and 0 when it is closed.
@gords2 gords2 requested a review from a team as a code owner June 21, 2026 18:49
@gords2 gords2 requested review from dipikabh and removed request for a team June 21, 2026 18:49
@github-actions github-actions Bot added Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed labels Jun 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Content:WebAPI Web API docs size/s [PR only] 6-50 LoC changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ReadableStream desiredSize is not always an integer

2 participants