-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
@testing-library/reactversion: v12.1.2- Testing Framework and version: N/A
- DOM Environment: N/A
What you did:
Tried to use @testing-library/react in a TS web app built with Bazel's rules_nodejs, which enforce strict visibility between NPM packages as determined by their declared dependencies.
What happened:
Got the following tsc error when compiling a test that uses @testing-library/react with rules_nodejs:
node_modules/@testing-library/react/types/index.d.ts(9,24): error
TS2307: Cannot find module 'react-dom' or its corresponding type
declarations.
node_modules/@testing-library/react/types/index.d.ts(10,31): error
TS2307: Cannot find module 'react-dom/test-utils' or its corresponding
type declarations.
Problem description:
@testing-library/react declares @types/react-dom as a devDependency, but uses it in its external interface when used from TypeScript.
Suggested solution:
Mark @types/react-dom as a regular dependency of @testing-library/react so that packages depending on @testing-library/react also pick up this dependency.