Now I implemented the RepositoryFactory
pattern for API connection.
https://medium.com/canariasjs/vue-api-calls-in-a-smart-way-8d521812c322
In repository.ts
I wrote $axios
.
import testRepository from '~/api/testRepository' export interface Repositories { hoge: testRepository } export default function ({ $axios }, inject) { # <- error on $axios const hoge = new testRepository ($axios) const repositories: Repositories = { hoge } inject('repositories', repositories) }
But it shows error message Binding element '$axios' implicitly has 'any' type.ts(7031)
.
I want to know what is the correct type of $axios
{ $axios } :any
can solve it, but I want to know the exact type of "$axios".
Have you added @nuxt/types and @nuxtjs/axios in the tsconfig.json file? If you need more information, you can check out: https://axios.nuxtjs.org/setup