graphql-compose: TypeError: Cannot read property 'getTypeName' of undefined

graphql-compose: TypeError: Cannot read property 'getTypeName' of undefined

我正在试用 graphql-compose 库并遵循他们的 Getting started Github page,我构建了一个非常简单的示例。

这是我的代码:

    import { schemaComposer } from "graphql-compose";

    export const UserTC = schemaComposer.createObjectTC({
      name: "UserTC",
      fields: {
        name: "String",
        surname: "String"
      }
    });

    UserTC.addResolver({
      kind: "query",
      name: "userFind",
      resolve: async () => {
       return []; // empty array
      }
    });

    schemaComposer.Query.addFields({
      userFind: UserTC.getResolver("userFind")
    });

    export const schema = schemaComposer.buildSchema()

当我将返回的架构对象传递给
时出现以下错误 我的阿波罗服务器:

TypeError: Cannot read property 'getTypeName' of undefined

错误堆栈指向我代码的最后一行。我想不通 我做错了什么。

感谢您的帮助。

我可能看不出我在做什么错误

将 "type" 添加到解析器:

UserTC.addResolver({
  kind: "query",
  name: "userFind",
  type: UserTC,
  resolve: async () => {
   return []; // empty array
  }
});