Skip to content

Commit

Permalink
feat(types): add types for getRoutes addRoute
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Jan 4, 2021
1 parent 6bc30aa commit fb9bb60
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export {
RouterOptions,
RouteConfig,
RouteRecord,
RouteRecordPublic,
Location,
Route,
NavigationGuard,
Expand Down
25 changes: 25 additions & 0 deletions types/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export declare class VueRouter {
onReady(cb: Function, errorCb?: ErrorHandler): void
onError(cb: ErrorHandler): void
addRoutes(routes: RouteConfig[]): void

addRoute(parent: string, route: RouteConfig): void
addRoute(route: RouteConfig): void
getRoutes(): RouteRecordPublic[]

resolve(
to: RawLocation,
current?: Route,
Expand Down Expand Up @@ -158,6 +163,26 @@ export interface RouteRecord {
| Dictionary<boolean | Object | RoutePropsFunction>
}

export interface RouteRecordPublic {
path: string
components: Dictionary<Component>
instances: Dictionary<Vue>
name?: string
redirect?: RedirectOption
meta: any
beforeEnter?: (
route: Route,
redirect: (location: RawLocation) => void,
next: () => void
) => any
props:
| boolean
| Object
| RoutePropsFunction
| Dictionary<boolean | Object | RoutePropsFunction>
}


export interface Location {
name?: string
path?: string
Expand Down

0 comments on commit fb9bb60

Please sign in to comment.