Skip to content

export 'Route' was not found in 'vue-router' #1498

Closed
@doppelreim

Description

@doppelreim

Version

3.0.0-beta.15

Reproduction link

https://github.com/doppelreim/vue-test-app/tree/test-import-route

Steps to reproduce

Run npm run serve

What is expected?

The app should compile without warnings.

What is actually happening?

It does not compile without warnings.

The output says:

 WARNING  Compiled with 4 warnings                                                                                                            12:38:25

 warning  in ./src/components/HelloWorld.vue?vue&type=script&lang=ts

"export 'Route' was not found in 'vue-router'

 warning  in ./src/components/HelloWorld.vue?vue&type=script&lang=ts

"export 'Route' was not found in 'vue-router'

 warning  in ./src/components/HelloWorld.vue?vue&type=script&lang=ts

"export 'Route' was not found in 'vue-router'

 warning  in ./src/components/HelloWorld.vue?vue&type=script&lang=ts

"export 'Route' was not found in 'vue-router'

The change that introduces the warnigns can be seen here:
doppelreim/vue-test-app@af03672

I want to add a Watcher on $route. The parameters of the function (newRoute and oldRoute) should be typed. I assume Route is the correct type.

I checked out /node_modules/vue-router/types/index.d.ts and there Route does get exported, as far as I can tell.

If I use Route inside of the function-body, like this:

const r: Route = {
      path: '',
      hash: '',
      query: {},
      params: {},
      fullPath: '',
      matched: [],
    };

then it does not throw errors.
And if i leave out some of the required attributes, then the compiler rightfully complains. So I assume the export/import does work here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions