Closed snelsi closed 1 year ago
Possible implementation:
export type inferOptions<T> = T extends QueryHook<infer TFnData, infer TVariables, infer TError>
? QueryHookOptions<TFnData, TError, TFnData, TVariables>
: T extends MutationHook<infer TData, infer TVariables, infer TError>
? MutationHookOptions<TData, TError, TVariables, any>
: never;
Available in v1.5.2
Context
react-query-kit
already provides 3 util types:Describe your proposal
Would be great to also provide
inferOptions
type, that would returnQueryHookOptions
orMutationHookOptions
of the given hook.You can kinda achieve similar result manually by doing:
or
But it's not super convenient.
Example of possible usage