title: Typescript: reference to interface in variable
body: <p>While implementing the client side of a server communication I happen to meet the following problem: How can I store a reference to an interface in a variable.</p>
  
  <p>I have an interface that hold all the information about a specific RESTfull backend call:</p>
  
  <pre><code>export interface IEndpoint {
    path: string,
    method: HTTP_METHOD,
    data: any,
    response: any
  }
  </code></pre>
  
  <p>Create instance of this element (ISomeInterface and IAnotherInterface are the interfaces that I want to refer to later):</p>
  
  <pre><code>export const GET_TEST: IEndpoint = {
    path: 'api/test',
    method: HTTP_METHOD.GET,
    data: &lt;ISomeInterface&gt;{},
    response: &lt;IAnotherInterface&gt;{}
  };
  </code></pre>
  
  <p>The goal is to use the data and response field as type references in a Promise (meta is an instance of IEndpoint):</p>
  
  <pre><code>new Promise&lt;meta.response&gt;((resolve) =&gt; {
    ...
  });
  </code></pre>
  
  <p>The callback type of the Promise (meta.response) is where I am not able to extract the type/interface that I previously assigned.</p>