question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

defaults property missing from Axios

See original GitHub issue

I just added Flow to a module that uses transformResponse in the config and noticed I get the error property `defaults`. Property not found in Axios. Being new to Flow, I modified the definition to include defaults: Object; and was able to continue with no errors, but I’m concerned this may not be preferred. Since AxiosXHRConfig is a generic interface, I wasn’t sure if it was possible to get the type inside the non-generic Axios class.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ryyppycommented, Dec 7, 2016

I just installed the v0.15.x libdef and wrote following program:

import axios from 'axios';

const a = axios({
  url: 'foo',
  transformResponse: [function (data) {
    // Do whatever you want to transform the data

    return data;
  }]
});

It does typecheck for me… which flow version & axios libdef version did you use?

0reactions
GAntoinecommented, Oct 11, 2017

Closing as the latest def has defaults on the constructor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handle missing properties in a general purpose api using ...
Good solution, default properties with default values for properties. I just started using Object.assign in other areas, and over-looked this ...
Read more >
Request Config | Axios Docs
Requests will default to GET if method is not specified. ... It can be convenient to set `baseURL` for an instance of axios...
Read more >
Chinese property giant Evergrande misses payment to foreign ...
The big picture: Missing a coupon payment doesn't automatically mean that Evergrande is in default — under the terms of the bond there's...
Read more >
Understanding Axios GET requests - LogRocket Blog
Learn how to make GET requests in Axios with query parameters and API ... Requests default to the GET request when the method...
Read more >
Axios Cheat Sheet - Kapeli - Dash for macOS
Config Defaults ; var · = axios ; // Now all requests will wait 2.5 seconds before timing out ·.defaults ; // Override...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found