title: Typescript variable used before being assigned
body: <p>I'm seeing an error in my Typescript / ReactJS project saying <code>Variable 'myVar' is used before being assigned.  TS2454</code></p>
  <p>I'm running TS version 4.2.3, and this error shows up in my IDE as well as when I try to run the code. However, it works fine in jsFiddle (<a href="https://jsfiddle.net/d79L4ju8/" rel="nofollow noreferrer">https://jsfiddle.net/d79L4ju8/</a>) and I don't understand why the error would be thrown, since it seems like the variable is declared and checked:</p>
  <pre><code>interface testType {
      id: string,
      message: string,
  }
  
  let requestType = 'eventCreated';
  let testVar = true;
  let myVar: testType;
  
  if (testVar) {
      myVar = {
          id: 'abc123',
          message: 'message goes here',
      }
  }
  
  switch (requestType) {
      case 'eventCreated':
          if (myVar !== undefined) { // error thrown here
              console.log(myVar);
          }
          break;
      case 'eventChanged':
          if (myVar !== undefined) {
              console.log(myVar);
          }
          break;
  }
  </code></pre>
  <p>What's causing this to fail?</p>