I Want to syntax highlight the code inside typeDef. It is possible?
There is a extension for this? Or I have to code the typeDef other way?
export const
Assuming you're using the right extension, you need to use the gql
tag from graphql-tag
.
const gql = require('graphql-tag')
const typeDefs = gql`
type User { ... }
`
The tag parses the provided string and returns a DocumentNode
object, which is what should be passed to makeExecutableSchema
or the ApolloServer
constructor. On the client side, the queries used by ApolloClient are also expected to be DocumentNode
objects and should be wrapped the same way.
The extension is able to detect usage of the tag and apply syntax highlighting accordingly.