From b8f1793c99450cfe7ef2ee2796b1cf43fbacbf1b Mon Sep 17 00:00:00 2001 From: xiften <108333567+not-ani@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:43:56 -0600 Subject: [PATCH] fix: eslint errors --- .../src/lib/hooks/use-outside-click.tsx | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/apps/website/src/lib/hooks/use-outside-click.tsx b/apps/website/src/lib/hooks/use-outside-click.tsx index a889117..1de4cb7 100644 --- a/apps/website/src/lib/hooks/use-outside-click.tsx +++ b/apps/website/src/lib/hooks/use-outside-click.tsx @@ -1,20 +1,15 @@ -/** eslint-disable @typescript-eslint/ban-ts-comment */ -//@ts-nocheck -/** eslint-disable @typescript-eslint/no-unsafe-call */ -/** eslint-disable @typescript-eslint/no-explicit-any */ -/** eslint-disable @typescript-eslint/no-unsafe-member-access */ -/** eslint-disable @typescript-eslint/no-explicit-any */ -/** eslint-disable @typescript-eslint/ban-types */ -import type React from "react"; -import { useEffect } from "react"; +import { RefObject, useEffect } from "react"; export const useOutsideClick = ( - ref: React.RefObject, - callback: Function, + ref: RefObject, + callback: (event: MouseEvent | TouchEvent) => void, ) => { useEffect(() => { - const listener = (event: any) => { - if (!ref.current || ref.current.contains(event.target)) { + const listener = (event: MouseEvent | TouchEvent) => { + if (!(event instanceof MouseEvent) && !(event instanceof TouchEvent)) { + return; + } + if (!ref.current || ref.current.contains(event.target as Node)) { return; } callback(event);