@@ -28,7 +28,7 @@ export type RouterNavigationPayload<T> = {
2828/**
2929 * An action dispatched when the router navigates.
3030 */
31- export type RouterNavigationAction < T > = {
31+ export type RouterNavigationAction < T = RouterStateSnapshot > = {
3232 type : typeof ROUTER_NAVIGATION ;
3333 payload : RouterNavigationPayload < T > ;
3434} ;
@@ -41,18 +41,18 @@ export const ROUTER_CANCEL = 'ROUTER_CANCEL';
4141/**
4242 * Payload of ROUTER_CANCEL.
4343 */
44- export type RouterCancelPayload < T > = {
45- routerState : RouterStateSnapshot ;
44+ export type RouterCancelPayload < T , V > = {
45+ routerState : V ;
4646 storeState : T ;
4747 event : NavigationCancel ;
4848} ;
4949
5050/**
5151 * An action dispatched when the router cancel navigation.
5252 */
53- export type RouterCancelAction < T > = {
53+ export type RouterCancelAction < T , V = RouterStateSnapshot > = {
5454 type : typeof ROUTER_CANCEL ;
55- payload : RouterCancelPayload < T > ;
55+ payload : RouterCancelPayload < T , V > ;
5656} ;
5757
5858/**
@@ -63,37 +63,37 @@ export const ROUTER_ERROR = 'ROUTE_ERROR';
6363/**
6464 * Payload of ROUTER_ERROR.
6565 */
66- export type RouterErrorPayload < T > = {
67- routerState : RouterStateSnapshot ;
66+ export type RouterErrorPayload < T , V > = {
67+ routerState : V ;
6868 storeState : T ;
6969 event : NavigationError ;
7070} ;
7171
7272/**
7373 * An action dispatched when the router errors.
7474 */
75- export type RouterErrorAction < T > = {
75+ export type RouterErrorAction < T , V = RouterStateSnapshot > = {
7676 type : typeof ROUTER_ERROR ;
77- payload : RouterErrorPayload < T > ;
77+ payload : RouterErrorPayload < T , V > ;
7878} ;
7979
8080/**
8181 * An union type of router actions.
8282 */
83- export type RouterAction < T > =
83+ export type RouterAction < T , V = RouterStateSnapshot > =
8484 | RouterNavigationAction < T >
85- | RouterCancelAction < T >
86- | RouterErrorAction < T > ;
85+ | RouterCancelAction < T , V >
86+ | RouterErrorAction < T , V > ;
8787
88- export type RouterReducerState = {
89- state : RouterStateSnapshot ;
88+ export type RouterReducerState < T = RouterStateSnapshot > = {
89+ state : T ;
9090 navigationId : number ;
9191} ;
9292
93- export function routerReducer (
94- state : RouterReducerState ,
93+ export function routerReducer < T = RouterStateSnapshot > (
94+ state : RouterReducerState < T > ,
9595 action : RouterAction < any >
96- ) : RouterReducerState {
96+ ) : RouterReducerState < T > {
9797 switch ( action . type ) {
9898 case ROUTER_NAVIGATION :
9999 case ROUTER_ERROR :
0 commit comments