Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Issue with generated types

discord user avatar
jarrod_not_jared
2 years ago
2

Hey

@349904487483179010

the reason the type is generated like that due to

depth

if you have a relationship field on a collection, query that collection with

depth=0

like in this post:

https://discord.com/channels/967097582721572934/1073557500751773696

Here is a typeguard solution to assist you on the frontend:

https://discord.com/channels/967097582721572934/1061947681448153188
  • default discord avatar
    plainnn2 years ago

    Ahh, i'm using the payload package to query in next

    GetServerSideProps

    so can't query with depth (I don't think) - no worries, for now I'll use

    const {image} = page.props as Media

    where necessary and just update the generated file



    Thanks!

  • discord user avatar
    jarrod_not_jared
    2 years ago

    you can use the depth



    its a parameter

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.