Skip to content

Improve Streams #750

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

Merged
merged 5 commits into from
Nov 14, 2019
Merged

Improve Streams #750

merged 5 commits into from
Nov 14, 2019

Conversation

MattiasBuelens
Copy link
Contributor

This PR improves the type definitions for Streams:

  • Align ReadableStreamReadResult with the new IteratorResult definition from TypeScript 3.6. It is now equivalent to IteratorResult<T, T | undefined>, but since the DOM types cannot depend on es2015.iterable, I needed to add my own typedef with a union type. Fortunately, TypeScript will recognize these as equivalent thanks to its structural type system. 😄 Since this is a generic type alias, I have updated the emitter to support type parameters for typedefs.
  • Add chunk types to TextEncoderStream and TextDecoderStream from the Encoding standard. Their readable and writable properties were defined as just ReadableStream and WritableStream, so they had the default chunk type any. Now, we use the precise chunk types from the spec.

I've also done some cleanup on how the Streams types are defined:

  • Use [NoInterfaceObject] in (manually authored) WebIDL, instead of adding "no-interface-object" to the overrides.
  • Remove unnecessary "override-exposed" where the exposure was already correctly defined in the WebIDL.

@sandersn sandersn merged commit d182a31 into microsoft:master Nov 14, 2019
@MattiasBuelens MattiasBuelens deleted the improve-streams branch November 14, 2019 22:22
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 this pull request may close these issues.

2 participants