axios-module
axios-module copied to clipboard
ESLint: NuxtAxiosInstance not found in '@nuxtjs/axios'(import/named)
// package.json
"@nuxtjs/axios": "^5.13.6",
"nuxt": "^2.15.7",
import { Context } from '@nuxt/types'
import { NuxtAxiosInstance } from '@nuxtjs/axios'
const someFunc = (context: Context) => {
const { $axios }: { $axios: NuxtAxiosInstance } = context;
$axios.get("something")
}
ES Lint throws following errro:
error NuxtAxiosInstance not found in '@nuxtjs/axios' import/named
I looked inside axios/types/index.d.ts and there are simply no exports at all. Only module declarations. So, this makes it impossible to use NuxtAxios types anywhere in your app?
same here! it's happen after I use nuxtjs 3 bridge
We are still on V2 and still have this issue
Hey @slavco86
it's strange, but take a look in my project maybe you can find something that can help you: https://github.com/eerison/myprofile/tree/master/client
I'm using nuxt2 in master and it's working as expected.
quick fix for me by adding this line to .eslintrc, this happened when I updated @nuxtjs/eslint-config-typescript to version ^7.0.0
rules: {
'import/named': 0,
},
@gustiyoga This is not a fix. Your are simply disabling a rule. The fix should be to export all individual interfaces and types separately to allow this on-demand referencing, without having to carry the Context type around like a hot potato, just to get access to some types declared on it
same here! it's happen after I use nuxtjs 3 bridge
In my case I wasn't using '#app' after I change the import it back to work.
Please see https://github.com/nuxt-community/axios-module/issues/555
Seems to work with import type instead of just import :)