You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exported classes in type definition are not actually exported #5031
AxiosHeaders, AxiosError, CanceledError and Axios are "exported" in the type definitions index.d.ts, but not exported in the module.
To Reproduce
const{ AxiosHeaders }=require('axios');// Allowed by Typescriptconstheaders=newAxiosHeaders({'name': 'value'});// <-- throws Error as AxiosHeaders is not actually exported
Expected behavior
Types are not exported, but only declared (declare class instead of export class).
Classes are exported and can be imported and used like so:
Activity
wai-ti8m commentedon Oct 7, 2022
I guess that's a duplicate of #5004
wai-ti8m commentedon Oct 7, 2022
Issue not fixed: Classes are still not exported in the
index.jsfile. Need to add something likeexport * from './lib/axios.js';Export classes from type definition (axios#5031)
fix: Export classes from type definition (axios#5031)
Carsten-Leue commentedon Oct 7, 2022
+1 I am getting this error with
1.1.2abriginets commentedon Oct 8, 2022
Having the same issue with
CanceledError:And
error instanceof CanceledErrorthrows an error becauseundefinedis not an object ¯\_(ツ)_/¯chrisweb commentedon Oct 8, 2022
Others like AxiosProgressEvent seem to be fine
As a workaround for now I used axios.AxiosError, so for example:
got the idea from this ticket: #5062
Carsten-Leue commentedon Oct 9, 2022
Another workaround is the use of 'axios.isAxiosError'
fix: eep top-level export same with static properties (#5109)