-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
declarations.js
72 lines (62 loc) · 1.54 KB
/
declarations.js
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
declare module 'path-to-regexp' {
declare var exports: {
(path: string, keys: Array<?{ name: string }>): RegExp;
compile: (path: string) => (params: Object) => string;
}
}
declare type RouterOptions = {
routes?: Array<RouteConfig>;
mode?: string;
base?: string;
linkActiveClass?: string;
scrollBehavior?: Function;
beforeEach?: Function | Array<?Function>;
afterEach?: Function | Array<?Function>;
}
declare type RedirectOption = string | { name: string }
declare type RouteConfig = {
path: string;
name?: string;
component?: any;
components?: { [name: string]: any };
redirect?: RedirectOption;
alias?: string | Array<string>;
children?: Array<RouteConfig>;
beforeEnter?: Function;
meta?: any;
}
declare type RouteRecord = {
path: string;
components: { [name: string]: any };
instances: { [name: string]: any };
name: ?string;
parent: ?RouteRecord;
redirect: ?RedirectOption;
matchAs: ?string;
beforeEnter: ?Function;
meta: any;
}
declare type RouteMap = {
[key: string]: RouteRecord;
}
declare type StringHash = { [key: string]: string }
declare type Location = {
_normalized?: boolean;
name?: string;
path?: string;
hash?: string;
query?: StringHash;
params?: StringHash;
}
declare type RawLocation = string | Location
declare type Route = {
path: string;
name: ?string;
hash: string;
query: StringHash;
params: StringHash;
fullPath: string;
matched: Array<RouteRecord>;
redirectedFrom?: string;
}
declare type Matcher = (location: RawLocation, current?: Route) => Route;