Open
Description
What version of @strapi/blocks-react-renderer
are you using?
What's Wrong?
The following types aren't exported: TextInlineNode
, ParagraphBlockNode
, QuoteBlockNode
, CodeBlockNode
, HeadingBlockNode
, ListBlockNode
, and ImageBlockNode
;
This will help iterate over the nodes like:
type Child = React.ReactElement<TextInlineNode>;
React.Children.map(children, (node) => {
if (React.isValidElement(node)) {
const {props: {code, text}, ...props} = node as Child;
if (node.type !== 'text') {
return node;
}
}
return node;
});
To Reproduce
Expected Behaviour
Workaround
// HeadingBlockNode
import type {RootNode, GetPropsFromNode} from '@strapi/blocks-react-renderer/dist/BlocksRenderer';
type HeadingBlockNode = Extract<RootNode, {type: 'heading'}>;
type Props = GetPropsFromNode<HeadingBlockNode>;
// ...