你好,我在TypeScript中有这段代码
var btn = document.getElementsByClassName("btn-up") as EventTarget;
btn.addEventListener('click', (event) => {
console.log('clickcc');
})
它把我抛出这个错误 *类型“ HTMLCollectionOf”缺少类型“ EventTarget”中的以下属性:addEventListener,dispatchEvent,removeEventListener *
请如何解决?