Skip to content

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

@Thomasan1999

Description

@Thomasan1999

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contribution welcomeThe team would welcome a contribution from the community for this issuegood first issueGood for newcomerstypescriptProblem related to TS typings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions