axios.get('/api')
When working with TypeScript as shown above, it is important to designate types for better clarity. This allows us to reference the type definition of axios, like so:
(method) AxiosInstance.get<any, AxiosResponse<any>>(url: string, config?: AxiosRequestConfig | undefined): Promise<AxiosResponse<any>>
^^^ <- ???
I am puzzled by the use of any
in the first generic type of the get method AxiosInstance.get<any,
. What is the purpose of using this any
type?