missing type for domNode.children
alex4brandung opened this issue · 4 comments
alex4brandung commented
I set up the following options:
const options: HTMLReactParserOptions = {
replace(domNode: DOMNode) {
if ((domNode as Element).attribs && (domNode as Element).name === 'a') {
const props = attributesToProps((domNode as Element).attribs);
return (
<a className={'text-heaven'} {...props}>
{domToReact((domNode as Element).children, options)}
</a>
);
}
},
};I am getting the following Error in my IDE:
remarkablemark commented
alex4brandung commented
I import it as es6 module...
alex4brandung commented
{domToReact((domNode as Element).children as DOMNode[], options)}fixed it! Thanks for the hint!
cini9 commented
Hey @alex4brandung thanks for the awesome lib. I'm still getting some typescript errors using domToReact in NextJS 13. My html-react-parser version is 5.1.7 and this is my code :
Any ideas on how to fix this ? Thanks !
EDIT February 2024 :
I found this resource to help out : https://gist.github.com/natterstefan/3bc712eca6ff88781d687b7240a78cc1
And when I imported Element from html-react-parser, it fixed the issue. Thanks again !


