How do I specify a graphql type that takes multiple types? : <p>I want to create a graphql type that can return either an <code>Array of Integers</code> or <code>String</code>.</p>

<p>I've already tried using union in the form
<code>union CustomVal = [Int] | String</code>, but this returns an error.</p>

<p>The schema declaration is:</p>

<pre><code>union CustomValues = [Int] | String

type Data {
    name: String
    slug: String
    selected: Boolean
    values: CustomValues
}
</code></pre>

<p>The error is:</p>

<pre><code>node_modules/graphql/error/syntaxError.js:24
return new _GraphQLError.GraphQLError('Syntax Error: ' + description, undefined, source, [position]);
Syntax Error: Expected Name, found [
GraphQL request (81:23)
80: 
81:     union CustomValues = [Int] | String
</code></pre>

<p>Is this possible to do in graphql? If not, can you please suggest an alternative to do this.</p>

<p>I ask this as the union documentation says that <code>Note that members of a union type need to be concrete object types; you can't create a union type out of interfaces or other unions.</code></p>

<p>Any solutions would be highly helpful.</p>
