Skip to content

Commit 8dadf97

Browse files
sirlancelotposva
authored andcommitted
types: error handlers get an Error as first argument (#2377)
1 parent 9196bb0 commit 8dadf97

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

Diff for: types/router.d.ts

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Vue, { ComponentOptions, PluginFunction, AsyncComponent } from "vue";
22

33
type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent;
44
type Dictionary<T> = { [key: string]: T };
5+
type ErrorHandler = (err: Error) => void;
56

67
export type RouterMode = "hash" | "history" | "abstract";
78
export type RawLocation = string | Location;
@@ -22,14 +23,14 @@ export declare class VueRouter {
2223
beforeEach (guard: NavigationGuard): Function;
2324
beforeResolve (guard: NavigationGuard): Function;
2425
afterEach (hook: (to: Route, from: Route) => any): Function;
25-
push (location: RawLocation, onComplete?: Function, onAbort?: Function): void;
26-
replace (location: RawLocation, onComplete?: Function, onAbort?: Function): void;
26+
push (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
27+
replace (location: RawLocation, onComplete?: Function, onAbort?: ErrorHandler): void;
2728
go (n: number): void;
2829
back (): void;
2930
forward (): void;
3031
getMatchedComponents (to?: RawLocation | Route): Component[];
31-
onReady (cb: Function, errorCb?: Function): void;
32-
onError (cb: Function): void;
32+
onReady (cb: Function, errorCb?: ErrorHandler): void;
33+
onError (cb: ErrorHandler): void;
3334
addRoutes (routes: RouteConfig[]): void;
3435
resolve (to: RawLocation, current?: Route, append?: boolean): {
3536
location: Location;

0 commit comments

Comments
 (0)