[redux-first-router] Add querySerializer param to pathToAction (#26099)

This commit is contained in:
Jan Bevers
2018-05-29 15:54:55 -07:00
committed by Mohamed Hegazy
parent 33da0daffb
commit 4757d2b37c
2 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -249,7 +249,8 @@ export function nextPath(): string | void;
export function pathToAction<TKeys = {}, TState = any>(
pathname: string,
routesMap: RoutesMap<TKeys, TState>
routesMap: RoutesMap<TKeys, TState>,
querySerializer?: QuerySerializer
): ReceivedAction;
export function prevPath(): string | void;
@@ -6,7 +6,8 @@ import {
ReceivedAction,
redirect,
Action as ReduxFirstRouterAction,
QuerySerializer
QuerySerializer,
pathToAction
} from 'redux-first-router';
import {
createStore,
@@ -23,8 +24,8 @@ import {
} from 'redux';
import { History } from 'history';
declare var console: any;
declare var history: History;
declare const console: any;
declare const history: History;
interface Keys {
role: string;
@@ -97,12 +98,14 @@ const receivedAction: ReceivedAction = {
payload: {}
};
actionToPath(receivedAction, routesMap); // $ExpectType string
pathToAction('/', routesMap); // $ExpectType ReceivedAction
const querySerializer: QuerySerializer = {
stringify: (params) => '',
parse: (queryString) => ({})
};
actionToPath(receivedAction, routesMap, querySerializer); // $ExpectType string
pathToAction('/', routesMap, querySerializer); // $ExpectType ReceivedAction
const action: ReduxFirstRouterAction = {
type: 'HOME'