1 | import { History, Location, LocationDescriptor, LocationState, Path } from "history";
|
2 | import * as React from "react";
|
3 | import { match } from "react-router";
|
4 | import { Dispatch, Middleware, Reducer, Store } from "redux";
|
5 |
|
6 | export interface ConnectedRouterProps<State> {
|
7 | children?: React.ReactNode;
|
8 | store?: Store<State> | undefined;
|
9 | history: History;
|
10 | }
|
11 | export class ConnectedRouter<State> extends React.Component<ConnectedRouterProps<State>> {}
|
12 |
|
13 | export const LOCATION_CHANGE = "@@router/LOCATION_CHANGE";
|
14 |
|
15 | export interface RouterState {
|
16 | location: Location | null;
|
17 | }
|
18 |
|
19 | export const routerReducer: Reducer<RouterState>;
|
20 |
|
21 | export const CALL_HISTORY_METHOD = "@@router/CALL_HISTORY_METHOD";
|
22 |
|
23 | export function push(location: LocationDescriptor, state?: LocationState): RouterAction;
|
24 | export function replace(location: LocationDescriptor, state?: LocationState): RouterAction;
|
25 | export function go(n: number): RouterAction;
|
26 | export function goBack(): RouterAction;
|
27 | export function goForward(): RouterAction;
|
28 |
|
29 | export const routerActions: {
|
30 | push: typeof push;
|
31 | replace: typeof replace;
|
32 | go: typeof go;
|
33 | goBack: typeof goBack;
|
34 | goForward: typeof goForward;
|
35 | };
|
36 |
|
37 | export interface LocationActionPayload {
|
38 | method: string;
|
39 | args?: any[] | undefined;
|
40 | }
|
41 |
|
42 | export interface RouterAction {
|
43 | type: typeof CALL_HISTORY_METHOD;
|
44 | payload: LocationActionPayload;
|
45 | }
|
46 |
|
47 | export interface LocationChangeAction {
|
48 | type: typeof LOCATION_CHANGE;
|
49 | payload: Location & {
|
50 | props?: {
|
51 | match: {
|
52 | path: string;
|
53 | url: string;
|
54 | params: any;
|
55 | isExact: boolean;
|
56 | };
|
57 | location: Location;
|
58 | history: History;
|
59 | } | undefined;
|
60 | };
|
61 | }
|
62 |
|
63 | export function routerMiddleware(history: History): Middleware;
|
64 |
|
65 | export function createMatchSelector(path: string): (state: { router: RouterState }) => match | null;
|