import type { WithPopulated } from '@byline/client' import type { DocsFields, MediaFields, PagesFields } from '@byline/generated-types' type ContentBlockOf = NonNullable extends Array ? Block : never type ContentBlock = ContentBlockOf | ContentBlockOf type PhotoBlockData = Extract type PopulatePhotoBlock = Block extends PhotoBlockData ? WithPopulated : Block type PopulatePhotoBlockContent = Content extends Array ? Array> : Content /** Photo block shape returned by reads that populate the `photo` relation. */ export type PopulatedPhotoBlockData = WithPopulated export type PopulatedContentBlock = PopulatePhotoBlock /** Overlay populated photo blocks while preserving each consumer's content union. */ export type WithPopulatedPhotoBlockContent = { [Key in keyof Fields]: Key extends 'content' ? PopulatePhotoBlockContent : Fields[Key] }