A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/vuejs/vetur/issues/159 below:

TypeScript global declarations handled inconsistently with actual build · Issue #159 · vuejs/vetur · GitHub

I am using Vetur with a Nuxt.js Vue project that is using TypeScript. The project uses Webpack and ts-loader.

One of my .vue files is making reference to this.$router. Vetur is showing an error on that line that reads Property $router does not exist on the type default. When I run the build there is no error. So there is a difference in what I am seeing in the editor vs. the errors my build shows.

I would not expect this to be an error because in my .tsconfig.json I list vue-router explicitly in types. If I remove vue-router from types, I get this exact error. So Vetur seems to not be making use of types when generating its code sense.

Although vue-router is the most significant example I have noticed this issue for all global declarations that I've tested. Just for a test, I tried a similar thing with Jasmine globals and found similar issues.

Based on other observations and searching this projects source code, I can see that this extension is attempting to make use of my tsconfig. I can't figure out why there would be a problem with this specific setting though.

I can work around it with:

// eslint-disable-next-line no-unused-vars
import Router from 'vue-router';

This has no affect on the output of the project, but I am making a code change because my editor is inconsistent with my build, which is not ideal.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4