-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
42 lines (35 loc) · 1.07 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
export type Url = string;
export type ObjectType = {
[key: string]: any,
}
export interface Params {
to: Url;
meta?: ObjectType | null;
emit?: boolean;
steps?: number;
}
export type Query = ObjectType;
export interface Route {
id: string;
hash: string;
location: string;
meta?: ObjectType | null;
pathname: string;
query: Query;
}
interface RouterHistory {
back(params: Params): Promise<{ action: 'POP', prev: Route, next: Route }>,
current(): Route,
listen(): Function<{ action: string, prev: Route, next:Route }>,
go(params: Params): Promise<{ prev: Route, next: Route }>,
pop(params: Params): Promise<{ action: 'POP', prev: Route, next: Route }>,
push(params: Params): Promise<{ prev: Route, next: Route }>,
replace(params: Params): Promise<{ action: 'REPLACE', prev: Route, next: Route }>,
reset(params: Params): Promise<Route>,
setQuery(input: Query): Promise<{ prev: Route, next: Route }>
}
export const history: RouterHistory;
export const PUSH: 'PUSH';
export const POP: 'POP';
export const REPLACE: 'REPLACE';
export const RESET: 'RESET';