TypeScript-DOM-lib-generator icon indicating copy to clipboard operation
TypeScript-DOM-lib-generator copied to clipboard

`ReadableStream` should be async-iterable

Open kraenhansen opened this issue 1 year ago • 0 comments

As per https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#async_iteration and https://streams.spec.whatwg.org/#rs-asynciterator

ReadableStream implements the async iterable protocol. This enables asynchronous iteration over the chunks in a stream using the for await...of syntax.

The current types declare no Symbol.asyncIterator nor extends AsyncIterator:

https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/f4e507c3d0ba16fde16026d9265c201fecdb6538/baselines/dom.generated.d.ts#L18604-L18631

I'd expect a Symbol.asyncIterator member on the ReadableStream.

I noticed that it does seem like an iterator is added to the input file: https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/f4e507c3d0ba16fde16026d9265c201fecdb6538/inputfiles/overridingTypes.jsonc#L2629-L2635

kraenhansen avatar Jan 21 '24 20:01 kraenhansen