はじめに
よくみかけるエラーでしたが、結構苦戦したのでまとめます
問題
以下のエラーがVSCodeででました
Property 'toBeInTheDocument' does not exist on type 'JestMatchers<HTMLElement>'.ts(2339)
any
解決方法
tsconfigを修正します
CompilerOptions
に以下を追加することでVSCodeのエラーが消えました
"types": ["node", "jest", "@testing-library/jest-dom"]
おわりに
更新まですこし時間がかかるので効いてないと勘違いもしました