@@ -5,53 +5,61 @@ declare module 'path-to-regexp' {
55 }
66}
77
8+ declare type Dictionary < T > = { [ key : string ] : T }
9+
810declare type RouterOptions = {
911 routes ?: Array < RouteConfig > ;
1012 mode ?: string ;
1113 base ? : string ;
1214 linkActiveClass ? : string ;
13- scrollBehavior ? : Function ;
15+ scrollBehavior ?: (
16+ to : Route ,
17+ from : Route ,
18+ savedPosition : ?{ x : number , y : number }
19+ ) => { x : number , y : number } | { selector : string } | ?{ } ;
1420}
1521
16- declare type RedirectOption = RawLocation | Function
22+ declare type RedirectOption = RawLocation | ( ( to : Route ) => RawLocation )
1723
1824declare type RouteConfig = {
1925 path : string ;
2026 name ? : string ;
2127 component ? : any ;
22- components ?: { [ name : string ] : any } ;
28+ components ?: Dictionary < any > ;
2329 redirect ?: RedirectOption ;
2430 alias ?: string | Array < string > ;
2531 children ?: Array < RouteConfig > ;
26- beforeEnter ? : Function ;
32+ beforeEnter ?: (
33+ route : Route ,
34+ redirect : ( location : RawLocation ) = > void ,
35+ next : ( ) = > void
36+ ) => any ;
2737 meta ? : any ;
2838}
2939
3040declare type RouteRecord = {
3141 path : string ;
32- components: { [ name : string ] : any } ;
33- instances: { [ name : string ] : any } ;
42+ components: Dictionary < any > ;
43+ instances: Dictionary < any > ;
3444 name: ?string ;
3545 parent: ?RouteRecord ;
3646 redirect: ?RedirectOption ;
3747 matchAs: ?string ;
38- beforeEnter: ?Function ;
48+ beforeEnter: ?(
49+ route : Route ,
50+ redirect : ( location : RawLocation ) => void ,
51+ next : ( ) = > void
52+ ) => any ;
3953 meta: any ;
4054}
4155
42- declare type RouteMap = {
43- [ key : string ] : RouteRecord ;
44- }
45-
46- declare type StringHash = { [ key : string ] : string }
47-
4856declare type Location = {
4957 _normalized ?: boolean ;
5058 name ? : string ;
5159 path ? : string ;
5260 hash ? : string ;
53- query ? : StringHash ;
54- params ? : StringHash ;
61+ query ?: Dictionary < string > ;
62+ params ?: Dictionary < string > ;
5563}
5664
5765declare type RawLocation = string | Location
@@ -60,8 +68,8 @@ declare type Route = {
6068 path : string ;
6169 name: ?string ;
6270 hash: string ;
63- query: StringHash ;
64- params: StringHash ;
71+ query: Dictionary < string > ;
72+ params: Dictionary < string > ;
6573 fullPath: string ;
6674 matched: Array < RouteRecord > ;
6775 redirectedFrom ? : string ;
0 commit comments