1

I'm working on a react project in typescript (react version 16.12.0) and I would like to add React Testing Library to this. The newer versions of react comes with React-Testing-Library but the project I'm working on doesn't come with RTL, so I installed it manually.

I added the below to package.json and did yarn install

"@types/testing-library__react": "^10.2.0",

When I did yarn start, I get this error below

enter image description here

Other related packages versions used

 "@types/react": "~16.9.14",

 "typescript": "3.4.5",

 "react-scripts": "^3.0.0",
Sandeep Amarnath
  • 5,463
  • 3
  • 33
  • 43

1 Answers1

0

The issue was occurring with the typescript version. After some research, I found that for react-testing-library to work with typescript, the TS version needs to be updated to 3.8 and above.

After updating typescript version to 3.8 and fixing some of the errors caused by this update, I was able to resolve this error.

Sandeep Amarnath
  • 5,463
  • 3
  • 33
  • 43