Skip to content

Commit 4409459

Browse files
committed
fix types
1 parent 5d7e4a3 commit 4409459

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

components/PushToTalkButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
useParticipants,
44
} from "@livekit/components-react";
55
import { motion } from "framer-motion";
6-
import { useCallback, useEffect, useRef, useState, MouseEvent } from "react";
6+
import { useCallback, useEffect, useRef, useState, MouseEvent as ReactMouseEvent } from "react";
77

88
export function PushToTalkButton() {
99
const { localParticipant } = useLocalParticipant();
@@ -25,7 +25,7 @@ export function PushToTalkButton() {
2525
}, [localParticipant, agent]);
2626

2727
// when user presses the button
28-
const handleMouseDown = useCallback(async (e: MouseEvent<HTMLButtonElement>) => {
28+
const handleMouseDown = useCallback(async (e: ReactMouseEvent<HTMLButtonElement>) => {
2929
e.preventDefault(); // prevent default browser behavior
3030

3131
if (!agent || !localParticipant) return;
@@ -87,7 +87,7 @@ export function PushToTalkButton() {
8787
}, [agent, localParticipant, isPressed]);
8888

8989
// when user releases the mouse anywhere
90-
const handleMouseUp = useCallback((e: MouseEvent) => {
90+
const handleMouseUp = useCallback((e: ReactMouseEvent) => {
9191
e.preventDefault(); // prevent default browser behavior
9292

9393
if (!isPressed) return;
@@ -111,12 +111,12 @@ export function PushToTalkButton() {
111111
useEffect(() => {
112112
if (isPressed) {
113113
const handleGlobalMouseUp = (e: MouseEvent) => {
114-
handleMouseUp(e);
114+
handleMouseUp(e as unknown as ReactMouseEvent);
115115
};
116116

117-
window.addEventListener('mouseup', handleGlobalMouseUp as any);
117+
window.addEventListener('mouseup', handleGlobalMouseUp);
118118
return () => {
119-
window.removeEventListener('mouseup', handleGlobalMouseUp as any);
119+
window.removeEventListener('mouseup', handleGlobalMouseUp);
120120
};
121121
}
122122
}, [isPressed, handleMouseUp]);

0 commit comments

Comments
 (0)