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

Type definition does not contain enumeration for NavigationFailureType #3293

Closed
amjmhs opened this issue Aug 12, 2020 · 3 comments
Closed

Type definition does not contain enumeration for NavigationFailureType #3293

amjmhs opened this issue Aug 12, 2020 · 3 comments
Labels
Typescript Typescript related issues

Comments

@amjmhs
Copy link

amjmhs commented Aug 12, 2020

Version

3.4.2

Reproduction link

https://jsfiddle.net/dmop5w9b/

Steps to reproduce

I want to check for navigation-errors of a certain type. So there is the new VueRouter.isNavigationFailure function which takes a type as second parameter. But because of the missing type definition for this type, I can not call this function without typescript-errors.

if (VueRouter.isNavigationFailure(err, VueRouter.NavigationFailureType.duplicated)) {
 ...
}

Typescript error is: Property 'duplicated' does not exist on type 'NavigationFailureTypeE'.ts(2339)

I provided a fiddle with the code, but did not get the errors there... Those errors just appear in VSCode.

What is expected?

No typescript errors

What is actually happening?

Typescript errors

@posva posva added the Typescript Typescript related issues label Aug 13, 2020
@posva
Copy link
Member

posva commented Aug 13, 2020

Thanks!

@posva posva closed this as completed in fda7067 Aug 13, 2020
@loeffel-io
Copy link

loeffel-io commented Dec 2, 2020

Still not possible to use NavigationFailureType or isNavigationFailure

https://router.vuejs.org/guide/advanced/navigation-failures.html#detecting-navigation-failures is not working (typescript)

@amjmhs
Copy link
Author

amjmhs commented Dec 2, 2020

import VueRouter from 'vue-router';

if (VueRouter.isNavigationFailure(err)) {
          switch (err.type) {
            case VueRouter.NavigationFailureType.duplicated: {
....

this was working for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Typescript Typescript related issues
Projects
None yet
Development

No branches or pull requests

3 participants