Skip to content

Commit 0e38673

Browse files
timdeschryverbrandonroberts
authored andcommitted
fix(router-store): allow compilation with strictFunctionTypes (#1385)
Closes #1344
1 parent 626784e commit 0e38673

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

modules/router-store/src/reducer.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Action } from '@ngrx/store';
12
import {
23
ROUTER_CANCEL,
34
ROUTER_ERROR,
@@ -20,15 +21,17 @@ export function routerReducer<
2021
T extends BaseRouterStoreState = SerializedRouterStateSnapshot
2122
>(
2223
state: RouterReducerState<T> | undefined,
23-
action: RouterAction<any, T>
24+
action: Action
2425
): RouterReducerState<T> {
25-
switch (action.type) {
26+
// Allow compilation with strictFunctionTypes - ref: #1344
27+
const routerAction = action as RouterAction<any, T>;
28+
switch (routerAction.type) {
2629
case ROUTER_NAVIGATION:
2730
case ROUTER_ERROR:
2831
case ROUTER_CANCEL:
2932
return {
30-
state: action.payload.routerState,
31-
navigationId: action.payload.event.id,
33+
state: routerAction.payload.routerState,
34+
navigationId: routerAction.payload.event.id,
3235
};
3336
default:
3437
return state as RouterReducerState<T>;

0 commit comments

Comments
 (0)