I am wrapping a function from a library and want the wrapper function to have the same typing as the wrapped function, so that the generics and arguments can be passed through.
The function I am looking to wrap is from the apollo library, named useQuery.
It's declaration looks like this:
export declare function useQuery<TData = any, TVariables = OperationVariables>(query: DocumentNode | TypedDocumentNode<TData, TVariables>, options?: QueryHookOptions<TData, TVariables>): QueryResult<TData, TVariables>;
I want to write a function that wraps useQuery as so:
function wrapper<*generics*>(*args*) {
...
return useQuery<*generics*>(*args*);
}
Can I somehow provide the generics and arguments without having to import the appropriate types?
Can this be done implicitly?