Skip to content

[TypeScript] ReactQueryConfigProvider type miss match #542

@pete-redmond-cko

Description

@pete-redmond-cko

I noticed that use can pass the type of error to the ReactQueryProviderConfig interface, however the ReactQueryConfigProvider does not except the TError so it sets the error in config to be Error (the default).

const reactQueryConfig: ReactQueryProviderConfig<AxiosError> = {
  refetchAllOnWindowFocus: false,
  refetchOnWindowFocus: false,
  retry: (failureCount, error) => {
    if (error.response?.status === 404) {
      return false;
    }

    return failureCount > 2;
  },
};
<ReactQueryConfigProvider
  config={reactQueryConfig}
>
      ...
</ReactQueryConfigProvider>

I am getting a type error when trying to use a AxiosError in the config.

Screenshot 2020-06-03 at 13 03 27

Shouldn't the ReactQueryConfigProvider take in the Error Type?

<ReactQueryConfigProvider<AxiosError>
  config={reactQueryConfig}
>
      ...
</ReactQueryConfigProvider>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions