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

Make @types/react-dom a Peer dependency #1318

Closed
daniel-nagy opened this issue Apr 29, 2024 · 2 comments
Closed

Make @types/react-dom a Peer dependency #1318

daniel-nagy opened this issue Apr 29, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@daniel-nagy
Copy link

Describe the feature you'd like:

@types/react-dom is a dependency. The reason is that the types from @testing-library/react directly reference these types, as noted in this PR #1001.

However, this may cause multiple versions of these types to be installed in a user's project. For example, when updating to React 19 beta.

Suggested implementation:

I think it would be better to make these types a peer dependency. If someone is using React, TypeScript, and React Testing Library, then they should install these types anyway.

In the event of a miss-match, they would get a warning from the package manager of an unmet peer-dependency, instead of the package manager silently installing multiple versions and resulting in a stampede of confusing type errors.

Describe alternatives you've considered:

Use overrides to force the correct version of these types to be installed. This is not good DX.

Teachability, Documentation, Adoption, Migration Strategy:

Users will need to install @types/react-dom themselves.

@MatanBobi
Copy link
Member

Thanks @daniel-nagy, this is already in the works: #1305.
I'm closing this as it's a duplicate of: #1184.

@MatanBobi MatanBobi added the duplicate This issue or pull request already exists label Apr 29, 2024
@daniel-nagy
Copy link
Author

Thanks @MatanBobi, I guess I should look at the open PRs next time 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants