title: Typescript: How to extend two classes?
body: <p>I want to save my time and reuse common code across classes that extend PIXI classes (a 2d webGl renderer library).</p>
  <p><strong>Object Interfaces:</strong></p>
  <pre><code>module Game.Core {
      export interface IObject {}
  
      export interface IManagedObject extends IObject{
          getKeyInManager(key: string): string;
          setKeyInManager(key: string): IObject;
      }
  }
  </code></pre>
  <p>My issue is that the code inside <code>getKeyInManager</code> and <code>setKeyInManager</code> will not change and I want to reuse it, not to duplicate it, here is the implementation:</p>
  <pre><code>export class ObjectThatShouldAlsoBeExtended{
      private _keyInManager: string;
  
      public getKeyInManager(key: string): string{
          return this._keyInManager;
      }
  
      public setKeyInManager(key: string): DisplayObject{
          this._keyInManager = key;
          return this;
      }
  }
  </code></pre>
  <p>What I want to do is to automatically add, through a <code>Manager.add()</code>, the key used in the manager to reference the object <em>inside</em> the object itself in its property <code>_keyInManager</code>.</p>
  <p>So, let's take an example with a Texture. Here goes the <code>TextureManager</code></p>
  <pre><code>module Game.Managers {
      export class TextureManager extends Game.Managers.Manager {
  
          public createFromLocalImage(name: string, relativePath: string): Game.Core.Texture{
              return this.add(name, Game.Core.Texture.fromImage(&quot;/&quot; + relativePath)).get(name);
          }
      }
  }
  </code></pre>
  <p>When I do <code>this.add()</code>, I want the <code>Game.Managers.Manager</code> <code>add()</code> method to call a method which would exist on the object returned by <code>Game.Core.Texture.fromImage(&quot;/&quot; + relativePath)</code>. This object, in this case would be a <code>Texture</code>:</p>
  <pre><code>module Game.Core {
      // I must extend PIXI.Texture, but I need to inject the methods in IManagedObject.
      export class Texture extends PIXI.Texture {
  
      }
  }
  </code></pre>
  <p>I know that <code>IManagedObject</code> is an interface and cannot contain implementation, but I don't know what to write to inject the class <code>ObjectThatShouldAlsoBeExtended</code> inside my <code>Texture</code> class. Knowing that the same process would be required for <code>Sprite</code>, <code>TilingSprite</code>, <code>Layer</code> and more.</p>
  <p>I need experienced TypeScript feedback/advice here, it must be possible to do it, but not by multiple extends since only one is possible at the time, I didn't find any other solution.</p>