I have a this graphql query:
import { graphql } from '../__generated__/gql';
// typeof IndexPageQuery is unknown
const IndexPageQuery = graphql(`
query IndexPageQuery {
user {
...UserInputFragment
}
}
${UserInputFragment}
`);
And when i run this code:
const { data } = await apolloClient.query(IndexPageQuery);
TS throw error:
Argument of type 'unknown' is not assignable to parameter of type 'QueryOptions<OperationVariables, any>'.ts(2345)
Why IndexPageQuery
always has type unknown
? Does anyone know what I'm doing wrong? Thanks
UnknownFragment: "UserInputFragment"
from useQuery(). If I do not refer to the fragment by including the variable anymore, where/how do I properly define the fragment so that it is definitely considered and auto-included by the GraphQL Code Generator? – Mohammedanism