It looks like there is a bug either in axios retyped library or in the ToTask in general. Here is the line of code

axios.AxiosResponse<T>...