You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a wrapper around useInfiniteQuery that provides default implementations for certain properties while still accepting all other TanStack Vue Query options. However, I'm struggling with TypeScript compilation errors when trying to omit properties from UseInfiniteQueryOptions.
What I'm trying to do
Create a wrapper hook that:
Accepts all UseInfiniteQueryOptions except select, getNextPageParam, and initialPageParam
Automatically provides those three properties with my custom implementations
Vue: No overload matches this call.
Overload 1 of 3, (options: DefinedInitialDataInfiniteOptions<...>)
Overload 2 of 3, (options: UndefinedInitialDataInfiniteOptions<...>)
Overload 3 of 3, (options: UseInfiniteQueryOptions<...>)
Vue: Property getNextPageParam does not exist on type UseInfiniteQueryOptions<...>
Vue: Property initialPageParam does not exist on type UseInfiniteQueryOptions<...>
How should I properly define MyWrapperOptions<T> to work with Vue Query's type system? The complex MaybeRef wrappers and multiple overloads seem to make the standard Omit approach problematic.
Is there a recommended pattern for creating wrapper hooks that omit certain properties from UseInfiniteQueryOptions while maintaining type safety?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Question
I'm trying to create a wrapper around
useInfiniteQuery
that provides default implementations for certain properties while still accepting all other TanStack Vue Query options. However, I'm struggling with TypeScript compilation errors when trying to omit properties fromUseInfiniteQueryOptions
.What I'm trying to do
Create a wrapper hook that:
UseInfiniteQueryOptions
exceptselect
,getNextPageParam
, andinitialPageParam
My attempts and errors
Attempt 1: Using Omit
Error:
Attempt 2: Direct type usage
Error:
My implementation attempt
Question
How should I properly define
MyWrapperOptions<T>
to work with Vue Query's type system? The complexMaybeRef
wrappers and multiple overloads seem to make the standardOmit
approach problematic.Is there a recommended pattern for creating wrapper hooks that omit certain properties from
UseInfiniteQueryOptions
while maintaining type safety?Environment
Beta Was this translation helpful? Give feedback.
All reactions