title: Typescript type mapping to expect an object where every property is of a given type
body: <p>In typescript I have an interface of type X. I have a method that expects an object with an arbitrary number of properties, but every property must be of type X. For example both of these would be valid to pass as parameters:</p>
  
  <pre><code>interface IJays {
      jim: X;
      jone: X;
      jan: X;
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>interface IBees {
      bill: X;
      bob: X;
      betty: X;
  }
  </code></pre>
  
  <p>but this would NOT be a valid type to pass as a parameter:</p>
  
  <pre><code>interface ISees {
      claude: X;
      carol: boolean;
      clem: number;
  }
  </code></pre>
  
  <p>In this case, the name of the properties are important, too (they get used in the processing).</p>
  
  <p>It would be great if I could use a different data structure, but this is the structure that is coming from some API. I don't have a finite list of all the interfaces, either. As the project grows, there will be any number of interfaces that follow this pattern.</p>
  
  <p>Currently, I have this property typed as "any", but I would really like to have it as a specific type to prevent future errors (this is the kind of thing that is prone to errors in the future).</p>
  
  <p>Is there a way to specify this as a type in typescript? Essentially, an arbitrary object where each property of that object is of a specific type? Perhaps using the new <a href="https://github.com/Microsoft/TypeScript/wiki/What&#39;s-new-in-TypeScript#mapped-types" rel="nofollow noreferrer">Mapped Types</a> feature?</p>