'Property 'getAllByRole' does not exist on type 'Screen'. TS2339
I'm working on a web application in which the front end is built using ReactJs. When I run the code, I'm getting this error as mentioned.
TypeScript error in My_project/src/unitTestUtils.tsx(79,27):
Property 'getAllByRole' does not exist on type 'Screen'. TS2339
> 79 | const rowGroups = scope.getAllByRole("rowgroup");
When I suppress the error with // @ts-ignore, everything is working fine. Please tell me how to get resolve this error.
Solution 1:[1]
Make sure that you are using Screen type form @testing-library/react. There is a Screen type in lib.dom.d.ts and it is resolved by tsconfig
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Mateusz Krzy?anowski |
