-
-
Notifications
You must be signed in to change notification settings - Fork 921
Closed as not planned
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes
Description
Initial checklist
- I read the support docs
- I read the contributing guide
- I agree to follow the code of conduct
- I searched issues and discussions and couldn’t find anything (or linked relevant results below)
Affected package
react-markdown@9.0.3
Steps to reproduce
In a typescript project, do this:
const description: string = '# 123';
<Markdown>{description}</Markdown>
// or
<Markdown children={description} />Actual behavior
Assertion
Unexpected value 123 for children prop, expected string
Expected behavior
A string should be treated as a string.
Initial investination
The problem appears in this code:
By default, the children prop is an array, and that's a designed by React behavior. Instead of throwing an error, it can be parsed, i.e., using the .join() method in case of an array. It's impossible to pass a string as the children prop in such a way that React won't convert it to an array.
Runtime
Chrome 133.0.6943.54 (Official Build) (64-bit), node@22.13.0
Package manager
yarn@1.22.19, npm@11.1.0
Operating system
Microsoft Windows 11 24H2 (Build 26100.3037)
Build and bundle tools
webpack
Metadata
Metadata
Assignees
Labels
👎 phase/noPost cannot or will not be acted onPost cannot or will not be acted on🙋 no/questionThis does not need any changesThis does not need any changes

