Issue with generated types

default discord avatar
Jarrod
8 months ago
4

Hey @Plain134 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
    Plain134
    8 months 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!

  • default discord avatar
    Jarrod
    8 months ago

    you can use the depth



    its a parameter

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.