false and undefined are members so condition && Text('…') reads the way
it does in JSX and renders nothing when the condition fails. v1 allows both
for that reason, and a conditional written that way is how its users write
one — dropping it would break the idiom rather than tidy it.
null and '' are members for the same reason, measured against React
19.2.8 rather than assumed.cond ? <X/> : null is the other half of that
idiom and the spelling a ternary produces, and '' is what an empty string
out of data looks like; React renders nothing for either. Both were type
errors that also threw at runtime, so the two spellings of one conditional
behaved differently — && worked and ? : did not.
true is a member too, and for a spelling rather than for its own sake.cond || node yields true when cond is a truthy boolean, which is the
same half-of-an-idiom asymmetry as ? : — and React skips it. Admitting
false while rejecting true would leave one spelling of a conditional
working and its neighbour throwing, which is the shape this widening exists
to remove.
0 is deliberately not a member. React renders it as the text 0, which
is a different decision from skipping it, and a caller who writes
items.length && … meaning "when there are items" would get a visible zero
rather than nothing. It stays an error, and the error is where to say so.
NaN and 0n render there too — measured, not assumed — and are out for the
same reason. An empty array needs no member: it flattens to nothing already.
Skipping 0 silently would make this looser than React in the one
direction where looser means quieter.
Anything that can sit inside a container.
falseandundefinedare members socondition && Text('…')reads the way it does in JSX and renders nothing when the condition fails. v1 allows both for that reason, and a conditional written that way is how its users write one — dropping it would break the idiom rather than tidy it.nulland''are members for the same reason, measured against React 19.2.8 rather than assumed.cond ? <X/> : nullis the other half of that idiom and the spelling a ternary produces, and''is what an empty string out of data looks like; React renders nothing for either. Both were type errors that also threw at runtime, so the two spellings of one conditional behaved differently —&&worked and? :did not.trueis a member too, and for a spelling rather than for its own sake.cond || nodeyieldstruewhencondis a truthy boolean, which is the same half-of-an-idiom asymmetry as? :— and React skips it. Admittingfalsewhile rejectingtruewould leave one spelling of a conditional working and its neighbour throwing, which is the shape this widening exists to remove.0is deliberately not a member. React renders it as the text0, which is a different decision from skipping it, and a caller who writesitems.length && …meaning "when there are items" would get a visible zero rather than nothing. It stays an error, and the error is where to say so.NaNand0nrender there too — measured, not assumed — and are out for the same reason. An empty array needs no member: it flattens to nothing already. Skipping0silently would make this looser than React in the one direction where looser means quieter.