Let's say I want pass refetch function as a prop on a component, and this is what I am doing.
import { ApolloQueryResult } from "apollo-client"
interface MyQueryVariables{ ... }
interface MyQueryResult{ ... }
interface Props {
refetch: (
variables?: MyQueryVariables | undefined
) => Promise<ApolloQueryResult<MyQueryResult>>
}
I have to
- find refetch function type definition
- import required types and etcs. e.g.
ApolloQueryResult - write refetch prop as it is in ObservableQuery
, and I am thinking there has to be an easier way.
How would you define the same function type as a prop other than just copy things around like I do?