Open ahmedkamalio opened 5 years ago
Is there any type of definition for the promise returned?
for example
componentDidMount() { this.props.loadCategories().then(res => { // what is the type of res }) }
I wanna represent the res with a typescript interface, so I came up with the following representation
res
/** * Describes the returned object of axios middleware action creators */ export interface IAxiosAction<TData = any> { type: string payload: { request: { client: string method: string url: string } } } /** * Describes the returned object of axios middleware calls */ export interface IAxiosResult<TData = any> { type: string payload: { config: IAxiosRequestConfig data: TData headers: { [key: string]: string } request: XMLHttpRequest status: number statusText: string } meta: { previousAction: IAxiosAction<TData> } } /** * Describes request config object of axios calls */ export interface IAxiosRequestConfig<TData = any> { adapter: any baseURL: string client: string data?: TData headers: { [key: string]: string } maxContentLength: number method: string reduxSourceAction: IAxiosAction<TData> responseType: string timeout: number transformRequest: any transformResponse: any url: string validateStatus: any xsrfCookieName: string xsrfHeaderName: string }
Are the interfaces above really describes the res object? if so are you open to add .d.ts definition files to your source code?
.d.ts
Is there any type of definition for the promise returned?
for example
I wanna represent the
res
with a typescript interface, so I came up with the following representationAre the interfaces above really describes the
res
object? if so are you open to add.d.ts
definition files to your source code?