softonic / axios-retry

Axios plugin that intercepts failed requests and retries them whenever possible
Other
1.9k stars 167 forks source link

tsc doesn't like the default export #172

Closed coolaj86 closed 2 years ago

coolaj86 commented 3 years ago

In order for Type Linting to work, both axios and axios-retry have to be required by their default export:

- var axios = require('axios');
+ var axios = require('axios').default;
- var axios = require('axios-retry');
+ var axios = require('axios-retry').default;
  1. Without using the default export, tsc goes nuts thinking that it's the wrong type.
  2. With the default export, tsc is happy... but default doesn't actually exist.

This leads me to believe that index.d.ts is being generated in a way that's contrary to the export methods that axios-retry actually supports.

coolaj86 commented 3 years ago

Workaround:

//@ts-ignore
require('axios-retry').default = require('axios-retry');
var axios = require('axios-retry').default;
mindhells commented 3 years ago

I believe with a1793ce8e44874d098c368f17a767db319880278 the issue should be fixed can you check please?