Comment in JSX counted as a child when it shouldn't be #41125
Labels
Fix Available
A PR has been opened for this issue
Needs Investigation
This issue needs a team member to investigate its status.
Milestone
TypeScript Version: Nightly
Search Terms: React, JSX, Comment, React.ReactElement
Code
Expected behavior: The
{/* comment */}
should be ignored by the type checker as it is completely stripped away when the JSX is compiledActual behavior: The comment is considered a child of
Wrapper
and a type error is thrown asWrapper
expects a singleReact.ReactElement
childPlayground Link: https://www.typescriptlang.org/play?ts=4.1.0-dev.20201015#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQFA3AB2MWUBeWcACsWOgN404QuLgAWwADYATSgwBcmKjAB02PDACiErCCxMaAXzoEArg3zAIDOAHUoyMGBYAKMD1QLuEXgEo4A4ThKGBMoawAeKWAANwA+PjdvVGUxSRk9A3CAeii4wzpcK1R4LG1dJjgAXjhnQWFwuwcnKFi6oT4spEKQcvgELKNAuEiY2IAJUokIbNzWwOzGxxZWnyA
Related Issues: N/A
The text was updated successfully, but these errors were encountered: