【发布时间】:2018-07-17 23:47:13
【问题描述】:
我知道,在 TypeScript 中,可以:
- Declare class properties from the constructor declaration by using parameter properties.
- Inherit from a base class, in which case, the derived class constructor must call the base class constructor.
是否可以将这两种行为结合起来?也就是说,是否可以声明一个使用参数属性的基类,然后在一个也使用参数属性的派生类中继承它?派生类是否需要重新声明,传递给超类构造函数调用等?
这有点令人困惑,我无法从文档中弄清楚这是否是可能的,或者 - 如果是的话 - 如何。
如果有人对此有任何见解,请提前致谢。
【问题讨论】:
标签: typescript