title: type vs interface indexer property in flow
body: <p>Could someone explain to me what is the difference between <code>type</code> vs <code>interface</code> in flow? I have been reading online but could not find an answer. </p>
  
  <p>Here is the code:
  <a href="https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBLAdgFwKYBOUAhgMZ5gCyeOxAJsbWAN6phgDWeAngFxgBnHAWwBzANxswAN2IwArnn7Es3SQF902fETIVqtBrQDyAIwBWLKQG0ufQcLEBdfgfqNiG9LIJgAtjTutK6BRsRmlgC8VuwCcAEASnh08uQE-MycPPwARPhCOQA0MnKK-ACMYOqFUipwOAAWhEkpaRlZ9nl4BcWyCkpgAExVNeriQA" rel="nofollow noreferrer">https://flow.org/try/#0PQKgBAAgZgNg9gdzCYAoVBLAdgFwKYBOUAhgMZ5gCyeOxAJsbWAN6phgDWeAngFxgBnHAWwBzANxswAN2IwArnn7Es3SQF902fETIVqtBrQDyAIwBWLKQG0ufQcLEBdfgfqNiG9LIJgAtjTutK6BRsRmlgC8VuwCcAEASnh08uQE-MycPPwARPhCOQA0MnKK-ACMYOqFUipwOAAWhEkpaRlZ9nl4BcWyCkpgAExVNeriQA</a></p>
  
  <p>For example, the following code works:</p>
  
  <pre><code>type Metadata {
    key: string;
    value: any;
  }
  
  type MetadataObj {
    [key: string]: Metadata;
  }
  
  var metadata: MetadataObj = {
    someReducer: { key: "test", value: 1 },
    anotherReducer: { key: "test", value: 2 },
  };
  </code></pre>
  
  <p>But this does not, and produce this error:</p>
  
  <blockquote>
    <p>Cannot assign object literal to <code>metadata</code> because an indexer property is missing in object literal [1] but exists in <code>MetadataObj</code> [2]. (References: [1] [2])</p>
  </blockquote>
  
  <pre><code>interface Metadata {
    key: string;
    value: any;
  }
  
  interface MetadataObj {
    [key: string]: Metadata;
  }
  
  var metadata: MetadataObj = {
    someReducer: { key: "test", value: 1 },
    anotherReducer: { key: "test", value: 2 },
  };
  </code></pre>
  
  <p>I have read similar posts like these, but it does not really help me:
  <a href="https://github.com/facebook/flow/issues/3876" rel="nofollow noreferrer">https://github.com/facebook/flow/issues/3876</a></p>
  
  <p>And on Typescript...
  <a href="https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.10" rel="nofollow noreferrer">https://github.com/Microsoft/TypeScript/blob/master/doc/spec.md#3.10</a></p>