forked from supasate/connected-react-router
/
index.d.ts
68 lines (55 loc) · 1.81 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
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): RouterAction;
export function push(location: LocationDescriptorObject): RouterAction;
export function replace(path: Path, state?: LocationState): RouterAction;
export function replace(location: LocationDescriptorObject): RouterAction;
export function go(n: number): RouterAction;
export function goBack(): RouterAction;
export function goForward(): RouterAction;
export const routerActions: {
push: typeof push;
replace: typeof replace;
go: typeof go;
goBack: typeof goBack;
goForward: typeof 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;
}