Say I have two union types like so:
import { createUnionType } from "type-graphql";
const InstagramUnion = createUnionType({
name: "Instagram",
types: () => [InstagramWidget1, InstagramWidget2] as const,
});
const SpotifyUnion = createUnionType({
name: "Spotify",
types: () => [SpotifyWidget1, SpotifyWidget2] as const,
});
Currently, I'm unable to create a union of the above two unions:
const WidgetUnion = createUnionType({
name: "Widget",
types: () => [SpotifyUnion, InstagramUnion] as const, // error, not assignable
});
Is it possible to do this? Basically, I need a resultant union that looks like this:
InstagramWidget1 | InstagramWidget2 | SpotifyWidget1 | SpotifyWidget2
No, it's not possible in any GraphQL implementation as it's not supported by GraphQL spec.