-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
TypescriptID/platform
#150Labels
Description
Minimal reproduction of the bug/regression with instructions:
The definition of routerReducer is written to accept a subtype of Action.
https://github.com/ngrx/platform/blob/master/modules/router-store/src/reducer.ts#L23
That is not correct as every action runs through every reducer (if I understand ngrx correctly that is still the case). TypeScript with --strictFunctionTypes errors when you write you your reducers with any type different from reducer(state = defaultState, action: Action)
.
Expected behavior:
Router reducer should be written as:
routerReducer(state = defaultState, action: Action) {
const routerAction = action as RouterAction;
}
The unsafe (but benign) type cast should live inside the reducer function.
Other information:
General issue about --strictFunctionTypes - #951.
I would be willing to submit a PR to fix this issue
[x] Yes (Assistance is provided if you need help submitting a pull request)
[ ] No
nasreddineskandrani and kt215