title: Returning Promise from TypeScript Interface
body: <pre class="lang-ts prettyprint-override"><code>interface IPlayer {
    id: String;
    name: String;
    dob: String;
    GetName&lt;IPlayer&gt;(): Promise&lt;IPlayer&gt;;
  }
  
  class Player implements IPlayer {
     constructor(public id: String, public name: string, public dob:string) { }
  
     GetName&lt;IPlayer&gt;(): Promise&lt;IPlayer&gt; {
       let player: IPlayer = new Player(&quot;Hello&quot;, &quot;World&quot;, '');
     
       return new Promise&lt;IPlayer&gt;((resolve, reject) =&gt; { 
         resolve(player);
       });
     };
  }
  </code></pre>
  <p>Not sure what I am doing wrong here. Can you please tell me why I am not able to create the instance of an interface in this code?</p>
  <p>This is returning the error below:</p>
  <blockquote>
  <p>Type 'Player' is not assignable to type 'IPlayer'.</p>
  <p>let player: IPlayer ##</p>
  </blockquote>
  <p>Can anyone help me with where I am doing this wrong in creating the instance of the interface?</p>