typesafe-actions
typesafe-actions copied to clipboard
Redux 4.0.5 Causing New "Type instantiation is excessively deep and possibly infinite." Error on combineReducers
Description
I'm not sure if this is an issue with typesafe-actions
or redux
in the end, but after only upgrading from redux 4.0.4 to 4.0.5, we are now getting this error:
error TS2589: Type instantiation is excessively deep and possibly infinite.
80 export const combinedReducers = combineReducers(reducersMapObject);
No issues when going back to 4.0.4 (we'll stay on this version for now).
Mandatory info
- [Yes] Are you extending internal types to enable type-free syntax with
createReducer
?
import * as TypesafeActions from 'typesafe-actions';
declare module 'typesafe-actions' {
interface Types {
RootAction: TypesafeActions.ActionType<
typeof import('library/state/actions').default
>;
}
}
Possibly this ^^^ just too much now to work in our project on the new redux
types?
- [Yes] Did you checked compatibility notes and migration guides?
How to Reproduce
We have 63 createReducer
calls with 34 total reducer objects being combined with combineReducers
and 209 total createAction
calls.
No CodeSandbox Link
Not really sure how to provide a reproducible issue when it's likely the size of the project that's the cause and I can't share the code.
Expected behavior
It shouldn't give an error.
Suggested solution(s)
Possibly need to change how the types in the redux
library are used?
Project Dependencies
- Typesafe-Actions Version: 5.1.0
- TypeScript Version: 3.7.5 (also gives the error on 3.7.3 and possibly earlier)
- tsconfig.json:
{
"compilerOptions": {
"allowJs": false,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "react",
"lib": ["es2017"],
"skipLibCheck": true,
"moduleResolution": "node",
"isolatedModules": true,
"noImplicitAny": false, // turn to true when all js files are gone
"noEmit": true,
"incremental": false, // this must remain false when noEmit is true
"strict": true,
"target": "esnext",
"baseUrl": "./src",
"paths": {
"library": ["library"],
"ui": ["ui"],
"test-utils": ["test-utils"],
"react-native-extended-stylesheet": [
"@types/react-native-extended-stylesheet"
],
"react-native-testing-library": [
"@types/react-native-testing-library"
],
"redux-thunk": [
"@types/redux-thunk"
],
"react-native-animatable": [
"@types/react-native-animatable"
],
"react-native-interactable": [
"@types/react-native-interactable"
]
}
}
}
Environment (optional)
- Browser and Version: React Native 0.59.5
- OS: iOS and Android
- Node Version: 10.16.3
- Package Manager and Version: yarn 1.21.1
Here's the diff for redux 4.0.4 vs 4.0.5:
https://github.com/reduxjs/redux/compare/v4.0.4...v4.0.5
Me too I started getting this error