Open imjordanxd opened 5 hours ago
Any more reproduction?
With React 18.3+ and TypeScript 5.4+, it is possible to return a string
in a Component now. Your current reproduction can be simplified without fragments:
function Foo() {
return ' ';
}
@SukkaW unfortunately, that won't work.
is a reserved entity in HTML. React handles strings for us. It's the same reason we can't return '<div>Hello, world</div>'
. We wouldn't expect that to work! Here's a codesandbox.
@SukkaW unfortunately, that won't work.
is a reserved entity in HTML. React handles strings for us. It's the same reason we can't return'<div>Hello, world</div>'
. We wouldn't expect that to work! Here's a codesandbox.
Then it would be:
function Foo() {
return ' ';
}
or
function Foo() {
return '\xA0';
}
Most modern compilers (esbuild, swc) will transform alone
.
Describe the bug
The following code produces an error but is a false positive:
Reproduction
No response
Expected behavior
An error should not be reported in this case.
Platform and versions
Stack trace
No response
Additional context
No response