title: extending interface with generic in typescript
body: <p>I want to build an function which takes any object and return that object with few added properties. Something like:</p>
  
  <pre><code>    //this code doesn't work   
          function addProperties&lt;T&gt;(object: T): IPropertiesToAdd&lt;T&gt; {/*implmentions code*/};
  
          interface IPropertiesToAdd&lt;T&gt; extend T{
              on(): void;
              off(): void;
          }
  
  //usage example
  var str = new String('Hello')
  addProperties(str)
  str.charAt(3)
  str.on() 
  </code></pre>
  
  <p>For the above code typescript compiler return the error that an interface can only add a class or interface, how I can express this in typescript.</p>