Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vetur doesn't detect augmentation of Vue when using typescript #1817

Closed
3 tasks done
InjustFr opened this issue Mar 31, 2020 · 6 comments
Closed
3 tasks done

Vetur doesn't detect augmentation of Vue when using typescript #1817

InjustFr opened this issue Mar 31, 2020 · 6 comments
Labels

Comments

@InjustFr
Copy link

InjustFr commented Mar 31, 2020

  • I have searched through existing issues
  • I have read through docs
  • I have read FAQ

Info

  • Platform: Mac OS X Catalina
  • Vetur version: 0.24.0
  • VS Code version: 1.43.2

Problem

I've had this problem but I'm guessing this happens with other plugins.
I've installed a plugin called vue-bus (https://github.com/yangmingshan/vue-bus). It adds the property $bus to Vue. But whenever I use it Vetur says the property doesn't exist but it compiles fine and works as expected

This plugin comes with shims files but I can't get Vetur to detect them. I've tried creating my own as specified in the Vue documentation but it didn't work either

Maybe I missed a step somewhere but I don't know what to do next. Any help appreciated

Here is a screenshot of the said error :
Screenshot

Reproducible Case

  • Create a new project using vue-cli
  • Install vue-bus
  • In App.vue file write this.$bus and notice Vetur throwing an error
@doman412
Copy link

I've noticed this issue as well. In my case it's because I am using a multiroot workspace via 'Add Folder to Workspace'. When I take a project root into its own workspace, the problem goes away. Support for multiroot workspaces has been sought after for a while (#424), is there any progress on this?

@InjustFr
Copy link
Author

The workaround I've found is to deactivate linting from this plugin and to use eslint with the vue plugin

@TomKaltz
Copy link

Wasted 5+ hours trying to figure out what was going on. Loading my project in a VSCode workspace was the issue. Very curious if there is any workaround to get module augmentation to work in multi project workspace in VSCode?

@TomKaltz
Copy link

Forgot where I found it but also if the vue project is the first project folder in the workspace vetur will work correctly.

@AlaaZorkane
Copy link

Not really a workaround but you could make a plugin https://vuejs.org/v2/guide/plugins.html and add to its prototype, then Vue.use(yourplugin) you will get intellisense for it. I hope they fix this soon.

@octref
Copy link
Member

octref commented Jun 8, 2020

Thanks @AlaaZorkane, you should follow https://vuejs.org/v2/guide/plugins.html.
Multi-root support is not there yet: #424.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants