react-relay-network-modern icon indicating copy to clipboard operation
react-relay-network-modern copied to clipboard

Incorrect types in index.d.ts

Open stan-sack opened this issue 3 years ago • 1 comments

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

stan-sack avatar Sep 26 '21 01:09 stan-sack

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

Thanks.

nodkz avatar Sep 28 '21 18:09 nodkz