我需要从同一个命名空间扩展这两个类。
例如:
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
}
}
我需要扩展“myNameSpace.class1”类以及“class2”命名空间。
class newClass extends myNameSpace.class1, myNameSpace.class2 {
constructor() {
super();
}
}
如果我同时调用这两个类,我会收到一条错误消息
类只能扩展一个类
有没有其他方法可以解决 typescript 中的这个问题。
最佳答案
Is there any other way to fix this issue in typescript.
TypeScript 在设计上是单继承的。
关于javascript - 如何在 Typescript 中扩展这两个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48055702/