/* eslint-disable */ import { DocumentTypeDecoration, ResultOf } from '@graphql-typed-document-node/core' import { Incremental, TypedDocumentString } from './graphql' export type FragmentType> = TDocumentType extends DocumentTypeDecoration ? [TType] extends [{ ' $fragmentName'?: infer TKey }] ? TKey extends string ? { ' $fragmentRefs'?: { [key in TKey]: TType } } : never : never : never // return non-nullable if `fragmentType` is non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> ): TType // return nullable if `fragmentType` is undefined export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> | undefined ): TType | undefined // return nullable if `fragmentType` is nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> | null ): TType | null // return nullable if `fragmentType` is nullable or undefined export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: FragmentType> | null | undefined ): TType | null | undefined // return array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> ): Array // return array of nullable if `fragmentType` is array of nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> ): ReadonlyArray // return readonly array of nullable if `fragmentType` is array of nullable export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> | Array>> | ReadonlyArray>> | null | undefined ): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any } export function makeFragmentData< F extends DocumentTypeDecoration, FT extends ResultOf, >(data: FT, _fragment: F): FragmentType { return data as FragmentType } export function isFragmentReady( queryNode: TypedDocumentString, fragmentNode: TypedDocumentString, data: FragmentType, any>> | null | undefined ): data is FragmentType { const deferredFields = queryNode.__meta__?.deferredFields as Record const fragName = fragmentNode.__meta__?.fragmentName as string | undefined if (!deferredFields || !fragName) return true const fields = deferredFields[fragName] ?? [] return fields.length > 0 && fields.every((field) => data && field in data) }