title: How to get a type of enum from the string in typescript?
body: <p>I have an enum:</p>
  
  <pre><code>export enum Suit {
    SPADES = "SPADES", 
    HEARTS = "HEARTS", 
    DIAMONDS = "DIAMONDS", 
    CLUBS = "CLUBS"
  }
  </code></pre>
  
  <p>And then when I try to use it:</p>
  
  <pre><code>for(let suit in Suit) {
      console.log(suit);
      console.log(typeof suit);
      const theSuit: Suit = Suit[suit];
  }
  </code></pre>
  
  <p>VS code gives compilation error at <code>theSuit</code> says: <code>Type 'string' is not assignable to type 'Suit'</code>.</p>
  
  <p>The typescript version is 3.2.2</p>
  
  <p>How should I get a type of <code>Suit</code> from the string?</p>