title: Why generic's constraint for properties fails with interface but not with type
body: <p>Look at this snippet:</p>
  
  <pre><code>type Constrained&lt;T extends { [K in string]: string }&gt; = T;
  
  type A = {
      p: string;
  }
  
  interface B {
      p: string;
  }
  
  type R1 = Constrained&lt;A&gt;; // Why this is OK...
  type R2 = Constrained&lt;B&gt;; // ... and this an Error?
  </code></pre>
  
  <p><a href="https://www.typescriptlang.org/play/index.html#src=type%20Constrained%3CT%20extends%20%7B%20%5BK%20in%20string%5D%3A%20string%20%7D%3E%20%3D%20T%3B%0A%0Atype%20A%20%3D%20%7B%0A%20%20%20%20p%3A%20string%3B%0A%7D%0A%0Ainterface%20B%20%7B%0A%20%20%20%20p%3A%20string%3B%0A%7D%0A%0Atype%20R1%20%3D%20Constrained%3CA%3E%3B%20%2F%2F%20Why%20this%20is%20OK...%0Atype%20R2%20%3D%20Constrained%3CB%3E%3B%20%2F%2F%20...%20and%20this%20an%20Error%3F%0A" rel="nofollow noreferrer">playground</a></p>
  
  <p>I know the constraint could be expressed differently to avoid the error, for instance,</p>
  
  <pre><code>type Constrained&lt;T extends { [K in keyof T]: string }&gt; = T;
  </code></pre>
  
  <p>and solutions like this can be found <a href="https://stackoverflow.com/a/52731753/2484624">here</a> or <a href="https://stackoverflow.com/a/53483282/2484624">here</a>.</p>
  
  <p>The main question is: <strong>why the <code>interface</code> fails but the <code>type</code> does not?</strong></p>
  
  <p>My guess is because <code>interface</code>s are open-ended (they can be extended/merged).</p>
  
  <p>Since the error message is something like</p>
  
  <blockquote>
    <p>Index signature is missing in type 'B'.</p>
  </blockquote>
  
  <p>I think <a href="https://github.com/microsoft/TypeScript/pull/7029" rel="nofollow noreferrer">this PR</a> is relevant. In that case another question arises:</p>
  
  <p><strong>Is a type declared with <code>type</code> the representation of an object literal type?</strong></p>