import ApolloClient from 'apollo-client'; import { IncomingHttpHeaders } from 'http'; import { NextPageContext } from 'next'; import { AppContext } from 'next/app'; export interface WithApolloOptions { getDataFromTree?: 'always' | 'never' | 'ssr'; } export interface WithApolloState { data?: TCache; } export interface WithApolloProps { apolloState: WithApolloState; apollo: ApolloClient; } export interface InitApolloOptions { ctx?: NextPageContext; headers?: IncomingHttpHeaders; initialState?: TCache; } export type InitApolloClient = ( options: InitApolloOptions ) => ApolloClient; export interface ApolloAppContext extends NextPageContext { // Custom prop added by withApollo apolloClient: ApolloClient; } export interface ApolloContext extends AppContext { ctx: ApolloAppContext; }