Skip to content

Commit ef9b265

Browse files
committed
useModalClose: update to use T
1 parent 7b61989 commit ef9b265

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

client/common/useModalClose.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ import { useKeyDownHandlers } from './useKeyDownHandlers';
1818
* @param passedRef - Optional ref to the modal element. If not provided, one is created internally.
1919
* @returns A ref to be attached to the modal DOM element
2020
*/
21-
export function useModalClose(
21+
export function useModalClose<T extends HTMLElement = HTMLElement>(
2222
onClose: () => void,
23-
passedRef?: MutableRefObject<HTMLElement | null>
24-
): MutableRefObject<HTMLElement | null> {
25-
const createdRef = useRef<HTMLElement | null>(null);
23+
passedRef?: MutableRefObject<T | null>
24+
): MutableRefObject<T | null> {
25+
const createdRef = useRef<T | null>(null);
2626
const modalRef = passedRef ?? createdRef;
2727

2828
useEffect(() => {

0 commit comments

Comments
 (0)