]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
fix(types): Support `undefined` in NavigationGuardNext (#1059)
authorTomas Kudlac <41956970+Thomasan1999@users.noreply.github.com>
Tue, 3 Aug 2021 08:37:01 +0000 (10:37 +0200)
committerGitHub <noreply@github.com>
Tue, 3 Aug 2021 08:37:01 +0000 (10:37 +0200)
src/types/index.ts
test-dts/navigationGuards.test-d.ts

index 0ddd8866bde24ebd91da3c3c73632cfeeb5688ee..9bfad6bc15abab14ba642d27cb1c8a6d90400a8a 100644 (file)
@@ -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
index b2057fe829ce9f9d09e907c5d0a38c62d7afd891..71a244eb8cad594a55abfdd20c555fc68921c81d 100644 (file)
@@ -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')