Skip to content

Commit fb9bb60

Browse files
committed
feat(types): add types for getRoutes addRoute
1 parent 6bc30aa commit fb9bb60

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

types/index.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export {
1010
RouterOptions,
1111
RouteConfig,
1212
RouteRecord,
13+
RouteRecordPublic,
1314
Location,
1415
Route,
1516
NavigationGuard,

types/router.d.ts

+25
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ export declare class VueRouter {
4747
onReady(cb: Function, errorCb?: ErrorHandler): void
4848
onError(cb: ErrorHandler): void
4949
addRoutes(routes: RouteConfig[]): void
50+
51+
addRoute(parent: string, route: RouteConfig): void
52+
addRoute(route: RouteConfig): void
53+
getRoutes(): RouteRecordPublic[]
54+
5055
resolve(
5156
to: RawLocation,
5257
current?: Route,
@@ -158,6 +163,26 @@ export interface RouteRecord {
158163
| Dictionary<boolean | Object | RoutePropsFunction>
159164
}
160165

166+
export interface RouteRecordPublic {
167+
path: string
168+
components: Dictionary<Component>
169+
instances: Dictionary<Vue>
170+
name?: string
171+
redirect?: RedirectOption
172+
meta: any
173+
beforeEnter?: (
174+
route: Route,
175+
redirect: (location: RawLocation) => void,
176+
next: () => void
177+
) => any
178+
props:
179+
| boolean
180+
| Object
181+
| RoutePropsFunction
182+
| Dictionary<boolean | Object | RoutePropsFunction>
183+
}
184+
185+
161186
export interface Location {
162187
name?: string
163188
path?: string

0 commit comments

Comments
 (0)