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

Cannot compile react-native TS without react-dom in 8.x #1961

Closed
1 task done
slaci opened this issue Oct 7, 2022 · 6 comments
Closed
1 task done

Cannot compile react-native TS without react-dom in 8.x #1961

slaci opened this issue Oct 7, 2022 · 6 comments

Comments

@slaci
Copy link

slaci commented Oct 7, 2022

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

  • React Native: 0.70.2
  • React Redux: 8.0.4

What is the current behavior?

On tsc compile I get the following error in a react-native project:

node_modules/react-redux/es/utils/reactBatchedUpdates.d.ts:1:41 - error TS2307: Cannot find module 'react-dom' or its corresponding type declarations.

1 export { unstable_batchedUpdates } from 'react-dom';

Previous version (7.2.9) compiles without any error.

What is the expected behavior?

The react-dom package should not be required for a react-native project.

Which browser and OS are affected by this issue?

No response

Did this work in previous versions of React Redux?

  • Yes
@phryneas
Copy link
Member

phryneas commented Oct 7, 2022

Even though react-dom is not required on runtime if you are in a react-native environment, the types are referencing it - you should be fine by just having @types/react-dom installed in your project.

@slaci
Copy link
Author

slaci commented Oct 7, 2022

I'm totally fine with that, but didn't know that would fix this error. I tried it and now it's all good so I'm closing. Thanks for the info!

@slaci slaci closed this as completed Oct 7, 2022
@markerikson
Copy link
Contributor

Hmm. Interesting. There may be something we can tweak here to fix that, actually.

@markerikson markerikson reopened this Oct 7, 2022
@markerikson
Copy link
Contributor

I wish one-month-ago me had written down what he was thinking, because current-me has no idea what that was :)

@slaci
Copy link
Author

slaci commented Nov 4, 2022

Sadly I'm not familiar enought with typescript to be able to help you with this, but at least I can confirm again that installing @types/react-dom workarounds the issue.

@markerikson
Copy link
Contributor

Old and no further discussions, so I'm going to close this.

@markerikson markerikson closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
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

3 participants