import { DataProxy } from 'apollo-cache'; import ApolloClient, { ApolloError, MutationOptions, OperationVariables } from 'apollo-client'; import { FetchResult } from 'apollo-link'; import { DocumentNode, GraphQLError } from 'graphql'; import { Omit } from './utils'; export declare type MutationUpdaterFn> = (proxy: DataProxy, mutationResult: FetchResult) => void; export interface BaseMutationHookOptions extends Omit, 'mutation' | 'update'> { update?: MutationUpdaterFn; rethrow?: boolean; } export interface MutationHookOptions extends BaseMutationHookOptions { client?: ApolloClient; } export declare type MutationFn = (options?: BaseMutationHookOptions) => Promise>; export interface ExecutionResult> { data?: T; extensions?: Record; errors?: GraphQLError[]; } export interface MutationResult { called: boolean; data?: TData; error?: ApolloError; hasError: boolean; loading: boolean; } export declare function useMutation(mutation: DocumentNode, baseOptions?: MutationHookOptions): [MutationFn, MutationResult];