-
-
Notifications
You must be signed in to change notification settings - Fork 44
Typescript error "does not satisfy the constraint 'Queries' #30
Comments
Hi @manakuro, I've not personally used import 'react-native'
import React from 'react'
import App from 'app/src/App'
import { render, toJSON } from '@testing-library/react-native'
it('renders correctly', () => {
const { baseElement } = render(<App />)
expect(toJSON(baseElement)).toMatchSnapshot()
}) If that doesn't work, try using import 'react-native'
import React from 'react'
import App from 'app/src/App'
import { render, toJSON } from '@testing-library/react-native'
it('renders correctly', () => {
const { container } = render(<App />)
expect(toJSON(container)).toMatchSnapshot()
}) Hope that helps! |
Thanks for jumping in Lewis 👍 @manakuro sorry for the delay. So, this one just looks like an issue with the typings actually. I’m not a typescript user myself, so would you mind helping out by creating a PR to fix the type issues you’re running into? I can support that effort however necessary to allow these to be correct 💯 After the typings are fixed, what you did should work. Until the typings are fixed, even what Lewis suggested won’t work without compile errors. |
Hi @lewie9021 @bcarroll22 Hi, thank you for the reply. Okay I'll create a PR to fix it. 👍 Thank you for your guys help ! |
Awesome! Thanks for your help. I should be able to get it reviewed and merged today. |
Hi, any update on this? |
Hi sorry for the late reply. I'm going to work on it this week. |
@manakuro No worries at all, I just didn't see an update and was worried I'd missed something :) |
🎉 This issue has been resolved in version 4.0.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
react-native
orexpo
:react-native
native-testing-library
version:^4.0.2
jest-preset
:@testing-library/react-native
react-native
version:0.59.8
node
version:v11.10.1
Relevant code or config:
__test__/App.spec.tsx
What you did:
Rendered a component and use
toMatchSnapshot
.What happened:
TypeScripts error occurred.
Reproduction:
Problem description:
Cannot compile it.
Suggested solution:
I temporarily skip typing check using
paths
option intsconfig.json
and createtypes/@testing-library/react-native.d.ts
like this:tsconfig.json
Could you please fix this typing error or give me any suggestions?
The text was updated successfully, but these errors were encountered: