I'm using Apollo Server and Apollo Client with React Native and TypeScript. I'm trying to do my error handling via GraphQL unions but don't know how to type these. Looking at the example underneath, I want the result type for the useQuery hook to cover both graphql fragments. Is there any way to do so? Thanks.
const GET_USER = gql` query GetUser ($id: String!) { user(id: $id) { ... on User { email, username } ... on Error { message } } }`;