无法理解此错误意味着什么

时间:2019-07-12 18:12:13

标签: graphql graphql-js

enter image description here我正在尝试创建graphql模式指令,并尝试将其添加到makeExecutableSchema中,并且发生以下错误。有谁可以帮助我了解此错误或解决该错误。

const templateDirective = require('../index');

// Define your schema and resolvers if needed

const typeDefs = `
  type Query {
    me(): Me @templateDirective
  }
`;

const resolvers = {
  Query: {
    me: () => false,
  },
};

module.exports = makeExecutableSchema({
  typeDefs,
  resolvers,
  schemaDirectives: {
    templateDirective,
  },
});

1 个答案:

答案 0 :(得分:0)

您的文档中存在语法错误。如果字段不带任何参数,则必须省略括号,并且不能仅在字段名后面加上一组空括号。更正的文档:

type Query {
  me: Me @templateDirective
}