Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): NavigationGuardNext #2497

Merged
merged 3 commits into from
May 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion 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
NavigationGuard,
Next
posva marked this conversation as resolved.
Show resolved Hide resolved
} from "./router";
3 changes: 2 additions & 1 deletion types/router.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ 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 Next<V extends Vue = Vue> = (to?: RawLocation | false | ((vm: V) => any) | void) => void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type Next<V extends Vue = Vue> = (to?: RawLocation | false | ((vm: V) => any) | void) => void;
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: Next<V>
posva marked this conversation as resolved.
Show resolved Hide resolved
) => any

export declare class VueRouter {
Expand Down