/
index.d.ts
74 lines (60 loc) · 2.03 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
declare module 'connected-react-router' {
import * as React from 'react';
import { Middleware, Reducer } from 'redux';
import {
History,
Path,
Location,
LocationState,
LocationDescriptorObject
} from 'history';
interface ConnectedRouterProps {
history: History;
}
export type RouterActionType = 'POP' | 'PUSH' | 'REPLACE';
export interface RouterState {
location: Location
action: RouterActionType
}
export const LOCATION_CHANGE: '@@router/LOCATION_CHANGE';
export const CALL_HISTORY_METHOD: '@@router/CALL_HISTORY_METHOD';
export interface LocationChangeAction {
type: typeof LOCATION_CHANGE;
payload: RouterState;
}
export interface CallHistoryMethodAction {
type: typeof CALL_HISTORY_METHOD;
payload: LocationActionPayload;
}
export type RouterAction = LocationChangeAction | CallHistoryMethodAction;
export function push(path: Path, state?: LocationState): CallHistoryMethodAction;
export function push(location: LocationDescriptorObject): CallHistoryMethodAction;
export function replace(path: Path, state?: LocationState): CallHistoryMethodAction;
export function replace(location: LocationDescriptorObject): CallHistoryMethodAction;
export function go(n: number): CallHistoryMethodAction;
export function goBack(): CallHistoryMethodAction;
export function goForward(): CallHistoryMethodAction;
export type Push = typeof push;
export type Replace = typeof replace;
export type Go = typeof go;
export type GoBack = typeof goBack;
export type GoForward = typeof goForward;
export const routerActions: {
push: Push;
replace: Replace;
go: Go;
goBack: GoBack;
goForward: GoForward;
};
export interface LocationActionPayload {
method: string;
args?: any[];
}
export class ConnectedRouter extends React.Component<
ConnectedRouterProps,
{}
> {}
export function connectRouter(history: History)
: Reducer<RouterState, LocationChangeAction>
export function routerMiddleware(history: History): Middleware;
}