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

`ReadableStreamReadDoneResult` shouldn't be generic and should have `value: undefined`

Open kraenhansen opened this issue 1 year ago • 0 comments

As per https://developer.mozilla.org/en-US/docs/Web/API/ReadableStreamDefaultReader/read#return_value and https://streams.spec.whatwg.org/#ref-for-default-reader-read%E2%91%A0

If the stream becomes closed, the promise will be fulfilled with an object of the form { value: undefined, done: true }.

The current types are:

https://github.com/microsoft/TypeScript/blob/cea0b61320ee69ae863cc9d7bf873113eb420e3b/src/lib/dom.generated.d.ts#L1622-L1625

interface ReadableStreamReadDoneResult<T> {
    done: true;
    value?: T;
}

While I'd expect them to be

interface ReadableStreamReadDoneResult {
    done: true;
    value: undefined;
}

I believe this is a result of:

https://github.com/microsoft/TypeScript-DOM-lib-generator/blob/f4e507c3d0ba16fde16026d9265c201fecdb6538/inputfiles/addedTypes.jsonc#L1290-L1310

kraenhansen avatar Jan 21 '24 18:01 kraenhansen