remorses / genql

Type safe TypeScript client for any GraphQL API
https://genql.dev
MIT License
872 stars 37 forks source link

Export possibleTypes #172

Open knorke132 opened 4 months ago

knorke132 commented 4 months ago

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

linear[bot] commented 4 months ago

GEN-27 Export possibleTypes