您看到这个问题是因为DOM的内置TypeScript类型(通常称为
lib.dom.d.ts
因为它们存储的文件名)不要声明
onmousewheel
Document
类型。全球
document
变量声明为具有
文件
window
. 你能把密码改成
window.onmousewheel
?
如果你确定
有
document.onmousewheel
typings/lib.custom.d.ts
)并宣布
接口还具有
鼠标滚轮
属性:
interface Document {
onmousewheel: ((this: Document, ev: Event) => any) | null;
}
import
或
export
任何东西:它意味着声明一个全球可用的接口
文件
.
tslint:disable
@ts-ignore
鼠标滚轮
接口属性)来完全禁用行的TypeScript。在一行上禁用TypeScript可以忽略其他有效错误。