← All tasks
javascripttesting-library/react-testing-library #1000Not a task: not reproduced

`@types/react-dom` incorrectly declared as a `devDependency`

envgap__testing-library__react-testing-library-1000

01 / FAILURE SIGNATURE

As reported upstream

TS2307: Cannot find module 'react-dom' or its corresponding type
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
8f17a2bc4fa9c2c17a623b38ded9ab18b086e457
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

testing-library/react-testing-library #1000 · read the original issue
- `@testing-library/react` version: 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](https://github.com/bazelbuild/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`](https://github.com/testing-library/react-testing-library/blob/8f17a2bc4fa9c2c17a623b38ded9ab18b086e457/package.json#L52), but uses it in [its external interface](https://github.com/testing-library/react-testing-library/blob/8f17a2bc4fa9c2c17a623b38ded9ab18b086e457/types/index.d.ts#L9) 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.

Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]