Fixing 'currentTarget' does not exist on type 'AxiosProgressEvent'

January 26, 2024

Fixing “Property ‘currentTarget’ does not exist on type ‘AxiosProgressEvent’”

Let’s say you have an axios onDownloadProgress function that looks like this:

onDownloadProgress: (axiosProgressEvent: AxiosProgressEvent) => {
    const response = axiosProgressEvent.currentTarget.response
}

And you’d like to upgrade your axios version. If you’re upgrading, then currentTarget won’t exist on the event directly anymore, rather you have to access it via event.event:

onDownloadProgress: (axiosProgressEvent: AxiosProgressEvent) => {
    const response = axiosProgressEvent.event.currentTarget.response
}

And this is how you can fix Property currentTarget does not exist on type AxiosProgressEvent!


Profile picture

Written by An anonymous coder who lives and works building useful things. Mostly focusing on Django, Vue and overall Python examples.