New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AxiosError should be a top-level export instead of a static #5062
Comments
I am opening a PR on this 👍 ! |
This might be related to #5031 |
The problem is not name conflicting, it is the wrong way (not typescript wise) of exporting |
Okay so I should change the way it is exported, right? |
In my opinion, the whole class (both type and implementation) should be exported at top level. Currently only type (interface) is exported at top level, the real implementation is hidden deep inside, which is the root of the trouble |
Currently, there is no way to use AxiosError correctly. This was caused only by exporting the type at the top-level but the implementation deep inside the axios instance. Exported the AxiosError class at the top-level to fix inconsistencies. Refs: axios#5062 BREAKING CHANGE: AxiosError should be used from the top-level import rather than using it from the axios instance.
I have fixed it 👍🏻 ! Can you take a look at it? |
I am not maintainer of axios and do not want to involve too much, you can explain the reason and ask someone relevant to do the reviewing. |
Will have a look @haneenmahd |
It seems pr: #5030 fixed it but then commit: #2149464bb4f12c1101b15f73298a060e92470376 revert it |
I tried to update const axiosError = new AxiosError();
|
I tried it after upgrade axios to v1.1.3, It works when I import it but not work when require it; |
Describe the bug
There is no way to use
AxiosError
correctly (It should be used as both type and value)To Reproduce
Expected behavior
Put
AxiosError
as top-level export with implementation rather than type ONLYEnvironment
The text was updated successfully, but these errors were encountered: