title: Generate typed dictionary with a for loop using an enum as key type but without using `?` to mark undefined in TypeScript
body: <p>The problem is that I want to use enum as key for a dictionary but I want to dynamically generate the entries using a loop. But I will prefer not to use <code>?</code> operator because I know I'll fill all keys and I don't want to force <code>!</code> evaluation for each call.</p>
  <pre class="lang-js prettyprint-override"><code>enum Students {
    A,
    B,
    C,
  // many many students
  }
  
  // class Info(); // some properties like grades and teacher
  
  const studentInfo: { [key in Students]: Info }; // won't work const must be initialized
  const studentInfo: { [key in Students]: Info } = {}; // won't work as all keys are not defined
  const studentInfo: { [key in Students]?: Info } = {}; // I want to avoid ?
  
  for (let name of Students) {
    // get info from some db
    { grade, teacher } = lookUp(name)
  
    // initialize dictionary keys
    studentInfo[name] = Info(grade, teacher);
  }
  
  studentInfo.A!.name; // I want to avoid !
  </code></pre>
  <p>Is there anyway to use the key itself to generate the dictionary so that the type signatures checkout. Maybe something like <code>const studentInfo = { key for key in Students | .... };</code></p>
  <p>I have checked out other answers which have led me to this somewhat specific questions. I'm still new to TypeScript, so still figuring out the rope but I'm really liking it.</p>