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

Allow Bluebird to be assignable to es2016 standard Promise: #29

Merged
merged 3 commits into from Sep 6, 2016

Conversation

Strate
Copy link
Contributor

@Strate Strate commented Sep 5, 2016

Add overload for 2-argument .then call.

see DefinitelyTyped/DefinitelyTyped#11027

@blakeembrey
Copy link
Member

@Strate Could you correct the changes to the comment block?

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

@blakeembrey in what case? Just a fix argument names or split comment into four, as in standard Promise?

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

aught, there is CI issues, I'll fix it now.

@blakeembrey
Copy link
Member

Sorry, correcting the changes just meant to remove the unnecessary change in the comment block (which did result in a linting failure).

@blakeembrey blakeembrey merged commit ba2d139 into typed-typings:master Sep 6, 2016
@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

@blakeembrey, what do you think to implement PromiseLike, or even stabdard Promise interface on Bluebird class, to avoid such issues in the future?

@blakeembrey
Copy link
Member

@Strate It's implemented as Bluebird.Thenable, which reminds me that perhaps that also should be updated.

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

interface Thenable<R> extends PromiseLike<R>;

And remove .then from Promise class completely.

@Strate
Copy link
Contributor Author

Strate commented Sep 6, 2016

And remove .then from Promise class completely.

nvm, we should add overrides to change return type of .then

@blakeembrey
Copy link
Member

@Strate I might actually have to test this repo out a little, but unless I'm missing something, isn't it odd that the tests passed before? Since Bluebird implements Thenable was working, doesn't that make the changes assignable already?

@Strate
Copy link
Contributor Author

Strate commented Sep 7, 2016

@blakeembrey nope, because issue was: "bluebird is not assignable to es6 promise", not "es6 promise is not assignable to bluebird".
For example, if I would change Thenable to correspond PromiseLike, but not change Bluebird to correspong Promise: Bluebird imlements Thenable would be broken.

@blakeembrey
Copy link
Member

Ah, this is a huge PITA. This change actually breaks anyone using TypeScript < beta. I just run into it, can't use async/await since the then implementation is different. Not sure if this issue has been resolved on TypeScript, or future changes can still break this.

@blakeembrey
Copy link
Member

Interestingly, the definition I've always used in https://github.com/types/npm-es6-promise/blob/master/dist/es6-promise.d.ts for .then works in both 1.8 and 2.0. Can anyone else confirm this or am I going crazy?

@Strate
Copy link
Contributor Author

Strate commented Sep 12, 2016

@blakeembrey is that definition assignable to es6 promise from ts 2.0? I don't think so...

@blakeembrey
Copy link
Member

Yes, it is. I tested it, I was just asking for confirmation. At least, I'm using it with 2.0 through thenify, bcrypt-then.

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

2 participants