Skip to content

Commit

Permalink
fix(vue-query): export proper useQuery return type (#4513)
Browse files Browse the repository at this point in the history
* fix(vue-query): export useQuery return type

* fix(vue-query): export useInfiniteQuery return type

* fix(vue-query): re-export UseQueryDefinedReturnType

Co-authored-by: Aleksandr Semenov <juvs@ecwid.com>
Co-authored-by: Damian Osipiuk <osipiukd+git@gmail.com>
  • Loading branch information
3 people committed Nov 26, 2022
1 parent 1e998d3 commit 379297a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions packages/vue-query/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ export { useIsFetching } from './useIsFetching'
export { useIsMutating } from './useIsMutating'
export { VUE_QUERY_CLIENT } from './utils'

export type { UseQueryReturnType } from './useBaseQuery'
export type { UseQueryOptions } from './useQuery'
export type { UseInfiniteQueryOptions } from './useInfiniteQuery'
export type {
UseQueryOptions,
UseQueryReturnType,
UseQueryDefinedReturnType,
} from './useQuery'
export type {
UseInfiniteQueryOptions,
UseInfiniteQueryReturnType,
} from './useInfiniteQuery'
export type { UseMutationOptions, UseMutationReturnType } from './useMutation'
export type { UseQueriesOptions, UseQueriesResults } from './useQueries'
export type { MutationFilters } from './useIsMutating'
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-query/src/useInfiniteQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type InfiniteQueryReturnType<TData, TError> = UseQueryReturnType<
TError,
InfiniteQueryObserverResult<TData, TError>
>
type UseInfiniteQueryReturnType<TData, TError> = Omit<
export type UseInfiniteQueryReturnType<TData, TError> = Omit<
InfiniteQueryReturnType<TData, TError>,
'fetchNextPage' | 'fetchPreviousPage' | 'refetch' | 'remove'
> & {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-query/src/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import { useBaseQuery } from './useBaseQuery'
import type { UseQueryReturnType as UQRT } from './useBaseQuery'
import type { WithQueryClientKey, VueQueryObserverOptions } from './types'

type UseQueryReturnType<TData, TError> = Omit<
export type UseQueryReturnType<TData, TError> = Omit<
UQRT<TData, TError>,
'refetch' | 'remove'
> & {
refetch: QueryObserverResult<TData, TError>['refetch']
remove: QueryObserverResult<TData, TError>['remove']
}

type UseQueryDefinedReturnType<TData, TError> = Omit<
export type UseQueryDefinedReturnType<TData, TError> = Omit<
ToRefs<Readonly<DefinedQueryObserverResult<TData, TError>>>,
'refetch' | 'remove'
> & {
Expand Down

0 comments on commit 379297a

Please sign in to comment.