-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Open
Labels
TypescriptTypescript related issuesTypescript related issuesfixed on 4.xThis issue has been already fixed on the v4 but exists in v3This issue has been already fixed on the v4 but exists in v3has PR
Description
What problem does this feature solve?
At the moment there is a type definition for NavigationGuard
in router.d.ts
. This works nicely. Within that, the next
argument is a function that accepts a union of different types as argument.
next: (to?: RawLocation | false | ((vm: V) => any) | void) => void
I think it'd be neat to easily use this just like the Route
interface declaration in, for example, a components navigation guard.
What does the proposed API look like?
Export a type definition maybe called NavigationGuardCallback
in router.d.ts
.
export type NavigationGuardCallback = (to?: RawLocation | false | ((vm: V) => any) | void) => void;
export type NavigationGuard<V extends Vue = Vue> = (
to: Route,
from: Route,
next: NavigationGuardCallback
) => any;
voool and stevendesu
Metadata
Metadata
Assignees
Labels
TypescriptTypescript related issuesTypescript related issuesfixed on 4.xThis issue has been already fixed on the v4 but exists in v3This issue has been already fixed on the v4 but exists in v3has PR