In TypeScript, I want to compare two variables containing enum values. Here\'s my minimal code example:
enum E { A, B } let e1: E = E.A let e2: E = E.B if (
The only thing that worked for me (in typescript 2.2.1) was this:
if (E[e1] === E[e2]) { console.log("equal") }
This compares the strings representing the names (eg. "A" and "B").