Skip to content

findBy* typings: Remove Error as a possible return value #239

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

Merged
merged 2 commits into from
Apr 12, 2019
Merged

findBy* typings: Remove Error as a possible return value #239

merged 2 commits into from
Apr 12, 2019

Conversation

bopfer
Copy link
Contributor

@bopfer bopfer commented Apr 12, 2019

What:

  • Remove | Error from findBy* return typings.

Why:

How:

  • I updated each of the 4 return typings for the findBy* functions and removed | Error.

Checklist:

  • Documentation added to the docs site N/A
  • Typescript definitions updated
  • Tests N/A
  • Ready to be merged

@alexkrolick
Copy link
Collaborator

alexkrolick commented Apr 12, 2019

https://github.com/Microsoft/TypeScript/blob/master/src/lib/es2015.promise.d.ts#L13

This looks correct, you can't type the rejected value of a Promise (thought you could 😅), and the error is not a return value, it's an exception.

So:

  • Promise<OK, Err>
  • Promise<OK | Err>
  • Promise | Error
  • Promise<OK>

alexkrolick
alexkrolick previously approved these changes Apr 12, 2019
@alexkrolick
Copy link
Collaborator

Codecov appears to be having issues https://status.codecov.io/ but this looks safe to merge when it's back up

Copy link
Contributor

@JaxCavalera JaxCavalera left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this, I was on the fence about including the | Error but ultimately assumed there were more implementation details under the hood I wasn't across. Glad you were able to fix that one up.

@kentcdodds kentcdodds merged commit e37d1f4 into testing-library:master Apr 12, 2019
@kentcdodds
Copy link
Member

Thanks!

@allcontributors[bot], please add @bopfer for test

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @bopfer! 🎉

@kentcdodds
Copy link
Member

@allcontributors[bot], please add @JaxCavalera for review

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @JaxCavalera! 🎉

@kentcdodds
Copy link
Member

Whoops, let me try that again..

@allcontributors[bot], please add @JaxCavalera for review

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @JaxCavalera! 🎉

@kentcdodds
Copy link
Member

One last time!

@allcontributors[bot], please add @JaxCavalera for review

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @JaxCavalera! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 3.19.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants