I might just be missing some configuration but I'm unable to get my store to properly pick up the types for this.$axios in Vuex store actions. Things I've tried:
Adding "import '@nuxtjs/axios';" to an index.d.ts file
Adding "@nuxtjs/axios" to the "types" array in tsconfig.json
Directly copying and pasting the type definition from "vuex.d.ts" in to an index.d.ts file in my project
This is all using the actions type definition found in the Nuxt example here: https://nuxtjs.org/examples/typescript-vuex (and in use in the codesandbox link provided -- see store/index.ts).
If I remove that, I get a "Property '$axios' does not exist on type" error instead.
What is expected ?
Types are picked up correctly and I'm able to use this.$axios methods.
What is actually happening?
Types are not correctly picked up and builds subsequently fail.
This bug report is available on Nuxt community (#c234)
Version
v5.1.0
Reproduction link
https://codesandbox.io/s/14zzr032xj
Steps to reproduce
I might just be missing some configuration but I'm unable to get my store to properly pick up the types for
this.$axios
in Vuex store actions. Things I've tried:This is all using the actions type definition found in the Nuxt example here: https://nuxtjs.org/examples/typescript-vuex (and in use in the codesandbox link provided -- see
store/index.ts
).If I remove that, I get a "Property '$axios' does not exist on type" error instead.
What is expected ?
Types are picked up correctly and I'm able to use
this.$axios
methods.What is actually happening?
Types are not correctly picked up and builds subsequently fail.