Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kraenhansen opened this issue Jan 21, 2024 · 0 comments · May be fixed by #1676
Open

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

kraenhansen opened this issue Jan 21, 2024 · 0 comments · May be fixed by #1676

Comments

@kraenhansen
Copy link

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"
}
}
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant