You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 30, 2020. It is now read-only.
Followed the documentation and code examples for firing events and accessing props but found TypeScript errors.
What happened:
TypeScript error for fireEvent.press call:
Error:(28, 19) TS2345: Argument of type 'ReactTestRenderer' is not assignable to parameter of type 'Pick<ReactTestInstance, "type" | "props" | "parent" | "children" | "find" | "findAll">'.
TypeScript error when accessing element props:
Error:(32, 15) TS2339: Property 'props' does not exist on type 'ReactTestRenderer'.
Reproduction:
See full code example above.
Problem description:
The TypeScript error suggest that I'm using the library wrong even though I'm following exactly as the documentation states. The only way to run the tests is to use @ts-ignore comments above each line potentially suppressing other issues TypeScript may find with my tests.
Suggested solution:
I found that modifying the return type of the exported methods in typings/queries.d.ts from ReactTestRenderer to NativeTestInstance seemed to solve the issue, but I'm not exactly sure if that's correct. My knowledge of react-test-renderer is rather limited.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this! Your fix of changing the type to NativeTestInstance is correct. I won’t be able to get to this tonight but I’d be able to merge a PR to fix it if you have the chance? Thanks again for filing!
react-native
orexpo
: react-nativenative-testing-library
version: 3.0.0jest-preset
: native-testing-libraryreact-native
version: 0.59.2node
version: 10.13.0Relevant code or config:
What you did:
Followed the documentation and code examples for firing events and accessing props but found TypeScript errors.
What happened:
TypeScript error for
fireEvent.press
call:TypeScript error when accessing element props:
Reproduction:
See full code example above.
Problem description:
The TypeScript error suggest that I'm using the library wrong even though I'm following exactly as the documentation states. The only way to run the tests is to use
@ts-ignore
comments above each line potentially suppressing other issues TypeScript may find with my tests.Suggested solution:
I found that modifying the return type of the exported methods in
typings/queries.d.ts
fromReactTestRenderer
toNativeTestInstance
seemed to solve the issue, but I'm not exactly sure if that's correct. My knowledge ofreact-test-renderer
is rather limited.The text was updated successfully, but these errors were encountered: