Introduction to Union Types
Learn about GraphQL union types and their use cases.
We'll cover the following...
So far, we have looked at two queries that return consistent data types. Both the books
and booksWithTitle
fields return an array of Book
objects. But how do we make our client support cases where a GraphQL field could potentially return different types of objects for the same query? Union types help us solve this ...