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
Fixing isAxiosError
typings to take generics
#3816
Conversation
0c20e9b
to
5f70b1d
Compare
Whats the status on this? |
12fff93
to
465a617
Compare
I don't know. I already keep this pull sync with Sorry for ping @mzabriskie , @jasonsaayman 🙏 |
bumped. @jasonsaayman , please give review. I also edit some formatting. If you don't like it, I can revert the format, and update the commit. |
17c7dc5
to
33c0d1d
Compare
This would be very useful. Bumping. |
waiting for this merge 👍🏻 |
This will have to go into Axios next as it will be a breaking change |
cf22d5f
to
3c18112
Compare
@jasonsaayman sorry if I'm wrong, I don't think this is breaking change, this is just kind of new feature since old behavior still acceptable without issue. This is still good: let user: User = null;
try {
const { data } = await axios.get('/user?ID=12345');
user = data.userDetails;
} catch (error) {
if (axios.isAxiosError(error)) {
handleAxiosError(error);
} else {
handleUnexpectedError(error);
}
} but accept the custom interface: interface ResponseData {
// ...
};
interface RequestConfigData {
// ...
};
let user: User = null;
try {
const { data } = await axios.get('/user?ID=12345');
user = data.userDetails;
} catch (error) {
if (axios.isAxiosError<ResponseData, RequestConfigData>(error)) {
handleAxiosError(error);
} else {
handleUnexpectedError(error);
}
} CMIIW |
Why this is a breaking change? All generics have a default |
This has already fixed with new error handeling |
@jasonsaayman what is the new error handling and how does it solve this problem? |
I have already re-opened one of the other pull requests that deals with this. |
Closing in favour of #4344 |
I'm trying to solve this issue from #3815, this removes a workaround as stated from this #3815 (comment)
Also, I make formatting changes. If you don't like it, I could drop it.
closes: #3815