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.

TS Typing for Blocks

default discord avatar
knownasred2 years ago
2

Hi!


First of all, thanks a lot for the amazing work! Currently in the process of evaluating PayloadCMS as a Prismic replacement, due to self-hosting needs.


One question I had was with the typescript typings generation for blocks.


I have the same blocks present within multiple Field across collections, and while in the GraphQL output, the Blocks are typed with an explicit notation, it is not the case for the typescript ones, that instead inlines all the possibilities.


Is there a reason for that, or just an oversight?



Thanks in advance for your help!



Small bump ^^


I have a workaround that is based on creating the types myself, but it is not the most optimal workflow

  • discord user avatar
    denolfe
    2 years ago

    As of now, the type generation looks at each collection one at a time and types it all the way through, with the exception of relationships. We've heard feedback regarding the block typing being inline instead of shared across all usages. This is definitely something that we could improve in the future - not currently in our roadmap, though.



    Feel free to submit a feature request, so we can discuss/prioritize with everyone.



    https://github.com/payloadcms/payload/discussions
  • default discord avatar
    knownasred2 years ago

    Thanks!


    Will do when I have some time ^^



    Done, it's available here ^^


    https://github.com/payloadcms/payload/discussions/2617
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.