No JS tool (that I know of) will warn you about these conditions being impossible. But they should. const foo = 'FOO'; if (foo[0] === 'B') {} // impossible if (foo === 'BAR') {} // impossible
-
-
Good point
Maybe @drosenwasser or@SeaRyanC could explain why type guards only narrow down the type in an `if` statement and not in a boolean function. -
Automatically inferring functions as type predicates - could break code - is not always the intent - is detectable for some simple cases, but can be expensive for the hard ones so it might not be consistent To be honest I get why Flow also went with opt-in.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 