Skip to content

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

Description

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:

"ReadableStreamReadDoneResult": {
"name": "ReadableStreamReadDoneResult",
"typeParameters": [
{
"name": "T"
}
],
"members": {
"member": {
"done": {
"name": "done",
"overrideType": "true",
"required": true
},
"value": {
"name": "value",
"overrideType": "T"
}
}
}
},

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions