const topAncestorElement =
[].find.call(document.querySelectorAll('[draggable-group-name]'), (e: HTMLElement) => e.contains(dom))
topAncestorElement
的类型是 call
的返回值 undefined
;
我希望使用 [].find.call
这种写法,要怎么修改呢?
as unknown as HTMLElement
这样断言就行了。之前没注意看提示...
as unknown as HTMLElement