Hi!
I found the ability to put GraphQL responses directly into <StructuredText />
component to be really useful and I love to use it.
However, while I was working on adding a new block to my post I noticed the weird type error happening. I added a new entry to blocks
but the type error suggested that I have a mistake on links
.
After some research I found out this code piece:
export declare type StructuredText<R extends Record = Record> = {
/** A DatoCMS compatible document */
value: Document;
/** Blocks associated with the Structured Text */
blocks?: R[];
/** Links associated with the Structured Text */
links?: R[];
};
This model of structured text is incorrect because not all block records are necessarily valid link records. For example, if I allowed articles to be linked but not say, tweets, it would cause problems because the properties of those two donβt match up yet they have to be the same type.
Iβve been able to fix this for myself using patch-package
, but it would be great to see this being fixed on upstream too.