2019.2 VueJS unsing "inject" in component needs autocompletion

I am defining my Axios data services in a service file, which I am then registering in main.js and adding to my components using the VueJS inject https://vuejs.org/v2/api/#provide-inject 

However, WebStorm does not does not recognise the injected items for autocompletion, nor does it recognise the methods on the injected Class 

0
3 comments

please can you provide code snippets that show up the issue?

0

main.js

import { DataService } from './dataService'

new Vue({
render: h => h(App),
provide () {
return {
eventBus: new Vue()
restData: new DataService(this.eventBus)
}
}
}).$mount('#app')

Display.vue

// ...

methods: {

// Most of the component omitted.

async deleteProduct (product) {
await this.restData.deleteProduct(product) // no suggestions for restData, deleteProduct is however offered as a completion once restData is manually 
},
},
inject: ['eventBus', 'restData'], // neither eventBus or restData are autocompleted from main.js provide
async created () {
let data = await this.restDataSource.getProducts() // As with deleteProduct getProducts is available for completion, restData is not.
}

Does that all make sense?

0

Thanks!

Submitted to developers as https://youtrack.jetbrains.com/issue/WEB-40356, please follow it for updates

0

Please sign in to leave a comment.