Skip to content

Commit

Permalink
Infer action types from combineReducers (reduxjs#3411)
Browse files Browse the repository at this point in the history
* Infer action types from combineReducers

This change allows for `combineReducers` to completely infer both the state and action types for its returned reducer.

From experience with large TypeScript projects, it's common to see that the action type is not explicitly specified, which results in `AnyAction` in the resulting reducer type. Unfortunately, this will propagate through the type inference for `createStore` resulting in `dispatch` being very weakly typed. This change alone causes a chain reaction of a more correctly (and strongly) typed project with regards to Redux.

* Fix formatting issues.


Former-commit-id: 2954f00
Former-commit-id: ecf7bd6
  • Loading branch information
appden authored and timdorr committed Apr 23, 2019
1 parent 581e97f commit d5aa634
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
c1a16080bf4ff5e13b371c76f9a8244038ce4578
1cf5a7043373dca38569d39931f5924bb326452f
2 changes: 1 addition & 1 deletion test/typescript/reducers.ts.REMOVED.git-id
Original file line number Diff line number Diff line change
@@ -1 +1 @@
29376714f3f487d076240fa715ab144bee3576eb
eb03eaf6d72730e3c0d5aae15a545bea180c9814

0 comments on commit d5aa634

Please sign in to comment.