如何在Typescript中扩展这两个类

Kal*_*lai 2 javascript typescript typescript1.5 typescript2.0

我需要从同一个命名空间扩展这两个类。

例如:

declare namespace myNameSpace{

   class class1{
       ///some methods will be here
    }
    class class3 extends class1{
      //some method wil be here
    }
    class class2 extends myNameSpace. class3 {
       //some methods will be here
    }
    export namespace  class2 {
       //declaration will be here
     }
}
Run Code Online (Sandbox Code Playgroud)

我需要扩展“myNameSpace.class1”类以及“class2”命名空间。

class newClass extends myNameSpace.class1, myNameSpace.class2 {

   constructor() {
    super();
   }
}
Run Code Online (Sandbox Code Playgroud)

如果我调用这两个类,我会收到一条错误消息

类只能扩展一个类

有没有其他方法可以在打字稿中解决这个问题。

bas*_*rat 7

有没有其他方法可以在打字稿中解决这个问题。

TypeScript 设计为单继承。