@testing-library/jest-dom version: 4.2.4node version: 10.16.0npm (or yarn) version: yarn v1.19.1// menu.test.tsx
expect(getByText('Option 5')).toBeVisible()
// scripts/expect.ts
import '@testing-library/jest-dom/extend-expect'
// jest.config.ts
setupFilesAfterEnv: ['<rootDir>/scripts/expect.ts']
I configure the @testing-library/jest-dom/extend-expect following README.md Usage - 1
The typescript definition doesn't work:
类型“JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>>”上不存在属性“toBeVisible”。ts(2339)

In English, the error means JestMatchersShape<Matchers<void, HTMLElement>, Matchers<Promise<void>, HTMLElement>> doesn't has toBeVisible / toBeInDocument attributes
It seems pointed out before, but the solution doesn't work
https://github.com/testing-library/jest-dom/pull/11#issuecomment-387817459
Sorry I can't reproduce the error a moment later.
It looks so strange, I tried reloading vscode window, restarting vscode and waited for a long time, the error always there...
So I went to do other things, then suddenly found the error disappeared and the definition shown.

So it works fine now, although I have done nothing to fix it.
I should close the issue now.
I have a similar error while running tests and using vscode.
I have noticed that based on some.test.ts size it works or doesn't work. This is so annoying and I can't seem to understand where this behavior is coming from
@reinismu we'd need a sample repo where this can be reproduced.
I've actually run into this same problem in my code. Jest will run the tests properly after a fresh reboot; when I revise the .spec file and save, I then get this error.
I'll have to create a sample repo to try and reproduce this.
I've run into this issue with vscode and running tests in watch mode. After doing a --clearCache everything works.
Most helpful comment
I've run into this issue with vscode and running tests in watch mode. After doing a
--clearCacheeverything works.