Allow Boolean(val) &&
to refine val
the same as val &&
#45601
Labels
Duplicate
An existing issue was already created
Suggestion
π Search Terms
boolean refinement
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Boolean(x) && x.y
should be identical to!!x && x.y
as far as the type system is concernedπ» Use Cases
use case: boolean return value along with style guides that promote
Boolean(val)
vs!!val
The one issue I could theoretically see is someone weirdly overwriting
Boolean
and introducing side-effects. But talk about edge cases!I can re-write this as
Boolean(x?.y)
, but that's not as clear IMO.The text was updated successfully, but these errors were encountered: