nuxt-community / axios-module

Secure and easy axios integration for Nuxt 2
https://axios.nuxtjs.org
MIT License
1.2k stars 245 forks source link

Export `NuxtAxiosInstance` typings #587

Closed apgapg closed 1 year ago

apgapg commented 2 years ago

Currently If I need a custom axios instance, I need to provide typings like this:

declare module 'vue/types/vue' {
  interface Vue {
    $axiosLogin: NuxtAxiosInstance
  }
}

Here to provide type of $axiosLogin I need to use NuxtAxiosInstance. But in typings we see the interface is not exported.

https://github.com/nuxt-community/axios-module/blob/d8c99e5edbd2d8ac7d3abe186dd435922e7e1a31/types/index.d.ts#L6

I cant do import { NuxtAxiosInstance } from '@nuxtjs/axios'

ahmedjas1m commented 1 year ago

@apgapg Import it like import type { NuxtAxiosInstance } from '@nuxtjs/axios'

FYI, You may want to check this out https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html

ahmedjas1m commented 1 year ago

duplicated #547

apgapg commented 1 year ago

Thanks.