-
Notifications
You must be signed in to change notification settings - Fork 595
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
Promise.prototype.finally [fixes #232] #233
Conversation
e67a975
to
e25a046
Compare
d5b4735
to
de5ab23
Compare
@ljharb should I wait until stage 3? |
Officially yes, but at this point I do not anticipate changes prior to stage 3 that would affect this PR. Take that with the appropriate grains of salt :-) |
Hey guys. There a chance we will see an merge in near future? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far this looks great; two comments, and then there's actually a difference with Promise.resolve
in the spec and here, which is that this one returns the promise unchanged when it's a base Promise and finally's does not - that might end up changing tho.
es6-promise.d.ts
Outdated
* | ||
* @param onSettled called when/if "promise" settles | ||
*/ | ||
finally <U> (onSettled?: (callback: any) => U | Thenable<U>): Promise<U>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onFinally
is the name in the spec
*/ | ||
finally(callback) { | ||
let promise = this; | ||
let constructor = promise.constructor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to use Symbol.species
to look up the constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't currently support species stuff here.
Any updates on this? Also I'd like to remind you that just like |
Thanks for the reminder! I have also been eager to land this. Taking a look now.
|
de5ab23
to
40e0c67
Compare
40e0c67
to
14ca840
Compare
@l1bbcsg updated, waiting for CI to complete |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems legit; modulo Symbol.species stuff
No description provided.