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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default type for "until" function in "RetryConfig" #39

Merged
merged 4 commits into from Aug 29, 2023
Merged

Use default type for "until" function in "RetryConfig" #39

merged 4 commits into from Aug 29, 2023

Conversation

bennycode
Copy link
Contributor

@bennycode bennycode commented Aug 29, 2023

Hello @normartin, I came across your library today and I like it a lot. 馃憤 I am also importing the typings of RetryConfig to have a type-safe config. I noticed, that I have to supply a type argument for the RetryConfig even when I am not making use of the until functionality:

import {RetryConfig} from 'ts-retry-promise';

const retryConfig: Partial<RetryConfig<any>> = {
  retries: 'INFINITELY',
  delay: 1_000,
  retryIf: (error: unknown) => {
    if (hasErrorCode(error) && error.code === 'OFFLINE') {
      return true;
    }
    return false;
  }
};

As the until functionality is the only config that would need this parameter, I think my use case will apply to everyone who wants to reuse the RetryConfig type but doesn't need until.

I suggest giving it a default type argument of any, so that only developers who need it, need to configure it. What do you think?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6014652790

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 2730874024: 0.0%
Covered Lines: 78
Relevant Lines: 78

馃挍 - Coveralls

@normartin normartin merged commit 4ec0f2f into normartin:master Aug 29, 2023
6 checks passed
@normartin
Copy link
Owner

Hey @bennycode ,
I agree with all you said. Will merge and release tonight.

Thank you for your nice PR!

@bennycode
Copy link
Contributor Author

That is very nice of you! Thanks for the quick feedback. 馃檪

I also plan to present your library on my YouTube channel if you are okay with it?

P.S. When I ran npm fund I found some vulnerable dev dependencies. Maybe a npm update --fix will help fixing these.

@normartin
Copy link
Owner

Sure i'm ok with the YT thing :-). I tried to update the dev dependencies, but that breaks the mutation tests (npm run mutation-test). Needs some more work. Not sure when I will be able to look into it.

@bennycode
Copy link
Contributor Author

Sounds fair. These are luckily just dev dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants