title: Typescript assigning an interface or a type to a Record<string, string>
body: <p>After reading <a href="https://stackoverflow.com/questions/37233735/typescript-interfaces-vs-types">this question</a> or <a href="https://www.typescriptlang.org/docs/handbook/advanced-types.html#interfaces-vs-type-aliases" rel="noreferrer">this article</a>, I'm still a bit confused about the subtle differences between an <code>interface</code> and a <code>type</code>.</p>
  <p>In this example, my goal is to assign a simple object to a broader <code>Record&lt;string, string&gt;</code> type:</p>
  <pre class="lang-js prettyprint-override"><code>interface MyInterface {
    foobar: string;
  }
  
  type MyType = {
    foobar: string;
  }
  
  const exampleInterface: MyInterface = { foobar: 'hello world' };
  const exampleType: MyType = { foobar: 'hello world' };
  
  let record: Record&lt;string, string&gt; = {};
  
  record = exampleType;      // Compiles
  record = exampleInterface; // Index signature is missing
  </code></pre>
  <p><a href="https://www.typescriptlang.org/play?#code/JYOwLgpgTgZghgYwgAgLIE8CS5rycgbwFgAoZZGAe0oCM4oAuZAZzClAHMBuUgX1NJh0ABxQYAKiJQBeQqXJVa9Jq3YhufASQSUQrZBAAecALbCANhGyRYiCEwzXcd5LIIVqdRsgDkACwhzc0pkAHdKKHMAEx9kXh5tXX0jUwsISVEHdAyZQg8lb39A4LCI6Nj4rUswZCgIHSgopgAleoiogB5VTgAaFjZOAD5XQkqSUjqGqJGUs0scrnIl5AB6FeQAYUozYEtmCbbGmeM5qxxbJEW15GwooxZgDhA4MABXOuRgZmQTL%20ZOUhAA" rel="noreferrer">Try it</a></p>
  <p>The assignment is possible when declaring my object with a <code>type</code>, but not when declaring a similar one with an <code>interface</code>. It says that the index signature is missing, but to my (limited) understanding of index signatures, none of <code>MyType</code> and <code>MyInterface</code> actually have one.</p>
  <p>What is the reason why the last line does not compile whereas the previous one does?</p>