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

fix: need type decl for HandledPromise.reject #1406

Merged
merged 4 commits into from
Aug 9, 2020

Conversation

erights
Copy link
Member

@erights erights commented Aug 9, 2020

Declared the HandledPromise constructor to extend from the Promise constructor, mirroring the implementation's inheritance arrangement. Thus, the HandledPromise now inherits the reject declaration. Also the resolve declaration, which this PR deletes.

Better typing of E.when, fixing the "when" component of #1362 .

@erights erights requested a review from michaelfig August 9, 2020 02:00
Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

interface HandledPromiseConstructor extends PromiseConstructor { ... works for me. Perhaps that's what you're looking for?

https://www.typescriptlang.org/docs/handbook/interfaces.html#extending-interfaces

@erights
Copy link
Member Author

erights commented Aug 9, 2020

That's what I needed. Fixed. Thanks.

Copy link
Member

@michaelfig michaelfig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@michaelfig
Copy link
Member

Do you want also to fix #1362 while you're there?

@michaelfig
Copy link
Member

I see that the HandledPromise constructor implementation inherits from the Promise constructor, and so does not need to provide its own HandledPromise.resolve.

Could you remove the explicit resolve declaration as well?

@erights erights merged commit aec2c99 into master Aug 9, 2020
@erights erights deleted the decl-handled-promise-reject branch August 9, 2020 05:40
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.

2 participants