From 84b28f0a744592a5039c990730c59d87c577cbaa Mon Sep 17 00:00:00 2001 From: beary Date: Sun, 25 Nov 2018 14:53:24 +0800 Subject: [PATCH 1/2] Expose `Next` type --- types/index.d.ts | 3 ++- types/router.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 087275cd7..0b45db5ab 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -12,5 +12,6 @@ export { RouteRecord, Location, Route, - NavigationGuard + NavigationGuard, + Next } from "./router"; diff --git a/types/router.d.ts b/types/router.d.ts index 59222587d..186405916 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -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 = (to?: RawLocation | false | ((vm: V) => any) | void) => void; export type NavigationGuard = ( to: Route, from: Route, - next: (to?: RawLocation | false | ((vm: V) => any) | void) => void + next: Next ) => any export declare class VueRouter { From cecff81e7a9abe877c0e043960791db2b6068efd Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 11 May 2020 09:39:41 +0200 Subject: [PATCH 2/2] rename type --- types/index.d.ts | 2 +- types/router.d.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/index.d.ts b/types/index.d.ts index 0b45db5ab..134299821 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -13,5 +13,5 @@ export { Location, Route, NavigationGuard, - Next + NavigationGuardNext } from "./router"; diff --git a/types/router.d.ts b/types/router.d.ts index 186405916..69c5e8d3e 100644 --- a/types/router.d.ts +++ b/types/router.d.ts @@ -7,11 +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 = (to?: RawLocation | false | ((vm: V) => any) | void) => void; +export type NavigationGuardNext = (to?: RawLocation | false | ((vm: V) => any) | void) => void; export type NavigationGuard = ( to: Route, from: Route, - next: Next + next: NavigationGuardNext ) => any export declare class VueRouter {