import { ApolloClient , } from 'apollo-client' ; import { ModifiableWatchQueryOptions } from 'apollo-client/core/watchQueryOptions' ; export type QueryDefinitionType < QueryResult , QueryVars > = { _type : '__QUERY_DEFINITION_TYPE' ; resultTYPEHOLDER : QueryResult ; varsTYPEHOLDER : QueryVars ; query : any ; } ; export function createQueryDefinition < QueryResult , QueryVars > ( query ) { return { _type : '__QUERY_DEFINITION_TYPE' , resultTYPEHOLDER : undefined as any , varsTYPEHOLDER : undefined as any , query , } ; } export function sendQuery < QueryResult , QueryVars > ( queryDefinition ) { return ( apolloClient ) => { return ( variables ) => apolloClient . query < QueryResult , QueryVars > ( { query : queryDefinition . query , variables , } ) ; } ; } export function watchQuery < QueryResult , QueryVars > ( queryDefinition ) { return ( apolloClient ) => { return ( variables , watchOptions ? ) => apolloClient . watchQuery < QueryResult , QueryVars > ( { ... watchOptions , query : queryDefinition . query , variables , } ) ; } ; }