我有一个继承HTMLElement
的接口:
export interface IEElement extends HTMLElement {
click: (event: IEEvent) => void;
onmousedown: (event: IEEvent) => void;
onmousemove: (event: IEEvent) => void;
onmouseup: (event: IEEvent) => void;
}
在所有属性上获取错误:
我想这是因为click
是() => void
类型,但我的新架构不应该覆盖它吗?如何省略错误(我不想重命名我的属性 - 如果没有必要)?
答案 0 :(得分:1)
将其设为可选(使用:?)
export interface IEElement extends HTMLElement {
click: (event?: IEEvent) => void;
onmousedown: (event: IEEvent) => void;
onmousemove: (event: IEEvent) => void;
onmouseup: (event: IEEvent) => void;
}