Skip to content

Commit

Permalink
feat(types): NavigationGuardNext (#2497)
Browse files Browse the repository at this point in the history
  • Loading branch information
beary committed May 11, 2020
1 parent fc01ee9 commit d18c497
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 3 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export {
RouteRecord,
Location,
Route,
NavigationGuard
} from './router'
NavigationGuard,
NavigationGuardNext
} from "./router";
10 changes: 6 additions & 4 deletions types/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ type Component = ComponentOptions<Vue> | typeof Vue | AsyncComponent
type Dictionary<T> = { [key: string]: T }
type ErrorHandler = (err: Error) => void

export type RouterMode = 'hash' | 'history' | 'abstract'
export type RawLocation = string | Location
export type RedirectOption = RawLocation | ((to: Route) => RawLocation)
export type RouterMode = "hash" | "history" | "abstract";
export type RawLocation = string | Location;
export type RedirectOption = RawLocation | ((to: Route) => RawLocation);
export type NavigationGuardNext<V extends Vue = Vue> = (to?: RawLocation | false | ((vm: V) => any) | void) => void;

export type NavigationGuard<V extends Vue = Vue> = (
to: Route,
from: Route,
next: (to?: RawLocation | false | ((vm: V) => any) | void) => void
next: NavigationGuardNext<V>
) => any

export declare class VueRouter {
Expand Down

0 comments on commit d18c497

Please sign in to comment.