-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
streamsapi.js externs: Sink / Source types too strict? #2108
Comments
Spec doesn't say anything about thenables. Or am I missing something here? https://streams.spec.whatwg.org/ |
It doesn't mention it explicitly. I brought this up in whatwg/streams#566 and it doesn't seem it's going to be made explicit. You need to follow the algorithms to find out what the exact semantics are. For example, the cancel method is called at https://streams.spec.whatwg.org/#rs-default-controller-private-cancel and https://streams.spec.whatwg.org/#rs-default-controller-private-cancel. In both places it is called via PromiseInvokeOrNoop() where the important step is
"a promise resolved with" links to https://www.w3.org/2001/tag/doc/promises-guide/#a-promise-resolved-with which then refers to To save you the time of chasing them down, all Source and Sink methods which are documented as "can return a promise" are called via PromiseInvokeOrNoop() or PromiseInvokeOrFallbackOrNoop() and so can return a thenable. |
All the Promise-returning methods for ReadableStreamSource and ReadableStreamSink can actually return thenables.
This means that, for example, the return type specified here is too strict:
I haven't actually had a real problem with this, I just work on the Streams standard. It may well be that there's no need to make this requirement more relaxed.
The text was updated successfully, but these errors were encountered: