Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No type definitions for react/pure #695

Closed
NiGhTTraX opened this issue Jun 5, 2020 · 3 comments · Fixed by #696
Closed

No type definitions for react/pure #695

NiGhTTraX opened this issue Jun 5, 2020 · 3 comments · Fixed by #696
Labels

Comments

@NiGhTTraX
Copy link
Contributor

  • @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/.

@kentcdodds
Copy link
Member

I think this should fix it: #696

Could you confirm?

kentcdodds added a commit that referenced this issue Jun 5, 2020
* fix(TS): add type defs file for pure

Closes #695

* Update pure.d.ts

Co-authored-by: Andrei Picus <485061+NiGhTTraX@users.noreply.github.com>

* Update package.json

Co-authored-by: Andrei Picus <485061+NiGhTTraX@users.noreply.github.com>
@kentcdodds
Copy link
Member

🎉 This issue has been resolved in version 10.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@samtsai
Copy link
Collaborator

samtsai commented Jun 5, 2020

Thanks @NiGhTTraX for catching this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants