这里的 matches 在 typescript 中是怎么写的,我这边提示不存在
来源:11-4 DOM 事件相关的面试题

Sven_19960218
2021-05-12
他的 EventTarget 上没有继承这个 matches ,只有在 Element 上有这么个方法,这里用 typescript 是怎么来实现的,谢谢老师
写回答
1回答
-
双越
2021-05-12
matches 是 Element 类型的属性 https://developer.mozilla.org/zh-CN/docs/Web/API/Element/matches
所以,把 target 变成 Element 类型即可使用
(target as Element).matches
00
相似问题