Skip to content

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

Open
@btray77

Description

@btray77

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions