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

Make Thenable assignable to PromiseLike #30

Conversation

Strate
Copy link
Contributor

@Strate Strate commented Sep 6, 2016

Add overloads to Bluebird.Thenable.then method to correspond with ES6 PromiseLike interface.

See also #29 (comment)

@louy
Copy link
Member

louy commented Sep 6, 2016

Any reason for not using extends PromiseLike<R>?

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

@louy PromiseLike.then returns PromiseLike, not Bluebird.Thenable

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

But, maybe we could just alias Thenable to PromiseLike.

@blakeembrey
Copy link
Member

@louy You shouldn't use extends PromiseLike because this definition will be used in a non-ES6 environment.

@Strate
Copy link
Contributor Author

Strate commented Sep 7, 2016

@blakeembrey PromiseLike exists in lib.es5.d.ts

@blakeembrey
Copy link
Member

@Strate The perhaps can it can be used then, I had never noticed that. I'm always a little wary, since they can change at any time. For instance, if the break that did occur happened, that would have meant it would break when updating TypeScript randomly. It's not a lot of fun to track TypeScript versions for testing.

@Strate
Copy link
Contributor Author

Strate commented Sep 9, 2016

@blakeembrey To avoid incinsistences between typescript's definition of PromiseLike, and bluebird's definition Thenable it is possible to alias Thenable to PromiseLike. But, Bluebird class should have overloading for each .then declaration to fix return type of that method.

BTW, I think this should be discussed separately.

@blakeembrey
Copy link
Member

@Strate I agree. I don't see anything wrong with the current change 👍

@blakeembrey blakeembrey merged commit ca3bb02 into typed-typings:master Sep 9, 2016
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.

None yet

3 participants