=> {
const handleClickOutside = (event: MouseEvent) => {
if (!event.composedPath().includes(sortRef.current)) {
setOpen(false)
}
}
document.body.addEventListener('click', handleClickOutside)
return () => document.body.removeEventListener('click', handleClickOutside)
}, [])
composedPath()
Property 'composedPath' does not exist on type 'MouseEvent<Element, MouseEvent>
document.body.addEventListener('click', handleClickOutside)
No overload matches this call.
Overload 1 of 2, '(type: "click", listener: (this: HTMLElement, ev: MouseEvent) => any, options?: boolean | AddEventListenerOptions | undefined): void', gave the following error.
Argument of type '(event: MouseEvent) => void' is not assignable to parameter of type '(this: HTMLElement, ev: MouseEvent) => any'.
Types of parameters 'event' and 'ev' are incompatible.
Type 'MouseEvent' is not assignable to type 'MouseEvent<Element, MouseEvent>'.
Overload 2 of 2, '(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions | undefined): void', gave the following error.
чтото у тебя с типизацией не так, ошибка дослоовно переводится как нет совпадения с перегрузкой в этом вызове чтото такое
Обсуждают сегодня