Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda