Method types out of sync with implementation
AndrewZelaya opened this issue · comments
Types for some methods are out of sync and don't appear to return a promise. As mentioned here
For the specifically mentioned flush
method, the promise returned is the end of the .then().catch()
chain, not the original promise returned by axios. So this is not particularly useful. For example, the returned promise will never be rejected as any error from axios is already caught. flush().catch()
is equivalent to axios.post().then().catch().catch()
.
I would guess that the returned promise was not intentional and is not meant to be used for the reasons described above. Instead, I would guess it is a byproduct of the common practice of return
ing whenever you branch async.
EDIT: I guess if you did not care if the flush failed or not, then there is no harm using it. Though I think this does not align with users' expectations (if the callback can return an error, I would expect the promise to be able to be rejected).
I'm having the same problem on 6.0.0 which is 6 months old? Looks like maybe a new version hasn't been released yet.