Skip to content

Commit

Permalink
fix(types): Support undefined in NavigationGuardNext (#1059)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomasan1999 committed Aug 3, 2021
1 parent d8fb7d0 commit 6cce232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/index.ts
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test-dts/navigationGuards.test-d.ts
Expand Up @@ -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')
Expand Down

0 comments on commit 6cce232

Please sign in to comment.