TypeScript: Excessive stack depth comparing generic preloadedState with DeepPartial
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
Passing a generically typed preloadedState
parameter into createStore
creates an “Excessive stack depth” error in TypeScript due to the comparison between S
and DeepPartial<S>
Sandbox: https://codesandbox.io/s/busy-leavitt-wrpnx?fontsize=14
More information at https://github.com/Microsoft/TypeScript/issues/21592#issuecomment-503837592 - this is caused by a TypeScript bug, but the TypeScript devs have suggested that Redux may not actually need to be using the DeepPartial type here.
What is the expected behavior? No TypeScript errors
Which versions of Redux, and which browser and OS are affected by this issue? Did this work in previous versions of Redux?
In theory this affects any version of Redux using the DeepPartial
type. The symptoms and workaround have changed in recent versions of TypeScript; I’ve reproduced the issue with typescript@3.1.6
and typescript@3.5.1
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
I’m currently at the beach, so I can look at it next week.
Pushed out 4.0.2 now: https://github.com/reduxjs/redux/releases/tag/v4.0.2