diff --git a/types/index.d.ts b/types/index.d.ts index 504f2b56a..41bcea125 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -10,6 +10,7 @@ export { RouterOptions, RouteConfig, RouteRecord, + RouteRecordPublic, Location, Route, NavigationGuard, diff --git a/types/router.d.ts b/types/router.d.ts index ec48c7dca..03949ed4a 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -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, @@ -158,6 +163,26 @@ export interface RouteRecord { | Dictionary } +export interface RouteRecordPublic { + path: string + components: Dictionary + instances: Dictionary + name?: string + redirect?: RedirectOption + meta: any + beforeEnter?: ( + route: Route, + redirect: (location: RawLocation) => void, + next: () => void + ) => any + props: + | boolean + | Object + | RoutePropsFunction + | Dictionary +} + + export interface Location { name?: string path?: string