Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

218
Views
Vue - Property '$router' does not exist on type 'App'

Given the code below, I have a squiggle line underneath $router which says Property '$router' does not exist on type 'App'

  async handleUserActions(item: TODO) {
    this.menuItem = item.title;
    if (item.title === 'Logout') {
      await userModule.logout();
    }
    this.$router.push(item.link);
  }

I read this answer but it doesn't seem to work. I already have a file called shims-vue.d.ts in the project that looks like this by default:

declare module "*.vue" { import Vue from "vue"; export default Vue; }

I am not sure how I should add the code suggested in the linked SO question above. I currently have it configured like this, which is taken from the most popular answer on the linked question:

import VueRouter, { Route } from 'vue-router'

declare module "*.vue" {
  import Vue from "vue";
  export default Vue;
  interface Vue {
    $router: VueRouter
  }
}

But in this case the line import Vue from "vue"; has a red squiggle line below "vue" which says Cannot find module 'vue' or its corresponding type declarations when hovered.

Not sure what is going on here. I know that an app can run with some of these warnings, but I am having some issues with the router and think this may be causing the problem.

Any help much appreciated.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!