How do I specify a graphql type that takes multiple types?

Follow this https://github.com/facebook/graphql/issues/215, Graphql does not support scalar union types currently, you can do this

union IntOrString = IntBox | StringBox

type IntBox {
  value: Int
}

type StringBox {
  value: String
}

or you can have your custom type, see this graphql, union scalar type?

Leave a Comment