I have the following graphql query
const GET_USER = gql`
query user() {
user {
firstName
lastName
}
}
`
I traverse through the query to find the type of the firstName
& the lastName
field using visit
function provided by graphql
visit(GET_USER, {
Field(node) {
console.log(node)
}
}
it looks like the fields contain only the following information.
{
kind: 'Field',
alias: undefined,
name: { kind: 'Name', value: 'firstName' },
arguments: [],
directives: [],
selectionSet: undefined
},
{
kind: 'Field',
alias: undefined,
name: { kind: 'Name', value: 'lastName' },
arguments: [],
directives: [],
selectionSet: undefined
}
which doesn't tell me the type of firstName
& lastName
I am expecting that I will probably have to make use of the related schema file
to get the types of that query but I am not sure how to do that, if anyone can help me with that, that would be great.