Latest
class GraphQLUnionType
import { GraphQLUnionType } from "https://dotland.deno.dev/x/graphql_deno@v15.0.0/lib/index.js";

Union Type Definition

When a field can return one of a heterogeneous set of types, a Union type is used to describe what types are possible as well as providing a function to determine which type is actually used when the field is resolved.

Example:

const PetType = new GraphQLUnionType({
  name: 'Pet',
  types: [ DogType, CatType ],
  resolveType(value) {
    if (value instanceof Dog) {
      return DogType;
    }
    if (value instanceof Cat) {
      return CatType;
    }
  }
});

Constructors

new
GraphQLUnionType(config)

Properties

readonly
[SYMBOL_TO_STRING_TAG]