title: How should I do an Enum comparison in typescript
body: <p>I have a jhipster project and they just chanced the enum from this:</p>
  
  <pre><code>export enum DeclarationStatus {
    NEW = 'NEW',
    DRAFT = 'DRAFT',
    APPROVED_BY_FREELANCER = 'APPROVED_BY_FREELANCER',
    APPROVED_BY_CLIENT = 'APPROVED_BY_CLIENT',
    APPROVED = 'APPROVED'
  }
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>export enum DeclarationStatus {
    NEW,
    DRAFT,
    APPROVED_BY_FREELANCER,
    APPROVED_BY_CLIENT,
    APPROVED
  }
  </code></pre>
  
  <p>First I could do a comparison like this:</p>
  
  <pre><code>status === DeclarationStatus.APPROVED_BY_FREELANCER;
  </code></pre>
  
  <p>But now that does not work any more because the enum is actually a number. This does work how ever:</p>
  
  <pre><code>DeclarationStatus[''+status] === DeclarationStatus.APPROVED_BY_FREELANCER;
  </code></pre>
  
  <p>So my question is which is better. Or is there even a 3rd option?</p>
  
  <hr>
  
  <p>I set this question to answered. The Jhipster community reverted the change to initialized. So then comparison is easy again.</p>
  
  <p>Thanks to @vicpermir who made it happen.</p>