-
Notifications
You must be signed in to change notification settings - Fork 43
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
TypeScript fails to find extended expect methods #7
Comments
Hey thanks for pointing this out. I think that it makes sense to me, but my only question is, this is how the matchers are typed in jest-dom as well, so do you think this a problem there as well? I couldn't find any issues about this on their repo and that one is widely used by more than just React folks, so are we positive this isn't something else at play? Admittedly, I don't know why they did it that way over there (perhaps @gnapse could help me out with this one) but it seems like since it works there it should work here? 🤔 |
That's a valid point. I've not used |
@lewie9021 what's the verdict here? what do you think we should do? |
I believe the |
🎉 This issue has been resolved in version 3.0.2 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
I think that error was not fixed in 3.0.2 |
🤔 can anyone else chime in? Or if anyone can think of a better fix for the issue, PRs are welcome 👍 |
For the record I'm using version 3.0.2 without any further issues. It might help to understand your setup better @sinxwal. |
I am still getting the issue in version 3.0.2 EDIT: After changing my |
react-native
orexpo
: 0.59.2@testing-library/react-native
version: 4.0.2@testing-library/jest-native
version: 3.0.1jest-preset
: "@testing-library/react-native"react-native
version: 0.59.2typescript
version: 3.1.6node
version: 10.13.0Relevant code or config:
What you did:
Installed
jest-native
within a project using TypeScript.What happened:
I get a TypeScript error when using any of the custom matchers from the library, e.g:
Reproduction:
See code above.
Problem description:
Without the correct typings, it's not possible to use the additional assertions from the library within a TypeScript project.
Suggested solution:
Since Jest exposes
expect
globally, it appears we need to merge the matchers in the global namespace, meaningextend-expect.d.ts
should look like this:The text was updated successfully, but these errors were encountered: