Introduction
Union types let you combine different object types into one. This helps when a field can return different kinds of data.
When a query can return different types of objects, like a search returning books or authors.
When you want to handle multiple related types in one response.
When you need to simplify your schema by grouping types that share no common fields.
When you want to write flexible queries that adapt to different data shapes.