Skip to content

Commit

Permalink
fix(typings): improve typing of the error and response properties on …
Browse files Browse the repository at this point in the history
…ResponseValues
  • Loading branch information
Mark Hebden committed Nov 18, 2020
1 parent 7fcb7ae commit 4479a90
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
} from 'axios'
import LRUCache from 'lru-cache'

export interface ResponseValues<T> {
data?: T
export interface ResponseValues<TResponse, TError> {
data?: TResponse
loading: boolean
error?: AxiosError
response?: AxiosResponse
error?: AxiosError<TError>
response?: AxiosResponse<TResponse>
}

export interface Options {
Expand All @@ -30,9 +30,9 @@ export interface ConfigureOptions {
}

export interface UseAxios {
<T = any>(config: AxiosRequestConfig | string, options?: Options): [
ResponseValues<T>,
(config?: AxiosRequestConfig, options?: RefetchOptions) => AxiosPromise<T>
<TResponse = any, TError = any>(config: AxiosRequestConfig | string, options?: Options): [
ResponseValues<TResponse, TError>,
(config?: AxiosRequestConfig, options?: RefetchOptions) => AxiosPromise<TResponse>
]

loadCache(data: any[]): void
Expand Down

0 comments on commit 4479a90

Please sign in to comment.