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

"it can return a promise" -> actually a thenable #566

Closed
ricea opened this issue Oct 26, 2016 · 2 comments
Closed

"it can return a promise" -> actually a thenable #566

ricea opened this issue Oct 26, 2016 · 2 comments
Labels
editorial Changes that do not affect how the standard is understood

Comments

@ricea
Copy link
Collaborator

ricea commented Oct 26, 2016

https://streams.spec.whatwg.org/#ref-for-pull-source-1

it can return a promise

Actually a thenable. The same applies to all sink and source methods that can return a Promise.

I noticed this when I was looking at the Closure compiler extern definitions for Streams, at https://github.com/google/closure-compiler/blob/master/externs/browser/streamsapi.js

For example, the type of ReadableStreamSource.prototype.start is declared as function((!ReadableByteStreamController|!ReadableStreamDefaultController)):(!Promise<*>|undefined)). At first I thought this was a bug in Closure's extern definitions, but then I realised that this is what the Streams standard actually says.

Editorially, the simplest fix would be to say "thenable" where we currently say "Promise", but I am concerned that might be too hard to understand.

@ricea ricea added the editorial Changes that do not affect how the standard is understood label Oct 26, 2016
@domenic
Copy link
Member

domenic commented Oct 26, 2016

I think it is fine as-is. The notes explaining usage are meant to guide you down the right path, not state what is technically allowed.

As a separate example, we would say "can return a number" instead of "can return any object that coerces to a number". (I.e., there's no need to point out that not only 1, but also { valueOf() { return 1; } } or "1" work.)

@domenic
Copy link
Member

domenic commented Oct 28, 2016

Closing, but happy to reopen if you disagree.

@domenic domenic closed this as completed Oct 28, 2016
@ricea ricea mentioned this issue Apr 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editorial Changes that do not affect how the standard is understood
Development

No branches or pull requests

2 participants