hasura / gatsby-gitbook-starter

Generate GitBook style modern docs/tutorial websites using Gatsby + MDX
https://hasura.io/learn/graphql/react/introduction/
MIT License
981 stars 382 forks source link

Potential Error in appendString in mdxComponents/index.js #123

Open btray77 opened 2 years ago

btray77 commented 2 years ago

const appendString = (children) => { if (Array.isArray(children)) { return children.reduce((acc, current) => { if (typeof current === 'string') { return acc.concat(current); } else if (typeof current === 'object') { return acc.concat(current.props.children); } else { return acc; } }, ''); } else { return children + ''; // <-- Fix } }; It doesn't necessarily return a string type all the time, so have to force string.