Skip to content

Commit d18c497

Browse files
authored
feat(types): NavigationGuardNext (#2497)
1 parent fc01ee9 commit d18c497

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

types/index.d.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ export {
1212
RouteRecord,
1313
Location,
1414
Route,
15-
NavigationGuard
16-
} from './router'
15+
NavigationGuard,
16+
NavigationGuardNext
17+
} from "./router";

types/router.d.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent
44
type Dictionary<T> = { [key: string]: T }
55
type ErrorHandler = (err: Error) => void
66

7-
export type RouterMode = 'hash' | 'history' | 'abstract'
8-
export type RawLocation = string | Location
9-
export type RedirectOption = RawLocation | ((to: Route) => RawLocation)
7+
export type RouterMode = "hash" | "history" | "abstract";
8+
export type RawLocation = string | Location;
9+
export type RedirectOption = RawLocation | ((to: Route) => RawLocation);
10+
export type NavigationGuardNext<V extends Vue = Vue> = (to?: RawLocation | false | ((vm: V) => any) | void) => void;
11+
1012
export type NavigationGuard<V extends Vue = Vue> = (
1113
to: Route,
1214
from: Route,
13-
next: (to?: RawLocation | false | ((vm: V) => any) | void) => void
15+
next: NavigationGuardNext<V>
1416
) => any
1517

1618
export declare class VueRouter {

0 commit comments

Comments
 (0)