I want to write some generic mappings that maps from payload's types to props for my frontend React components. Blocks and groups aren't exposed at the top level, so I'm having to manually pick them out by unpacking arrays and extracting specific blocks.
Is it possible to expose these when generating types? Or is there a simpler way for me to define these types based on the generated typings?
Hey
@173581681058512897, have you seen how this is done in our website repo? This might be a pattern you would benefit from.
https://github.com/payloadcms/website/blob/main/src/components/RenderBlocks/index.tsxtype ColTextMedia = Extract<
Required<MyCollection>['content'][0],
{blockType: 'col-text-media'}
>;
Had to add the required for it to work, ts 4.9.5
Star
Discord
online
Get dedicated engineering support directly from the Payload team.