[whatwg-streams] Fixes for readable byte streams#27375
Merged
weswigham merged 6 commits intoDefinitelyTyped:masterfrom Jul 21, 2018
Merged
[whatwg-streams] Fixes for readable byte streams#27375weswigham merged 6 commits intoDefinitelyTyped:masterfrom
weswigham merged 6 commits intoDefinitelyTyped:masterfrom
Conversation
Contributor
|
@MattiasBuelens Thank you for submitting this PR! 🔔 @saschanaz @ksm2 - please review this PR in the next few days. Be sure to explicitly select If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead. |
Contributor
|
Since you're a listed owner and the build passed, this PR is fast-tracked. A maintainer will merge shortly. If it shouldn't be merged yet, please leave a comment saying so and we'll wait. Thank you for your contribution to DefinitelyTyped! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR makes the type definitions for readable byte streams match the spec more closely. An overview of the changes:
ReadableByteStreamController.enqueueaccepts anyArrayBufferView.Step 5 only requires
chunkto have a[[ViewedArrayBuffer]]internal slot, which exactly matchesArrayBuffer.isView. Different chunks can have different types, as long as each of them is some kind ofArrayBufferView.ReadableStreamBYOBRequest.viewis always aUint8Array.Step 2b always constructs a
Uint8Array. It will never be a different kind ofArrayBufferView.ReadableByteStreamController.byobRequestmay beundefined.Step 2 only constructs a BYOB request when
[[pendingPullIntos]]is not empty. If it is empty, no BYOB request is constructed.ReadableByteStreamSourceand related classes.As demonstrated by the above changes, readable byte streams aren't generic according to the spec, so there's no use for the
Rtype parameter.I've also included a small ergonomic fix for users targeting ES5:
IteratorResultwith own interface to avoid dependency on ES2015 types.Previously, we used
IteratorResult<T>in the return type ofread(), but this type is not available when compiling with--lib es5. I've added aReadResult<T>type which is just a copy ofIteratorResult<T>, so the type definitions also work in ES5. 😄Please fill in this template.
npm test.)npm run lint package-name(ortscif notslint.jsonis present).Select one of these and delete the others:
If changing an existing definition:
tslint.jsoncontaining{ "extends": "dtslint/dt.json" }.