For instance, when working with ReactQuery's
useQuery<TQueryFnData = unknown, TError = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>
, I aim to achieve the following:
type QueryTypeParams = [Record<string, number>, unknown, unknown, "aKey" as const]
const {data} = useQuery<...QueryTypeParams>(
"anotherKey", // <- should trigger a TypeScript error
() => {...}
)
However, the compiler gives me this warning:
Variable 'QueryTypeParams' implicitly has an 'any' type.
This occurs when I attempt to use the spread operator.
Is there a way to pass generic parameters all at once?
Thanks in advance.