diff --git a/types/router.d.ts b/types/router.d.ts index 844b91150..59222587d 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -2,6 +2,7 @@ import Vue, { ComponentOptions, PluginFunction, AsyncComponent } from "vue"; type Component = ComponentOptions | typeof Vue | AsyncComponent; type Dictionary = { [key: string]: T }; +type ErrorHandler = (err: Error) => void; export type RouterMode = "hash" | "history" | "abstract"; export type RawLocation = string | Location; @@ -22,14 +23,14 @@ export declare class VueRouter { beforeEach (guard: NavigationGuard): Function; beforeResolve (guard: NavigationGuard): Function; afterEach (hook: (to: Route, from: Route) => any): Function; - push (location: RawLocation, onComplete?: Function, onAbort?: Function): void; - replace (location: RawLocation, onComplete?: Function, onAbort?: Function): void; + push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void; + replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void; go (n: number): void; back (): void; forward (): void; getMatchedComponents (to?: RawLocation | Route): Component[]; - onReady (cb: Function, errorCb?: Function): void; - onError (cb: Function): void; + onReady (cb: Function, errorCb?: ErrorHandler): void; + onError (cb: ErrorHandler): void; addRoutes (routes: RouteConfig[]): void; resolve (to: RawLocation, current?: Route, append?: boolean): { location: Location;