import type { GraphQLError } from 'graphql' ; export interface DeferredPromise < T > { promise : Promise < T > ; resolve : ( value : T ) => void ; reject : ( reason : unknown ) => void ; } export function createDeferredPromise < T = void > ( ) { let resolve = undefined as any ; let reject = undefined as any ; const promise = new Promise < T > ( ( resolveFn , rejectFn ) => { resolve = resolveFn ; reject = rejectFn ; } ) ; return { promise , resolve , reject , } ; } export type GQLResponse < T extends Record < string , unknown > = Record < string , unknown > > = { data : T | null ; errors ? : GraphQLError [ ] ; } ;