One thing you could do is have something like, say Film.js:
exports.toString = `
type Film {
characters(): [Character]
}
`
exports.characters = function (film, args) { ... }
Then in a root Schema.js:
var Schema = require('graph.ql')
var Film = require('./film.js')
Schema(`
${Film.toString()}
`, {
Film: Film
}
A couple notes:
Film.toString()
since it should coerce to a string by callingtoString()
toString
in the Film object