https://github.com/YLT-PROJECT/nuxt-project
What is expected is that the editor suggests me the methods of AxiosInstance
The VSCode typescript compiler points me that $axios not exists
I am begining to use typescript in my projects for more ease, but I got stacked always on errors like I comment on this issue
I don't know how can I use .d.ts files to add properties to Vue Components, this could solve me the problem
Please, help :)
Hey @contrerascoder , you need to add "@nuxtjs/axios" to the types array here : https://github.com/YLT-PROJECT/nuxt-project/blob/master/tsconfig.json#L28 :)
Then ensure you restart editor after this change :)
Docs reference: https://axios.nuxtjs.org/setup.html#typescript
Small remark: this is not automatically configured if you have TS and Axios selected in the create-nuxt-app.
@lextoc see my PR here: https://github.com/nuxt/create-nuxt-app/pull/449
It's been delayed a long time, throw a +1 on it!
Im my case, I was missing to use Vue.extend({}) or Vue.Component as described here https://vuejs.org/v2/guide/typescript.html#Basic-Usage and here https://typescript.nuxtjs.org/
Most helpful comment
Hey @contrerascoder , you need to add
"@nuxtjs/axios"to thetypesarray here : https://github.com/YLT-PROJECT/nuxt-project/blob/master/tsconfig.json#L28 :)Then ensure you restart editor after this change :)