jefflau / apollo-client-mock

Easily mock your apollo client for testing
MIT License
18 stars 8 forks source link

Add typescript definitions #6

Open moonray opened 5 years ago

moonray commented 5 years ago

It would be great to have typescript support.

moonray commented 5 years ago

This is the type definition that I believe should work.

declare module 'apollo-client-mock' {
  import { NormalizedCacheObject } from 'apollo-cache-inmemory';
  import { ApolloClient } from 'apollo-client';
  import { ITypeDefinitions, IMocks } from 'graphql-tools';

  export default function setupClient(
    mockResolvers: IMocks,
    typeDefs: ITypeDefinitions
  ): () => ApolloClient<NormalizedCacheObject>;
}