Skip to content
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

axios's ussing same type for request and response data #1975

Closed
punksta opened this issue Mar 17, 2018 · 0 comments
Closed

axios's ussing same type for request and response data #1975

punksta opened this issue Mar 17, 2018 · 0 comments
Labels
bug libdef Related to a library definition

Comments

@punksta
Copy link

punksta commented Mar 17, 2018

data and config.data types are same:
https://github.com/flowtype/flow-typed/blob/fa010af9306bd5f2835c7890638afb0cb107dcfe/definitions/npm/axios_v0.18.x/flow_v0.25.x-/axios_v0.18.x.js#L69-L77

I believe AxiosXHR should look like this.

declare class AxiosXHR<T, R> {
    config: AxiosXHRConfig<T>;
    data: R
@gantoine gantoine added libdef-issue libdef Related to a library definition bug and removed libdef-issue labels Mar 19, 2018
AndrewSouthpaw pushed a commit that referenced this issue Mar 29, 2018
This PR adds a separate response type to axios calls, earlier the definitions
used the same infered type for config.data and response.data. This has been mentioned in #1975 and #1539.

But hopefully this wont break backwards compatability since I added the
original type (T) as default for the new response type (R). Also verified by tests.

As of now I have only updated the 0.18.x-version. But the same issue is present in earlier versions as well. If you think I should update the old ones as well I'd be happy to do so.

* Add separate response type to axios

THis commit adds a separate response type to axios calls, earlier the definitions
used the same infered type for config.data and response.data.

But hopefully this wont break backwards compatability since I added the
original type (T) as default for the new response type (R).

* Use AxiosPromise when testing types

* Test that types carries through
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug libdef Related to a library definition
Projects
None yet
Development

No branches or pull requests

3 participants