如何修复装饰器 @HostListener 的 no-unsafe-any

问题描述

ng lint 抱怨下面的代码,no-unsafe-any 设置为 true,我们想使用这个规则。

'any' 类型表达式的不安全使用

我该怎么做才能消除以下代码的 linting 错误

  @HostListener('window:keyup',['$event'])
  public onKeyUp(event: KeyboardEvent): void {
    if (event.shiftKey && event.code === KEY_CODES.KEY_S) {
      // service call method - with return type as 'void'
    }

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)