From 6e2e37ea5fe180a6d5ee3dedf76bd72160406b2a Mon Sep 17 00:00:00 2001 From: Uday Vunnam <20707504+udayvunnam@users.noreply.github.com> Date: Mon, 7 Dec 2020 09:45:32 +0530 Subject: [PATCH] fix(types): change the order of types so that correct type inference is picked for **Object syntax** (#1330) * Change the order of types Change the order of types so that correct type inference is picked for Object sytax * change order of types * Update usePaginatedQuery.ts --- src/react/useInfiniteQuery.ts | 10 +++++----- src/react/usePaginatedQuery.ts | 10 +++++----- src/react/useQuery.ts | 9 +++++---- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/react/useInfiniteQuery.ts b/src/react/useInfiniteQuery.ts index cc79eba5e4..82da5a9a30 100644 --- a/src/react/useInfiniteQuery.ts +++ b/src/react/useInfiniteQuery.ts @@ -19,6 +19,11 @@ export interface UseInfiniteQueryObjectConfig { // HOOK +// Object syntax +export function useInfiniteQuery( + config: UseInfiniteQueryObjectConfig +): InfiniteQueryResult + // Parameter syntax with optional config export function useInfiniteQuery( queryKey: QueryKey, @@ -42,11 +47,6 @@ export function useInfiniteQuery( queryConfig?: InfiniteQueryConfig ): InfiniteQueryResult -// Object syntax -export function useInfiniteQuery( - config: UseInfiniteQueryObjectConfig -): InfiniteQueryResult - // Implementation export function useInfiniteQuery( arg1: any, diff --git a/src/react/usePaginatedQuery.ts b/src/react/usePaginatedQuery.ts index 9418f84ace..35aef019cf 100644 --- a/src/react/usePaginatedQuery.ts +++ b/src/react/usePaginatedQuery.ts @@ -24,6 +24,11 @@ export interface UsePaginatedQueryObjectConfig { // HOOK +// Object syntax +export function usePaginatedQuery( + config: UsePaginatedQueryObjectConfig +): PaginatedQueryResult + // Parameter syntax with optional config export function usePaginatedQuery( queryKey: QueryKey, @@ -47,11 +52,6 @@ export function usePaginatedQuery( queryConfig?: PaginatedQueryConfig ): PaginatedQueryResult -// Object syntax -export function usePaginatedQuery( - config: UsePaginatedQueryObjectConfig -): PaginatedQueryResult - // Implementation export function usePaginatedQuery( arg1: any, diff --git a/src/react/useQuery.ts b/src/react/useQuery.ts index d3f36bf4bb..4e23136f5c 100644 --- a/src/react/useQuery.ts +++ b/src/react/useQuery.ts @@ -19,6 +19,11 @@ export interface UseQueryObjectConfig { // HOOK +// Object syntax +export function useQuery( + config: UseQueryObjectConfig +): QueryResult + // Parameter syntax with optional config export function useQuery( queryKey: QueryKey, @@ -38,10 +43,6 @@ export function useQuery( queryConfig?: QueryConfig ): QueryResult -// Object syntax -export function useQuery( - config: UseQueryObjectConfig -): QueryResult // Implementation export function useQuery(