Closed
Description
@testing-library/react
version: 10.2.0- Testing Framework and version: jest@25.4.0
- DOM Environment: jsdom@15
Relevant code or config:
import { render } from "@testing-library/react/pure";
What happened:
TS7016: Could not find a declaration file for module '@testing-library/react/pure'.
Reproduction:
https://codesandbox.io/s/nifty-tharp-3de0h?file=/src/index.ts:61-114
Problem description:
This is happening because the pure.d.ts
file is not next to pure.js
, it's in a types
folder and TS doesn't know how to link it. It's OK for the entry index because there's a pkg.types
pointing to it, but importing something else requires the type file to be colocated.
Suggested solution:
I think the files could either be moved next to their corresponding .js
files and the build step updated to include them, or have a separate build step that does cp types/*.d.ts dist/
.