@miragejs/graphql
Version:
A library for handling GraphQL requests with Mirage JS
11 lines (10 loc) • 590 B
TypeScript
import type { GraphQLResolveInfo, GraphQLUnionType } from "graphql";
import type { QueryArgs, ResolverContext } from "../@types/index.js";
import type { TypedRecord } from "../orm/records.js";
/**
* Resolves a field that returns a union type. For each type in the union, it
* fetches records from Mirage's database.
*
* @see {@link https://graphql.org/learn/execution/#root-fields-resolvers}
*/
export default function resolveUnion(source: any, args: QueryArgs, context: ResolverContext, info: GraphQLResolveInfo, isList: boolean, type: GraphQLUnionType): TypedRecord | TypedRecord[];