title: How do I check that a switch block is exhaustive in TypeScript?
body: <p>I have some code:</p>
  
  <pre><code>enum Color {
      Red,
      Green,
      Blue
  }
  
  function getColorName(c: Color): string {
      switch(c) {
          case Color.Red:
              return 'red';
          case Color.Green:
              return 'green';
          // Forgot about Blue
      }
  
      throw new Error('Did not expect to be here');
  }
  </code></pre>
  
  <p>I forgot to handle the <code>Color.Blue</code> case and I'd prefer to have gotten a compile error. How can I structure my code such that TypeScript flags this as an error?</p>