Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

refactor(desktop): remove unsafe assertions in chrome and overlay routes

Richie McIlroye5972cea723d
diff --git a/apps/desktop/src/routes/(window-chrome)/update.tsx b/apps/desktop/src/routes/(window-chrome)/update.tsx
index 41cee01e5..b6f58badd 100644
--- a/apps/desktop/src/routes/(window-chrome)/update.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/update.tsx
@@ -2,7 +2,7 @@ import { Button } from "@cap/ui-solid";
import { useNavigate } from "@solidjs/router";
import { getCurrentWindow, UserAttentionType } from "@tauri-apps/api/window";
import { relaunch } from "@tauri-apps/plugin-process";
-import { check, type Update } from "@tauri-apps/plugin-updater";
+import { check } from "@tauri-apps/plugin-updater";
import { createResource, createSignal, Match, Show, Switch } from "solid-js";
export default function () {
diff --git a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
index 148c850d6..a48a27d00 100644
--- a/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
+++ b/apps/desktop/src/routes/(window-chrome)/upgrade.tsx
@@ -65,7 +65,7 @@ export default function Page() {
"message" in resp.body
)
throw resp.body.message;
- throw new Error((resp.body as any).toString());
+ throw new Error(String(resp.body));
}
},
onSuccess: async () => {
@@ -552,7 +552,7 @@ const ActivateLicenseDialog = ({ open, onOpenChange }: Props) => {
return { ...resp.body, licenseKey: vars.licenseKey };
if (typeof resp.body === "object" && resp.body && "message" in resp.body)
throw resp.body.message;
- throw new Error((resp.body as any).toString());
+ throw new Error(String(resp.body));
},
onSuccess: async (value) => {
await generalSettingsStore.set({
diff --git a/apps/desktop/src/routes/camera.tsx b/apps/desktop/src/routes/camera.tsx
index 3342c97cd..7745e6e76 100644
--- a/apps/desktop/src/routes/camera.tsx
+++ b/apps/desktop/src/routes/camera.tsx
@@ -1052,7 +1052,7 @@ function Canvas(props: {
style={style()}
width={props.latestFrame()?.data.width}
height={props.latestFrame()?.data.height}
- ref={props.ref!}
+ ref={props.ref}
/>
);
}
diff --git a/apps/desktop/src/routes/target-select-overlay.tsx b/apps/desktop/src/routes/target-select-overlay.tsx
index d36a4f5e7..2a5bc355d 100644
--- a/apps/desktop/src/routes/target-select-overlay.tsx
+++ b/apps/desktop/src/routes/target-select-overlay.tsx
@@ -951,7 +951,7 @@ function CameraPreviewInline() {
let reusableFrameWidth = 0;
let reusableFrameHeight = 0;
- const cameraWsPort = (window as any).__CAP__?.cameraWsPort;
+ const cameraWsPort = window.__CAP__?.cameraWsPort;
const hasCameraSelected = () => rawOptions.cameraID !== null;
const getReusableFrame = (width: number, height: number) => {