I created this typescript file to show the problem:
enum E {
one,
two
}
console.log(E.one)
console.log(E.two)
let n: E = E.one
if (n === E.one) console.log("equal");
if (n === E.two) console.log("equal");
I get compile error from tsc on second if:
test.ts:11:5 - error TS2367: This condition will always return 'false' since the types 'E.one' and 'E.two' have no overlap.
I can't find out why it is happening. Am I doing something wrong?