diff --git a/types/react-query/index.d.ts b/types/react-query/index.d.ts index e8c79b24e7..496b3f5fa7 100644 --- a/types/react-query/index.d.ts +++ b/types/react-query/index.d.ts @@ -52,7 +52,7 @@ export interface QueryResult { isFetching: boolean; isCached: boolean; failureCount: number; - refetch: (arg?: {variables?: TVariables, merge?: (...args: any[]) => any, disableThrow?: boolean}) => void; + refetch: (arg?: {variables?: TVariables, merge?: (...args: any[]) => any, disableThrow?: boolean}) => Promise; } export interface QueryResultPaginated extends QueryResult { diff --git a/types/react-query/react-query-tests.ts b/types/react-query/react-query-tests.ts index 5ed0670d3d..55770da83b 100644 --- a/types/react-query/react-query-tests.ts +++ b/types/react-query/react-query-tests.ts @@ -8,7 +8,7 @@ const querySimple = useQuery('todos', querySimple.data; // $ExpectType string | null querySimple.error; // $ExpectType Error | null querySimple.isLoading; // $ExpectType boolean -querySimple.refetch(); // $ExpectType void +querySimple.refetch(); // $ExpectType Promise queryPaginated.fetchMore; // $ExpectError queryPaginated.canFetchMore; // $ExpectError queryPaginated.isFetchingMore; // $ExpectError @@ -19,7 +19,7 @@ const queryVariables = useQuery(['todos', {param}], (variables) => Promise.resolve(variables.param === 'test')); queryVariables.data; // $ExpectType boolean | null -queryVariables.refetch({variables: {param: 'foo'}}); // $ExpectType void +queryVariables.refetch({variables: {param: 'foo'}}); // $ExpectType Promise queryVariables.refetch({variables: {other: 'foo'}}); // $ExpectError // Query with falsey query key