fix(api): correct ReadableStreamDefaultController.desiredSize value type#44536
Open
gords2 wants to merge 1 commit into
Open
fix(api): correct ReadableStreamDefaultController.desiredSize value type#44536gords2 wants to merge 1 commit into
gords2 wants to merge 1 commit into
Conversation
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.
Contributor
|
Preview URLs (1 page) |
dipikabh
requested changes
Jun 26, 2026
Comment on lines
+17
to
+22
| A number, or `null`. | ||
|
|
||
| This can be negative if the queue is over-full, and it is not necessarily an | ||
| integer: when a custom queuing strategy is used, chunk sizes — and therefore | ||
| `desiredSize` — can be non-integer values. The value is `null` if the stream has | ||
| errored, and `0` if it is closed. |
Contributor
There was a problem hiding this comment.
"it is not necessarily an integer" - Instead of saying what it's not, we can be direct and mention the possible value types.
In fact, we have a few other desiredSize property pages. The ReadableByteStreamController.desiredSize is the closest to what we want to say here.
For consistency, could you update this "Value" section to match what we have on that page?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #44486
The Value section claimed
desiredSizeis "An integer", which is inaccurate on two counts (both raised in the issue):null—ReadableStreamDefaultController.desiredSizereturnsnullwhen the stream has errored (and0when it is closed), per the spec algorithm.desiredSizefrom the queuing strategy'ssize()results. A custom queuing strategy can return non-integer sizes, sodesiredSizecan 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.