类型 graphql - 将 createUnionType 设置为 InputType

Type graphql - set createUnionType as InputType

我正在使用 type-graphql 框架并且我配置了一个联合类型,如下所示:

export const ActionUnion = createUnionType({
  name: 'ActionUnion',
  types: () => [CreateAction, UpdateAction, DeleteAction],
});

我想用它作为我的突变输入。 但是当我 运行 服务时,我收到一条错误消息:

Cannot determine GraphQL input type for userActions

有没有办法将 unionType 也配置为 InputType?

提前致谢。

不,在 GraphQL 规范中,联合仅适用于对象类型。你不能有联合输入。