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

Result of combineReducers is not exportable with latest typescript #4030

Closed
JacobLey opened this issue Mar 8, 2021 · 3 comments
Closed

Result of combineReducers is not exportable with latest typescript #4030

JacobLey opened this issue Mar 8, 2021 · 3 comments

Comments

@JacobLey
Copy link

JacobLey commented Mar 8, 2021

Prior Issues

Attempt to fix by directly exporting $CombinedState #4029

What is the current behavior?

When typescript is upgraded to the latest version 4.2.x the output of combineReducers throws an error.

Steps to Reproduce

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://codesandbox.io or similar.

What is the expected behavior?

See minimal reproducible error here: #4029
Checkout branch https://github.com/JacobLey/redux/tree/combinedStateRepro, run cd ./error && npm start

Typescript should run, and emit error Default export of the module has or is using private name '$CombinedState'

What should Redux be doing?

Exporting the result of combineReducers should not be a typescript error.

Environment Details

To my knowledge, all versions of Redux with Typescript declarations are impacted.
More importantly, this change happens on the latest 4.2.x versions of Typescript.

@JacobLey
Copy link
Author

JacobLey commented Mar 8, 2021

Opened this Issue at request of #4026 (comment)

@markerikson
Copy link
Contributor

markerikson commented Mar 8, 2021

My first question is, why are you exporting it with an empty generic and an empty object? Does this happen with "normal" usage, ie, something like combineReducers({counter: counterReducer})?

Also, if something about TS 4.2 changed how it's interpreting the types... I'd like to know what about TS 4.2 changed so that we know why this is suddenly causing an error.

@JacobLey
Copy link
Author

JacobLey commented Mar 8, 2021

Updated error branch to give examples of failure with actual map.
For some reason createStore is required to trigger the issue

I too would like to know what the Typescript change is, but cannot easily find a related commit.
This type of error is not new to Typescript though: microsoft/TypeScript#6307

@timdorr timdorr closed this as completed Mar 8, 2021
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