genql icon indicating copy to clipboard operation
genql copied to clipboard

Export possibleTypes

Open knorke132 opened this issue 1 year ago • 1 comments

Some clients (like apollo) let you set supertype / subtype relations

const possibleTypes: PossibleTypesMap = {
  animal: ['Frog', 'Beaver'],
}

Usable values are already generated but not exported yet

const Animal_possibleTypes: string[] = ['Frog','Beaver']
export const isAnimal = (obj?: { __typename?: any } | null): obj is Animal => {
  if (!obj?.__typename) throw new Error('__typename is missing in "isAnimal"')
  return Animal_possibleTypes.includes(obj.__typename)
}

Would be great to have them exported

knorke132 avatar May 06 '24 07:05 knorke132