Skip to content

Commit a887f11

Browse files
authored
TS tweaks (#21)
1 parent 331b12f commit a887f11

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/components/camera/Camera.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ function Camera({ predictCanvas, predictions }: CameraProps) {
1919
// handle any webcam plugged into the computer
2020
// https://github.com/mozmorris/react-webcam#show-all-cameras-by-deviceid
2121
const handleDevices = useCallback(
22-
(mediaDevices) => {
22+
(mediaDevices: MediaDeviceInfo[]) => {
2323
// find all the webcams
24-
const videoDevices = mediaDevices.filter(({kind}: MediaDeviceInfo) => kind === "videoinput");
24+
const videoDevices = mediaDevices.filter(({kind}) => kind === "videoinput");
2525
setDevices(videoDevices);
2626
// set our initial webcam to be the first in the list
2727
if (videoDevices.length > 0) {
@@ -45,8 +45,8 @@ function Camera({ predictCanvas, predictions }: CameraProps) {
4545
}, [webcamRef]);
4646

4747
// helper for waiting in our loop when the camera is loading (getting the image)
48-
const sleep: (ms: number) => Promise<NodeJS.Timeout> = useCallback((ms) => {
49-
return new Promise(function (resolve, reject) {
48+
const sleep = useCallback((ms: number) => {
49+
return new Promise<NodeJS.Timeout>(function (resolve, reject) {
5050
setTimeout(resolve, ms);
5151
});
5252
}, []);

src/model/worker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export function disposeModel() {
1919
}
2020
}
2121

22-
export async function predict(data: any) {
22+
export async function predict(data: ImageData) {
2323
// run the input data through the model
2424
if (model) {
2525
return await model.predict(data);

0 commit comments

Comments
 (0)