#TS Typing for Blocks

5 messages · Page 1 of 1 (latest)

wispy raft
#

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!

wispy raft
#

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

full mauve
#

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.

wispy raft
#

Thanks!
Will do when I have some time ^^