import { ClientOptions, Client, SSRExchange, SSRData } from 'urql';
export * from 'urql';
import { NextPage, NextComponentType, NextPageContext } from 'next';
import NextApp, { AppContext } from 'next/app';
import { Exchange } from '@urql/core';

declare const cacheExchange: Exchange;

declare function initGraphQLClient(clientOptions: ClientOptions): Client;
declare function withGraphQLClient(getClientConfig: NextGraphQLClientConfig): <C extends NextPage<any> | typeof NextApp>(AppOrPage: C) => NextComponentType<NextUrqlContext, {}, WithGraphQLClientProps>;
type Optional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
type NextGraphQLClientConfig = (ssrExchange: SSRExchange, ctx?: NextPageContext) => Optional<ClientOptions, 'exchanges'>;
interface WithGraphQLClientProps {
    urqlClient?: Client;
    pageProps: any;
    graphqlState?: SSRData;
    [key: string]: any;
}
interface NextGraphQLPageContext extends NextPageContext {
    urqlClient: Client;
}
interface NextGraphQLAppContext extends AppContext {
    urqlClient: Client;
}
type NextUrqlContext = NextGraphQLAppContext | NextGraphQLPageContext;

export { NextGraphQLAppContext, NextGraphQLClientConfig, NextGraphQLPageContext, NextUrqlContext, WithGraphQLClientProps, cacheExchange, initGraphQLClient, withGraphQLClient };
