小编Tej*_*ddy的帖子

Typescript:从扩展类调用超级方法会出现类型错误 - (中间值)不是函数

我正在名为 StructureWindowComponent 的组件中实现事件处理,并且还在 LeggerStructureWindowComponent 中对其进行了覆盖。

在基类(StructureWindowComponent)中,模糊事件的事件处理如下:

symbolCellLostFocus = (symbolField : MatInput, $index: number) =>{
    console.log("base class symbol cell lost focus");
    //implementation...
  }
Run Code Online (Sandbox Code Playgroud)

在派生类 LeggerStructureWindowComponent 中,我使用 super 调用此方法,如下所示...

symbolCellLostFocus = (symbolField : MatInput, $index: number) =>{
    console.log("derived class symbol lost focus");
    super.symbolCellLostFocus(symbolField, $index);
  }
Run Code Online (Sandbox Code Playgroud)

我在控制台中收到错误: ERROR TypeError: (intermediate value).symbolCellLostFocus is not a function

不知道这里出了什么问题..有人可以请建议吗?

javascript event-handling super typescript angular

10
推荐指数
1
解决办法
4495
查看次数

标签 统计

angular ×1

event-handling ×1

javascript ×1

super ×1

typescript ×1