How can I declare a function returning a type from a Typescript-enabled library in Typescript

Viewed 2197

I'm using a library (Axios) that has Typescript declarations included in its package.

I'd like to declare a function that takes an AxiosResponse (declared in the library's .d.ts file) as a parameter. I have the following:

function persistEvents(response: AxiosResponse) {
  ...
}

However, in VS code, I'm encountering the error "Cannot find name 'AxiosResponse'".

What do I need to do to be able to declare a function parameter or return that's from my library?

1 Answers
Related