title: Typescript - Better way to enforce an object's key type?
body: <p>I'm trying to figure out the syntax to define a type (interface) of an object's key.</p>
  
  <p>Couldn't find how to do it on StackOverflow or anywhere else.</p>
  
  <p>I have crafted this method, it works but I find it clumsy. Is there any "official" syntax for it?</p>
  
  <pre><code>interface Report {
      action: string;
      exists?: boolean;
      warnings? : string[];
      errors? : string[];
  }
  
  let patent: Patent = {
          numbers: { … },
          dates : { … },
          report: ( ():Report =&gt; ({ // This works, it enforces the key's type but looks ugly
              action : "create",
              exists : false,
              otherKey : "otherValue" // Typescript detects this wrong key, that's good
          }))()
  }
  </code></pre>