Type guards fail in switch (true)
constructs.
#16887
Labels
Duplicate
An existing issue was already created
switch (true)
constructs.
#16887
Sometimes it's nice to use
switch (true)
along with boolean expressioncase
clauses to make code cleaner than a bunch ofif/else
statements. Unfortunately, type guards do not work here:TypeScript Version: 2.3.1
Code
Expected behavior:
All forms should compile.
Actual behavior:
The
switch (true)
forms do not compile.The text was updated successfully, but these errors were encountered: