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
Property 'toHaveStyleRule' does not exist on type 'JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>>'. #291
Comments
Looking at |
I am also currently stuck in this. Did you found any answers to this? Someone has already faced the problem and a temporary solution could be this #264 |
It seems that the issue started with this fix: Seems like it might be a TypeScript bug since it works fine without the export statement at the bottom of |
It looks like the issue is the import/export commands turned this global declaration file into a module declaration file. That prevents the namespace declaration from being exposed and joined to the public jest namespace. If I create a new index.d.ts file in jest-styled-components/serializer, and move the import and export statements there, the jest declaration is exposed again and the issue is cleared. In addition, it seems to resolve the original issue in #259. As it is now, I get TS errors attempting to import the serializer. Moving it into this new file clears both sets of errors. |
I'm getting the same error :( |
i've created a branch that solves this issue that is a bit smaller in scope compared to @landisdesign s work: #308 |
@tobilen This is great! I'm glad there was a way around this that didn't break the existing API. I'm going to have to remember this for the future. |
src/setupTests.ts
__tests__/Component.tsx
Error:
Strangely enough if I create a file with the exact same type definition then I get no error. For some reason Typescript is unable to augment
jest.Matchers
interface when importingjest-styled-components
directly.types/jest-styled-components.d.ts
The text was updated successfully, but these errors were encountered: