4
lorentz
3y

When elements of an union are distinguished by a boolean, VSCode's Typescript plugin can only do type elimination if I branch by "== true" and not if I just branch by the boolean.
This is because Typescript treats booleans as an union of the constants "true" and "false", and compile-time elimination can only be done if I use syntax that makes sense with unions. Logical evaluation, for some reason, doesn't.
The fact that this issue can even appear is deeply concerning.

Comments
Add Comment