axios typescript doc code example
Example: axios typescript
axios.request<ServerData>({
url: 'https://example.com/path/to/data',
transformResponse: (r: ServerResponse) => r.data
}).then((response) => {
// `response` is of type `AxiosResponse<ServerData>`
const { data } = response
// `data` is of type ServerData, correctly inferred
})