Selectors
Generate Reusable Selection Sets
In TypeScript Zeus can help make type-safe Zeus selection sets to reuse across queries.
import { Selector, Chain } from './zeus';
const chain = Chain('https://faker.graphqleditor.com/a-team/olympus/graphql');
const cardSelector = Selector('Card')({
name: true,
description: true,
Attack: true,
skills: true,
Defense: true,
cardImage: {
key: true,
bucket: true,
},
});
const queryWithSelectionSet = await chain('query')({
drawCard: cardSelector,
});Inferring the response type
Sometimes you might want to infer the response type, for that it is best to use selectors:
Last updated
Was this helpful?