vercel / async-retry

Retrying made simple, easy and async
https://npmjs.com/async-retry
MIT License
1.85k stars 53 forks source link

(0 , async_retry_1.retry) is not a function #103

Open akramrabiie opened 1 year ago

akramrabiie commented 1 year ago

Hello I am getting this error while using retry

(0 , async_retry_1.retry) is not a function

Here is my code:

 await retry(
        async () => {
          await this.myMethod(arguments)
        },
        { retries: 2 },
      );

Could you please help?

akramrabiie commented 1 year ago

Well, I changed the import statement and it worked by require const retry = require('async-retry');

But based on your example it should've been worked with the import 🤔

pedropaiva1 commented 1 year ago

I did have the same error using with typescript, but when i changed the syntax to 'import * as retry from 'async-retry'' it works, i dont know how

vitaly-t commented 2 months ago

If you still stuck, check out this complete solution in TypeScript.