mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
[redux-first-router] Add querySerializer param to pathToAction (#26099)
This commit is contained in:
committed by
Mohamed Hegazy
parent
33da0daffb
commit
4757d2b37c
Vendored
+2
-1
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user