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

Open Beginner friendly
#1,675 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
typescript
Domain
tooling

Research direction

Start in inputfiles/addedTypes.jsonc around the ReadableStream type definitions, then inspect the generated declaration at src/lib/dom.generated.d.ts around lines 1622-1625. Verify how the input produces ReadableStreamReadDoneResult and update the definitions so the generated output matches the documented closed-stream result.

Written by the indexing model from the issue text.

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:

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

Dominant language
TypeScript
Stars
740
Forks
474
Avg merge
2d 8h
Merged PRs (30d)
15

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/TypeScript-DOM-lib-generator

All issues in microsoft/TypeScript-DOM-lib-generator

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.