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

react-redux installs @types/react@18 #1898

Closed
1 task done
furkanalptokac opened this issue Apr 14, 2022 · 1 comment
Closed
1 task done

react-redux installs @types/react@18 #1898

furkanalptokac opened this issue Apr 14, 2022 · 1 comment

Comments

@furkanalptokac
Copy link

furkanalptokac commented Apr 14, 2022

What version of React, ReactDOM/React Native, Redux, and React Redux are you using?

  • React: 17.0.2
  • ReactDOM/React Native: 17.0.2
  • Redux: -
  • React Redux: 7.2.6

What is the current behavior?

react-redux 7.2.6 installs @types/react@18

What is the expected behavior?

I expect that react-redux doesn't install @types/react@18. When @types/react@18 installed, our components' types goes crazy.

Which browser and OS are affected by this issue?

Ubuntu 20.4

Did this work in previous versions of React Redux?

  • Yes
@markerikson
Copy link
Contributor

This isn't actually an issue with React-Redux itself as far as I know.

Up through v7, the React-Redux types have been maintained by the community in DefinitelyTyped, in the @types/react-redux package.

React-Redux v7.x has a hard dependency on @types/react-redux@^7, in order to ensure that our TS users automatically get the types.

However, DefinitelyTyped apparently automatically adds a dependency like "@types/react": "*" to any package that imports from @types/react. So, the real issue here is how DT constructs its packages.

One option here is to specifically tell your package manager what version of @types/react to resolve to, and enforce that across your project:

facebook/react#24304 (comment)

The other is to upgrade to React-Redux v8, which is currently in RC and will be released live in the next few days. It's already written in TS, so we don't have a dependency on @types/react-redux any more, and it should work with whatever version of @types/react is already installed

https://github.com/reduxjs/react-redux/releases

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

No branches or pull requests

2 participants