Skip to content

Typescript error accessing this.$router.options #2051

Closed
@peterssonanton

Description

@peterssonanton

Version

3.0.1

Reproduction link

https://github.com/peterssonanton/vue-example

Steps to reproduce

npm run build

Gives this error:
ERROR Failed to compile with 2 errors 08:25:37

error in /Users/antonpetersson/my-project/src/views/Home.vue

(25,30): Property 'options' does not exist on type 'VueRouter'.

error in /Users/antonpetersson/my-project/src/views/Home.vue

(26,25): Property 'options' does not exist on type 'VueRouter'.

What is expected?

The options property exists on VueRouter, if running 'npm run serve' the app starts (with typescript errors still) and is working.

What is actually happening?

Typescript is giving a compilation error


The example repo is created with the vue-cli: https://github.com/vuejs/vue-cli with only a few lines added code in Home.vue to reproduce the error

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