Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next(undefined) in navigation guard throws a TS error #1058

Closed
Thomasan1999 opened this issue Aug 2, 2021 · 0 comments · Fixed by #1059
Closed

next(undefined) in navigation guard throws a TS error #1058

Thomasan1999 opened this issue Aug 2, 2021 · 0 comments · Fixed by #1059
Labels
contribution welcome The team would welcome a contribution from the community for this issue good first issue Good for newcomers typescript Problem related to TS typings

Comments

@Thomasan1999
Copy link
Contributor

Version

4.0.10

Reproduction link

https://codesandbox.io/s/vue-router-nextundefined-example-xz4yo

Steps to reproduce

  1. Use a navigation guard.
  2. Write next(undefined)

What is expected?

next(undefined) works the same way as next() since empty argument is treated as undefined in JS.

What is actually happening?

next(undefined) throws
Argument of type 'undefined' is not assignable to parameter of type 'NavigationGuardNextCallback'


It seems that the NavigationGuardNext interface must be changed to either have an undefined argument as a separate row or to make one of the options optional.

@posva posva added contribution welcome The team would welcome a contribution from the community for this issue good first issue Good for newcomers typescript Problem related to TS typings labels Aug 2, 2021
@posva posva closed this as completed Aug 5, 2021
@posva posva linked a pull request Aug 5, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution welcome The team would welcome a contribution from the community for this issue good first issue Good for newcomers typescript Problem related to TS typings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants