title: TypeScript Error with Generator
body: <p>I'm getting errors when trying out this TypeScript in VSCode:</p>
  
  <pre><code>enum Desg {
      Consultant,
      Engineer
  };
  
  interface Employee {
      Name: string;
      Role: Desg;
  }
  
  let names: string[] = ['Sunit', 'Duke'];
  //Complains about Name property missing
  function* getEmp(): Employee {
      for (let n in names) {
          if (n === 0) //Complains here about n being string
              yield { Name: names[n], Role: Desg.Consultant }
          else
              yield { Name: names[n], Role: Desg.Engineer }
      }
  }
  
  for (let n of getEmp()) {
      console.log(`${n.Name} is ${n.Role}`);
  }   
  </code></pre>
  
  <p>Can someone please enlighten...</p>