title: Writing an interface as an extension of a generic
body: <p>For example, I have the following interface </p>
  
  <pre><code>export interface IUserCredentials {
    email: string;
    password: string;
  }
  </code></pre>
  
  <p>I know that I'll be storing this and many other data types inside of a database where they'll be assigned an <code>id</code>, a <code>dateCreated</code> and a <code>dateModified</code> </p>
  
  <p>Rather than write an interface for every single <code>IDBRecord</code>, I want to write it all at once, something like: </p>
  
  <pre><code>interface DBRecord&lt;Data&gt; extends Data {
    id: number;
    dateCreated: Date
    dateModified: Date
  }
  </code></pre>
  
  <p>Of course, this isn't possible, as I cannot reference the generic type outside of the interface's definition. </p>
  
  <p>Can anyone think of a way to do this? </p>