title: TypeScript: Describe Object of Objects
body: <p>Say I have an interface like this:</p>
  
  <pre><code>interface Student {
    firstName: string;
    lastName: string;
    year: number;
    id: number;
  }
  </code></pre>
  
  <p>If I wanted to pass around an array of these objects I could simply write the type as <code>Student[]</code>.</p>
  
  <p>Instead of an array, I'm using an object where student ids are keys and students are values, for easy look-ups.</p>
  
  <pre><code>let student1: Student;
  let student2: Student;
  let students = {001: student1, 002: student2 }
  </code></pre>
  
  <p><strong>Is there any way to describe this data structure as the type I am passing into or returning from functions?</strong></p>
  
  <p>I can define an interface like this:</p>
  
  <pre><code>interface StudentRecord {
    id: number;
    student: Student
  }
  </code></pre>
  
  <p>But that still isn't the type I want. I need to indicate I have an object <em>full of objects</em> that look like this, the same way <code>Student[]</code> indicates I have an array full of objects that look like this.</p>