content icon indicating copy to clipboard operation
content copied to clipboard

fix(api): correct ReadableStreamDefaultController.desiredSize value type

Open gords2 opened this issue 5 months ago • 0 comments

Fixes #44486

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

  • It can be null — ReadableStreamDefaultController.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.

gords2 avatar Jun 21 '26 18:06 gords2