Skip to content

Prevent installing multiple versions of @types/react #182

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

Conversation

newyankeecodeshop
Copy link
Contributor

@newyankeecodeshop newyankeecodeshop commented Feb 15, 2021

This is an alternative to #181 to fix the compile errors from type checking dependencies. The compiler errors are caused by multiple copies of @types/react being brought in by yarn. This happens because both @types/react-native and @types/react-test-renderer declare a dependency on @types/react, but they have different version dependencies, which causes duplication:

"@types/react-native@^0.63.2":
  version "0.63.49"
  resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.63.49.tgz#b9a4781a0543763f0079c3ef2ba2148a4509b32e"
  dependencies:
    "@types/react" "*"

"@types/react-test-renderer@^16.9.2":
  version "16.9.5"
  resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.5.tgz#edab67da470f7c3e997f58d55dcfe2643cc30a68"
  dependencies:
    "@types/react" "^16"

"@types/react@*":
  version "17.0.2"
  resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.2.tgz#3de24c4efef902dd9795a49c75f760cbe4f7a5a8"
  dependencies:
    "@types/prop-types" "*"
    csstype "^3.0.2"

"@types/react@^16":
  version "16.14.4"
  resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.4.tgz#365f6a1e117d1eec960ba792c7e1e91ecad38e6f"
  dependencies:
    "@types/prop-types" "*"
    csstype "^3.0.2"

This PR resolves this by forcing the resolution of @types/react@* to match @types/react@^16. Then type-checking can be re-enabled for 3rd party libraries.

When we upgrade to React Native 0.64, which includes React 17.0.1, this resolution will have to be updated as well.

Copy link
Collaborator

@radko93 radko93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is better than ignoring 3rd party libs.

@radko93 radko93 merged commit 7a2c416 into react-native-community:master Feb 16, 2021
@newyankeecodeshop newyankeecodeshop deleted the fix-duplicate-react-types branch February 16, 2021 12:10
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

Successfully merging this pull request may close these issues.

2 participants