Argument of type '(e: CustomEvent) => void' is not assignable to parameter of type 'EventListenerOrEventListenerObject'

前端 未结 4 1086
执笔经年
执笔经年 2021-02-07 04:11

I have this custom event setup, and it works with TypeScript 2.5.3, but when I updated to 2.6.1 I get an error

window.addEventListener(         


        
4条回答
  •  -上瘾入骨i
    2021-02-07 04:55

    You also have this option:

    window.addEventListener('OnRewards', (e: CustomEvent) => {
        // your code here
    } as (e: Event) => void)
    

提交回复
热议问题