From: Tomas Kudlac <41956970+Thomasan1999@users.noreply.github.com> Date: Tue, 3 Aug 2021 08:37:01 +0000 (+0200) Subject: fix(types): Support `undefined` in NavigationGuardNext (#1059) X-Git-Tag: v4.0.11~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6cce232ba0dc5d89f6a53c1af674a8e0c6eb8790;p=thirdparty%2Fvuejs%2Frouter.git fix(types): Support `undefined` in NavigationGuardNext (#1059) --- diff --git a/src/types/index.ts b/src/types/index.ts index 0ddd8866..9bfad6bc 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -370,7 +370,7 @@ export interface NavigationGuardNext { (): void (error: Error): void (location: RouteLocationRaw): void - (valid: boolean): void + (valid: boolean | undefined): void (cb: NavigationGuardNextCallback): void /** * Allows to detect if `next` isn't called in a resolved guard. Used diff --git a/test-dts/navigationGuards.test-d.ts b/test-dts/navigationGuards.test-d.ts index b2057fe8..71a244eb 100644 --- a/test-dts/navigationGuards.test-d.ts +++ b/test-dts/navigationGuards.test-d.ts @@ -26,6 +26,10 @@ router.beforeEach((to, from) => { return false }) +router.beforeEach((to, from, next) => { + next(undefined) +}) + // @ts-expect-error router.beforeEach((to, from, next) => { return Symbol('not supported')