We followed the tutorial to generate types for grapqhl document https://www.datocms.com/blog/how-to-generate-typescript-types-from-graphql, and it works great, except for structuredtext ; value is a JsonField, which translate to unknown given the advised graphql-codegen config.
is there any workaround ?
Hello @cedric1 and welcome to the community!
I know it may seem odd but that is indeed the recommended type for that field, as we can’t really narrow down the type any further than that due to the nature of Dast
While rendering it though, we do provide some checks that can help type potential existing nodes inside the field, they are more detailed right here: https://github.com/datocms/structured-text/tree/main/packages/utils#typescript-types
It does not help / solve the issue ; what I love with DATO, graphql & TS is that when I change something in DATO, I can generate new types and be confident nothing will break without me knowing.
StructuredText custom blocks can’t be safely generated / typed and will always remain a danger.
Or am I missing something ?
Exactly @cedric1 , for now custom blocks inside structured text can’t be inferred from the structured text value type