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

Incorrect types in index.d.ts #140

Open
stan-sack opened this issue Sep 26, 2021 · 1 comment · May be fixed by #148
Open

Incorrect types in index.d.ts #140

stan-sack opened this issue Sep 26, 2021 · 1 comment · May be fixed by #148

Comments

@stan-sack
Copy link

Hey,

I've just started migrating my project to typescript and I noticed that im getting a typescript errors when I try to pass a function to fetchTimeout. I looked in retry.js and everything looks fine - the param can be a function:

export type RetryMiddlewareOpts = {|
  fetchTimeout?: number | TimeoutAfterFn,
  retryDelays?: number[] | RetryAfterFn,
  statusCodes?: number[] | false | StatusCheckFn,
  logger?: Function | false,
  allowMutations?: boolean,
  allowFormData?: boolean,
  forceRetry?: ForceRetryFn | false, // DEPRECATED in favor `beforeRetry`
  beforeRetry?: BeforeRetryCb | false,
|};

But in index.d.ts the parameters arent the same:

export interface RetryMiddlewareOpts {
  fetchTimeout?: number;
  retryDelays?: number[] | RetryAfterFn;
  statusCodes?: number[] | false | StatusCheckFn;
  logger?: Function | false;
  allowMutations?: boolean;
  allowFormData?: boolean;
  forceRetry?: ForceRetryFn | false; // DEPRECATED in favor `beforeRetry`
  beforeRetry?: BeforeRetryCb | false;
}

I think maybe you need to clean up this file? Im unsure why its like this. I assume this is some legacy type def

@nodkz
Copy link
Collaborator

nodkz commented Sep 28, 2021

I don't have the bandwidth to fix these typesdefs. I will be very happy if somebody opens PR with fixes.

Thanks.

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

Successfully merging a pull request may close this issue.

2 participants