API

unionType

unionType

GraphQL Docs for Union Types

Union types are very similar to interfaces, but they don't get to specify any common fields between the types.

1const MediaType = unionType({
2 name: 'MediaType',
3 description: 'Any container type that can be rendered into the feed',
4 definition(t) {
5 t.members('Post', 'Image', 'Card')
6 },
7 resolveType: (item) => item.name,
8})

Check the type-definitions or the examples for a full illustration of the various options for unionType, or feel free to open a PR on the docs to help document!

Edit this page on Github
Content