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

Property $axios does not exist on type 'CombinedVueInstance plugin nuxt #335

Closed
contrerascoder opened this issue Apr 10, 2020 · 5 comments
Closed

Comments

@contrerascoder
Copy link

Version

v2.12.2

Reproduction link

https://github.com/YLT-PROJECT/nuxt-project

Steps to reproduce

  1. Clone repository of reproduction link
  2. Run npm install for installing dependencies
  3. Open Login component and at the login method try to access to $axios property

What is expected ?

What is expected is that the editor suggests me the methods of AxiosInstance

What is actually happening?

The VSCode typescript compiler points me that $axios not exists

Additional comments?

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 :)

This bug report is available on Nuxt community (#c10506)
@kevinmarrec kevinmarrec transferred this issue from nuxt/nuxt Apr 11, 2020
@kevinmarrec
Copy link
Contributor

kevinmarrec commented Apr 16, 2020

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 :)

@NickBolles
Copy link

Docs reference: https://axios.nuxtjs.org/setup.html#typescript

@lextoc
Copy link

lextoc commented May 14, 2020

Small remark: this is not automatically configured if you have TS and Axios selected in the create-nuxt-app.

@NickBolles
Copy link

NickBolles commented May 16, 2020

@lextoc see my PR here: nuxt/create-nuxt-app#449

It's been delayed a long time, throw a +1 on it!

@seupedro
Copy link

seupedro commented Mar 3, 2021

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/

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

No branches or pull requests

5 participants