From 6cce232ba0dc5d89f6a53c1af674a8e0c6eb8790 Mon Sep 17 00:00:00 2001 From: Tomas Kudlac <41956970+Thomasan1999@users.noreply.github.com> Date: Tue, 3 Aug 2021 10:37:01 +0200 Subject: [PATCH] fix(types): Support `undefined` in NavigationGuardNext (#1059) --- src/types/index.ts | 2 +- test-dts/navigationGuards.test-d.ts | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/types/index.ts b/src/types/index.ts index 0ddd8866b..9bfad6bc1 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 b2057fe82..71a244eb8 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')