Skip to content

Commit

Permalink
fix(router-store): allow compilation with strictFunctionTypes (#1385)
Browse files Browse the repository at this point in the history
Closes #1344
  • Loading branch information
timdeschryver authored and brandonroberts committed Oct 29, 2018
1 parent 626784e commit 0e38673
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions modules/router-store/src/reducer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Action } from '@ngrx/store';
import {
ROUTER_CANCEL,
ROUTER_ERROR,
Expand All @@ -20,15 +21,17 @@ export function routerReducer<
T extends BaseRouterStoreState = SerializedRouterStateSnapshot
>(
state: RouterReducerState<T> | undefined,
action: RouterAction<any, T>
action: Action
): RouterReducerState<T> {
switch (action.type) {
// Allow compilation with strictFunctionTypes - ref: #1344
const routerAction = action as RouterAction<any, T>;
switch (routerAction.type) {
case ROUTER_NAVIGATION:
case ROUTER_ERROR:
case ROUTER_CANCEL:
return {
state: action.payload.routerState,
navigationId: action.payload.event.id,
state: routerAction.payload.routerState,
navigationId: routerAction.payload.event.id,
};
default:
return state as RouterReducerState<T>;
Expand Down

0 comments on commit 0e38673

Please sign in to comment.