tdc-js-modules
Version:
21 lines (17 loc) • 564 B
TypeScript
import { Dispatch, SetStateAction } from 'react';
import { Environment, GraphQLTaggedNode } from 'relay-runtime';
type UseQueryReturnT<T> = {
data: T;
loading: boolean;
error: any;
fetch: () => void;
setData: Dispatch<SetStateAction<T>>;
};
type UseQueryConfigT<T> = { onMount: boolean; initialValue: T; transformFunction?: (data: any) => T };
type UseQueryT<T> = (
query: GraphQLTaggedNode,
variables: any,
config: UseQueryConfigT<T>,
environment: Environment,
) => UseQueryReturnT<T>;
export { UseQueryConfigT, UseQueryReturnT, UseQueryT };