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

Consider relaxing thenReject to accept types other than Error #510

Open
iliocatallo opened this issue Mar 27, 2023 · 2 comments
Open

Consider relaxing thenReject to accept types other than Error #510

iliocatallo opened this issue Mar 27, 2023 · 2 comments

Comments

@iliocatallo
Copy link
Contributor

Description

In a TypeScript code base, thenReject() only accepts Errors.

Issue

It would be nice to allow for different types of rejected values – along the lines of this JavaScript example in the official docs.

Thanks,
Ilio.

@searls
Copy link
Member

searls commented Mar 27, 2023

Is this about the project's typings file? As a non-TS user, I've sorta let it be a free-for-all for anyone to contribute edits sensibly, so if you want to take a stab at a PR I would welcome it

@iliocatallo
Copy link
Contributor Author

Hi Justin,

According to their own declaration, in TypeScript Promise.reject accepts a reason of type any. Since thenReject is a short-hand for thenReturn(Promise.reject), I'd be inclined to use the same type. I'll try and submit a PR later.

Thank you,
Ilio.

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

No branches or pull requests

2 participants