plrdev / react-native-flipper-apollo-devtools

33 stars 7 forks source link

define Client type #1

Closed MikePodgorniy closed 3 years ago

MikePodgorniy commented 4 years ago

ApolloClient<NormalizedCache | NormalizedCacheObject>

plrdev commented 4 years ago

What is the NormalizedCacheObject in this one?

MikePodgorniy commented 4 years ago

the result type of apollo client with some InMemoryCache config

MikePodgorniy commented 4 years ago

And maybe you need to define types for logger cb function?

    const logger = ({
      state: { queries, mutations },
      dataWithOptimisticResults: inspector,
    }: {
      state: {
        queries: any;
        mutations: any;
      };
      dataWithOptimisticResults: any;
    }) => {
      counter++;
      enqueued = {
        counter,
        queries,
        mutations,
        inspector,
      };
      if (currentConnection !== null) {
        currentConnection.send('broadcast:new', enqueued);
      }
    };
    client.__actionHookForDevTools(logger as () => void);
plrdev commented 4 years ago

And maybe you need to define types for logger cb function?

Yeah all of this would benefit from typing properly, so go ahead if you are able to figure out the types!