如何定义多态(参数化)GraphQL类型?

如何定义多态(参数化)GraphQL类型?,graphql,Graphql,我希望所有的Mutation方法返回一个实现MutationResult类型的结果: interface MutationResult { errors: [UserError]! } 例如: type AuthenticateMutationResult implements MutationResult { errors: [UserError]! user: User } type Mutation { authenticate ( email: String!

我希望所有的
Mutation
方法返回一个实现
MutationResult
类型的结果:

interface MutationResult {
  errors: [UserError]!
}
例如:

type AuthenticateMutationResult implements MutationResult {
  errors: [UserError]!
  user: User
}

type Mutation {
  authenticate (
    email: String!
    password: String!
  ): AuthenticateMutationResult!
}
为每个变异创建
…MutationResult
,将创建大量样板代码

是否有方法定义可配置类型,例如

type MutatationResult<fieldName, fieldType> = {
  [fieldName: fieldName]: fieldType
};
type mutationresult={
[字段名:字段名]:字段类型
};
这将允许我内联突变结果类型:

type Mutation {
  authenticate (
    email: String!
    password: String!
  ): MutatationResult<'user', User>!
}
型突变{
鉴定(
电子邮件:字符串!
密码:字符串!
):突变结果!
}
中是否存在多态类型的语法