Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add null-safety and typing fixes across web
Richie McIlroy1dce18ce372f
diff --git a/apps/web/__tests__/unit/async-video-code-reviews-page.test.ts b/apps/web/__tests__/unit/async-video-code-reviews-page.test.tsindex 228252f51..73b8b3424 100644--- a/apps/web/__tests__/unit/async-video-code-reviews-page.test.ts+++ b/apps/web/__tests__/unit/async-video-code-reviews-page.test.ts@@ -146,12 +146,12 @@ describe("AsyncVideoCodeReviewsPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "What is an async video code review?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/avi-to-mp4-page.test.ts b/apps/web/__tests__/unit/avi-to-mp4-page.test.tsindex 4761d8772..608096356 100644--- a/apps/web/__tests__/unit/avi-to-mp4-page.test.ts+++ b/apps/web/__tests__/unit/avi-to-mp4-page.test.ts@@ -114,12 +114,12 @@ describe("AVI to MP4 FAQ schema validity", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "How do I convert AVI to MP4 online?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});@@ -169,11 +169,11 @@ describe("AVI to MP4 HowTo schema validity", () => {steps: howToSteps,});- expect(schema.step[0].position).toBe(1);- expect(schema.step[0].name).toBe("Upload your AVI file");- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);- expect(schema.step[2].name).toBe("Download your MP4");+ expect(schema.step[0]!.position).toBe(1);+ expect(schema.step[0]!.name).toBe("Upload your AVI file");+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);+ expect(schema.step[2]!.name).toBe("Download your MP4");});it("produces JSON-serializable output", () => {diff --git a/apps/web/__tests__/unit/best-screen-recorder-page.test.ts b/apps/web/__tests__/unit/best-screen-recorder-page.test.tsindex 88da5cf5f..03e6f89d0 100644--- a/apps/web/__tests__/unit/best-screen-recorder-page.test.ts+++ b/apps/web/__tests__/unit/best-screen-recorder-page.test.ts@@ -138,20 +138,20 @@ describe("BestScreenRecorderPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "What is the best screen recorder?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});it("strips HTML tags from answers", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[1].acceptedAnswer.text).not.toContain("<a");- expect(schema.mainEntity[1].acceptedAnswer.text).toContain("Cap free");+ expect(schema.mainEntity[1]!.acceptedAnswer.text).not.toContain("<a");+ expect(schema.mainEntity[1]!.acceptedAnswer.text).toContain("Cap free");});it("produces JSON-serializable output", () => {diff --git a/apps/web/__tests__/unit/breadcrumb-schema.test.ts b/apps/web/__tests__/unit/breadcrumb-schema.test.tsindex faa4c0389..e86f5b37e 100644--- a/apps/web/__tests__/unit/breadcrumb-schema.test.ts+++ b/apps/web/__tests__/unit/breadcrumb-schema.test.ts@@ -35,8 +35,8 @@ describe("createBreadcrumbSchema", () => {name: "Tools",item: "https://cap.so/tools",});- expect(schema.itemListElement[2].position).toBe(3);- expect(schema.itemListElement[2].name).toBe("Convert");+ expect(schema.itemListElement[2]!.position).toBe(3);+ expect(schema.itemListElement[2]!.name).toBe("Convert");});it("omits item field when no url is provided", () => {@@ -45,8 +45,8 @@ describe("createBreadcrumbSchema", () => {{ name: "Current Page" },]);- expect(schema.itemListElement[0].item).toBe("https://cap.so");- expect("item" in schema.itemListElement[1]).toBe(false);+ expect(schema.itemListElement[0]!.item).toBe("https://cap.so");+ expect("item" in schema.itemListElement[1]!).toBe(false);});it("handles single item breadcrumb", () => {@@ -55,7 +55,7 @@ describe("createBreadcrumbSchema", () => {]);expect(schema.itemListElement).toHaveLength(1);- expect(schema.itemListElement[0].position).toBe(1);+ expect(schema.itemListElement[0]!.position).toBe(1);});it("handles empty array", () => {diff --git a/apps/web/__tests__/unit/developer-actions.test.ts b/apps/web/__tests__/unit/developer-actions.test.tsindex d2456de2d..ed320e0d4 100644--- a/apps/web/__tests__/unit/developer-actions.test.ts+++ b/apps/web/__tests__/unit/developer-actions.test.ts@@ -86,11 +86,30 @@ vi.mock("drizzle-orm", () => ({sql: vi.fn(),}));-import { __mockDb } from "@cap/database";+import * as capDatabase from "@cap/database";import { getCurrentUser } from "@cap/database/auth/session";const mockGetCurrentUser = getCurrentUser as ReturnType<typeof vi.fn>;-const mockDb = __mockDb as Record<string, ReturnType<typeof vi.fn>>;++type MockFn = ReturnType<typeof vi.fn>;+interface MockDb {+ select: MockFn;+ insert: MockFn;+ update: MockFn;+ delete: MockFn;+ from: MockFn;+ set: MockFn;+ where: MockFn;+ limit: MockFn;+ values: MockFn;+ transaction: MockFn;+ leftJoin: MockFn;+ orderBy: MockFn;+ offset: MockFn;+ [key: string]: MockFn | undefined;+}++const mockDb = (capDatabase as unknown as { __mockDb: MockDb }).__mockDb;const mockUser = { id: "user-123", email: "[email protected]" };const mockApp = {@@ -103,8 +122,9 @@ const mockApp = {function resetMockDb() {for (const key of Object.keys(mockDb)) {- if (typeof mockDb[key]?.mockClear === "function") {- mockDb[key].mockClear();+ const fn = mockDb[key];+ if (fn && typeof fn.mockClear === "function") {+ fn.mockClear();}}mockDb.select.mockReturnValue(mockDb);@@ -161,7 +181,7 @@ describe("createDeveloperApp", () => {});expect(mockDb.insert).toHaveBeenCalled();- const firstValuesCall = mockDb.values.mock.calls[0][0];+ const firstValuesCall = mockDb.values.mock.calls[0]![0];expect(firstValuesCall).toMatchObject({name: "My App",environment: "production",@@ -218,7 +238,7 @@ describe("createDeveloperApp", () => {});const expectedPrefix = result.publicKey.slice(0, 12);- const keysValuesCall = mockDb.values.mock.calls[1][0];+ const keysValuesCall = mockDb.values.mock.calls[1]![0];const publicKeyEntry = keysValuesCall.find((entry: Record<string, unknown>) => entry.keyType === "public",);diff --git a/apps/web/__tests__/unit/developer-api-auth.test.ts b/apps/web/__tests__/unit/developer-api-auth.test.tsindex 51bfbffe9..4e954f85f 100644--- a/apps/web/__tests__/unit/developer-api-auth.test.ts+++ b/apps/web/__tests__/unit/developer-api-auth.test.ts@@ -75,7 +75,7 @@ describe("developer API auth - key format validation", () => {});it("rejects undefined via optional chaining", () => {- const key: string | undefined = undefined;+ const key = undefined as string | undefined;expect(key?.startsWith("cpk_")).toBeFalsy();});@@ -107,7 +107,7 @@ describe("developer API auth - key format validation", () => {});it("rejects undefined via optional chaining", () => {- const key: string | undefined = undefined;+ const key = undefined as string | undefined;expect(key?.startsWith("csk_")).toBeFalsy();});@@ -132,7 +132,7 @@ describe("developer API auth - bearer token extraction", () => {});it("returns undefined when authorization header is missing", () => {- const header: string | undefined = undefined;+ const header = undefined as string | undefined;const token = header?.split(" ")[1];expect(token).toBeUndefined();});diff --git a/apps/web/__tests__/unit/developer-credit-math.test.ts b/apps/web/__tests__/unit/developer-credit-math.test.tsindex 952f101cc..06188dba5 100644--- a/apps/web/__tests__/unit/developer-credit-math.test.ts+++ b/apps/web/__tests__/unit/developer-credit-math.test.ts@@ -1,3 +1,5 @@+import { describe, expect, it } from "vitest";+const MICRO_CREDITS_PER_DOLLAR = 100_000;const MICRO_CREDITS_PER_MINUTE = 5_000;const MICRO_CREDITS_PER_MINUTE_PER_DAY = 3.33;diff --git a/apps/web/__tests__/unit/developer-cron-storage.test.ts b/apps/web/__tests__/unit/developer-cron-storage.test.tsindex 36efa4bab..05348226a 100644--- a/apps/web/__tests__/unit/developer-cron-storage.test.ts+++ b/apps/web/__tests__/unit/developer-cron-storage.test.ts@@ -111,7 +111,7 @@ function setupDbSequence(let callIndex = 0;mockDb.mockImplementation(() => {const idx = callIndex++;- const result = idx < responses.length ? responses[idx] : [];+ const result = idx < responses.length ? responses[idx]! : [];return makeChain(result, txOptions);});}diff --git a/apps/web/__tests__/unit/developer-documentation-videos-page.test.ts b/apps/web/__tests__/unit/developer-documentation-videos-page.test.tsindex b90272941..4b824aa39 100644--- a/apps/web/__tests__/unit/developer-documentation-videos-page.test.ts+++ b/apps/web/__tests__/unit/developer-documentation-videos-page.test.ts@@ -155,12 +155,12 @@ describe("DeveloperDocumentationVideosPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "What is a developer documentation video?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/faq-schema.test.ts b/apps/web/__tests__/unit/faq-schema.test.tsindex 67f703da9..c5ff0d4f6 100644--- a/apps/web/__tests__/unit/faq-schema.test.ts+++ b/apps/web/__tests__/unit/faq-schema.test.ts@@ -32,7 +32,7 @@ describe("createFAQSchema", () => {text: "Yes, Cap is free.",},});- expect(schema.mainEntity[1].name).toBe("What platforms does Cap support?");+ expect(schema.mainEntity[1]!.name).toBe("What platforms does Cap support?");expect(schema.mainEntity).toHaveLength(2);});@@ -46,10 +46,10 @@ describe("createFAQSchema", () => {];const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0].acceptedAnswer.text).toBe(+ expect(schema.mainEntity[0]!.acceptedAnswer.text).toBe("Visit the download page to get started.",);- expect(schema.mainEntity[0].acceptedAnswer.text).not.toContain("<a");+ expect(schema.mainEntity[0]!.acceptedAnswer.text).not.toContain("<a");});it("strips multiple different HTML tags", () => {@@ -62,7 +62,7 @@ describe("createFAQSchema", () => {];const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0].acceptedAnswer.text).toBe(+ expect(schema.mainEntity[0]!.acceptedAnswer.text).toBe("Cap offers 4K recording, instant sharing, and affordable pricing.",);});@@ -127,8 +127,8 @@ describe("createFAQSchema", () => {expect(schema["@type"]).toBe("FAQPage");expect(schema.mainEntity).toHaveLength(5);- expect(schema.mainEntity[3].acceptedAnswer.text).not.toContain("<a");- expect(schema.mainEntity[3].acceptedAnswer.text).toContain("macOS");+ expect(schema.mainEntity[3]!.acceptedAnswer.text).not.toContain("<a");+ expect(schema.mainEntity[3]!.acceptedAnswer.text).toContain("macOS");});it("applies FAQPage schema to free-screen-recorder page FAQs", () => {@@ -162,8 +162,8 @@ describe("createFAQSchema", () => {expect(schema["@type"]).toBe("FAQPage");expect(schema.mainEntity).toHaveLength(5);- expect(schema.mainEntity[0].acceptedAnswer.text).not.toContain("<a");- expect(schema.mainEntity[0].acceptedAnswer.text).toContain(+ expect(schema.mainEntity[0]!.acceptedAnswer.text).not.toContain("<a");+ expect(schema.mainEntity[0]!.acceptedAnswer.text).toContain("professional-grade",);});diff --git a/apps/web/__tests__/unit/hipaa-compliant-screen-recording-page.test.ts b/apps/web/__tests__/unit/hipaa-compliant-screen-recording-page.test.tsindex dd57b4255..1b43c8a7c 100644--- a/apps/web/__tests__/unit/hipaa-compliant-screen-recording-page.test.ts+++ b/apps/web/__tests__/unit/hipaa-compliant-screen-recording-page.test.ts@@ -146,12 +146,12 @@ describe("HipaaCompliantScreenRecordingPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "Can Cap be used for HIPAA-compliant screen recording?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/howto-schema.test.ts b/apps/web/__tests__/unit/howto-schema.test.tsindex 2ee3de6a1..ac7ffda3f 100644--- a/apps/web/__tests__/unit/howto-schema.test.ts+++ b/apps/web/__tests__/unit/howto-schema.test.ts@@ -34,8 +34,8 @@ describe("createHowToSchema", () => {name: "Download",text: "Download the app.",});- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);});it("uses default totalTime of PT2M when not provided", () => {@@ -124,7 +124,7 @@ describe("createHowToSchema", () => {expect(schema["@type"]).toBe("HowTo");expect(schema.step).toHaveLength(4);- expect(schema.step[0].name).toBe("Download and install Cap");- expect(schema.step[3].position).toBe(4);+ expect(schema.step[0]!.name).toBe("Download and install Cap");+ expect(schema.step[3]!.position).toBe(4);});});diff --git a/apps/web/__tests__/unit/mac-screen-recording-with-audio-page.test.ts b/apps/web/__tests__/unit/mac-screen-recording-with-audio-page.test.tsindex 013d057fd..288df5271 100644--- a/apps/web/__tests__/unit/mac-screen-recording-with-audio-page.test.ts+++ b/apps/web/__tests__/unit/mac-screen-recording-with-audio-page.test.ts@@ -171,12 +171,12 @@ describe("MacScreenRecordingWithAudioPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "Why doesn't macOS record internal audio by default?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/mov-to-mp4-page.test.ts b/apps/web/__tests__/unit/mov-to-mp4-page.test.tsindex e2feb8eaf..6025972b7 100644--- a/apps/web/__tests__/unit/mov-to-mp4-page.test.ts+++ b/apps/web/__tests__/unit/mov-to-mp4-page.test.ts@@ -109,12 +109,12 @@ describe("MOV to MP4 FAQ schema validity", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "How do I convert MOV to MP4 online?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});@@ -164,11 +164,11 @@ describe("MOV to MP4 HowTo schema validity", () => {steps: howToSteps,});- expect(schema.step[0].position).toBe(1);- expect(schema.step[0].name).toBe("Upload your MOV file");- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);- expect(schema.step[2].name).toBe("Download your MP4");+ expect(schema.step[0]!.position).toBe(1);+ expect(schema.step[0]!.name).toBe("Upload your MOV file");+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);+ expect(schema.step[2]!.name).toBe("Download your MP4");});it("produces JSON-serializable output", () => {diff --git a/apps/web/__tests__/unit/mp4-to-gif-page.test.ts b/apps/web/__tests__/unit/mp4-to-gif-page.test.tsindex 9059c134a..b0f54ff77 100644--- a/apps/web/__tests__/unit/mp4-to-gif-page.test.ts+++ b/apps/web/__tests__/unit/mp4-to-gif-page.test.ts@@ -109,12 +109,12 @@ describe("MP4 to GIF FAQ schema validity", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "How do I convert MP4 to GIF?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});@@ -164,11 +164,11 @@ describe("MP4 to GIF HowTo schema validity", () => {steps: howToSteps,});- expect(schema.step[0].position).toBe(1);- expect(schema.step[0].name).toBe("Upload your MP4 file");- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);- expect(schema.step[2].name).toBe("Convert and download your GIF");+ expect(schema.step[0]!.position).toBe(1);+ expect(schema.step[0]!.name).toBe("Upload your MP4 file");+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);+ expect(schema.step[2]!.name).toBe("Convert and download your GIF");});it("produces JSON-serializable output", () => {diff --git a/apps/web/__tests__/unit/obs-alternative-page.test.ts b/apps/web/__tests__/unit/obs-alternative-page.test.tsindex 92af320dc..30697d4d3 100644--- a/apps/web/__tests__/unit/obs-alternative-page.test.ts+++ b/apps/web/__tests__/unit/obs-alternative-page.test.ts@@ -148,12 +148,12 @@ describe("ObsAlternativePage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "Why would I use Cap instead of OBS Studio?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/open-source-screen-recorder-page.test.ts b/apps/web/__tests__/unit/open-source-screen-recorder-page.test.tsindex 6aa9a4009..13c69b0ba 100644--- a/apps/web/__tests__/unit/open-source-screen-recorder-page.test.ts+++ b/apps/web/__tests__/unit/open-source-screen-recorder-page.test.ts@@ -144,12 +144,12 @@ describe("OpenSourceScreenRecorderPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "Is Cap really open source?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/recording-spool-fallback.test.ts b/apps/web/__tests__/unit/recording-spool-fallback.test.tsindex f6d7cc34a..2fc41b24d 100644--- a/apps/web/__tests__/unit/recording-spool-fallback.test.ts+++ b/apps/web/__tests__/unit/recording-spool-fallback.test.ts@@ -7,7 +7,7 @@ const blobToText = async (blob: Blob) =>describe("moveRecordingSpoolToInMemoryBackup", () => {it("merges recovered chunks with later in-memory chunks without duplicating them", async () => {let retainedChunks = [new Blob(["older"], { type: "video/webm" })];- let releaseRecovery: (() => void) | null = null;+ let releaseRecovery = null as (() => void) | null;const replaceLocalRecording = vi.fn((chunks: Blob[]) => {retainedChunks = chunks;diff --git a/apps/web/__tests__/unit/self-hosted-screen-recording-page.test.ts b/apps/web/__tests__/unit/self-hosted-screen-recording-page.test.tsindex 7355a022f..0184435da 100644--- a/apps/web/__tests__/unit/self-hosted-screen-recording-page.test.ts+++ b/apps/web/__tests__/unit/self-hosted-screen-recording-page.test.ts@@ -147,12 +147,12 @@ describe("SelfHostedScreenRecordingPage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "Can Cap be self-hosted?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/upload-progress-playback.test.ts b/apps/web/__tests__/unit/upload-progress-playback.test.tsindex 16c17b877..649494b13 100644--- a/apps/web/__tests__/unit/upload-progress-playback.test.ts+++ b/apps/web/__tests__/unit/upload-progress-playback.test.ts@@ -52,6 +52,7 @@ describe("shouldDeferPlaybackSource", () => {status: "error",lastUpdated: new Date(),errorMessage: "Video processing timed out",+ hasRawFallback: false,},true,),@@ -62,6 +63,7 @@ describe("shouldDeferPlaybackSource", () => {status: "error",lastUpdated: new Date(),errorMessage: "Video processing timed out",+ hasRawFallback: false,},false,),@@ -84,6 +86,7 @@ describe("shouldDeferPlaybackSource", () => {status: "error",lastUpdated: new Date(),errorMessage: "Video uploaded, but processing could not start.",+ hasRawFallback: false,},true,),@@ -94,6 +97,7 @@ describe("shouldDeferPlaybackSource", () => {status: "error",lastUpdated: new Date(),errorMessage: null,+ hasRawFallback: false,},false,),diff --git a/apps/web/__tests__/unit/video-recording-software-page.test.ts b/apps/web/__tests__/unit/video-recording-software-page.test.tsindex 843220c4f..85d29d1b6 100644--- a/apps/web/__tests__/unit/video-recording-software-page.test.ts+++ b/apps/web/__tests__/unit/video-recording-software-page.test.ts@@ -143,12 +143,12 @@ describe("VideoRecordingSoftwarePage FAQ schema", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "What is video recording software?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});diff --git a/apps/web/__tests__/unit/video-speed-controller-page.test.ts b/apps/web/__tests__/unit/video-speed-controller-page.test.tsindex 909a156e8..e11982c6b 100644--- a/apps/web/__tests__/unit/video-speed-controller-page.test.ts+++ b/apps/web/__tests__/unit/video-speed-controller-page.test.ts@@ -109,12 +109,12 @@ describe("Video Speed Controller FAQ schema validity", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "How do I change the speed of a video online?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});@@ -164,11 +164,11 @@ describe("Video Speed Controller HowTo schema validity", () => {steps: howToSteps,});- expect(schema.step[0].position).toBe(1);- expect(schema.step[0].name).toBe("Upload your video file");- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);- expect(schema.step[2].name).toBe("Process and download your video");+ expect(schema.step[0]!.position).toBe(1);+ expect(schema.step[0]!.name).toBe("Upload your video file");+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);+ expect(schema.step[2]!.name).toBe("Process and download your video");});it("produces JSON-serializable output", () => {diff --git a/apps/web/__tests__/unit/webm-to-mp4-page.test.ts b/apps/web/__tests__/unit/webm-to-mp4-page.test.tsindex ac8cc998f..e76be34f9 100644--- a/apps/web/__tests__/unit/webm-to-mp4-page.test.ts+++ b/apps/web/__tests__/unit/webm-to-mp4-page.test.ts@@ -114,12 +114,12 @@ describe("WebM to MP4 FAQ schema validity", () => {it("maps each FAQ to a Question entity with acceptedAnswer", () => {const schema = createFAQSchema(faqs);- expect(schema.mainEntity[0]).toEqual({+ expect(schema.mainEntity[0]!).toEqual({"@type": "Question",name: "How do I convert WebM to MP4 online?",acceptedAnswer: {"@type": "Answer",- text: faqs[0].answer,+ text: faqs[0]!.answer,},});});@@ -169,11 +169,11 @@ describe("WebM to MP4 HowTo schema validity", () => {steps: howToSteps,});- expect(schema.step[0].position).toBe(1);- expect(schema.step[0].name).toBe("Upload your WebM file");- expect(schema.step[1].position).toBe(2);- expect(schema.step[2].position).toBe(3);- expect(schema.step[2].name).toBe("Download your MP4");+ expect(schema.step[0]!.position).toBe(1);+ expect(schema.step[0]!.name).toBe("Upload your WebM file");+ expect(schema.step[1]!.position).toBe(2);+ expect(schema.step[2]!.position).toBe(3);+ expect(schema.step[2]!.name).toBe("Download your MP4");});it("produces JSON-serializable output", () => {diff --git a/apps/web/actions/admin/replace-video.ts b/apps/web/actions/admin/replace-video.tsindex 09dd13918..d7af00742 100644--- a/apps/web/actions/admin/replace-video.ts+++ b/apps/web/actions/admin/replace-video.ts@@ -9,7 +9,7 @@ import { getCurrentUser } from "@cap/database/auth/session";import { videos } from "@cap/database/schema";import { serverEnv } from "@cap/env";import { AwsCredentials, S3Buckets } from "@cap/web-backend";-import { S3Bucket } from "@cap/web-domain";+import { S3Bucket, Video } from "@cap/web-domain";import { eq } from "drizzle-orm";import { Effect, Option } from "effect";@@ -32,7 +32,7 @@ async function getVideoOrThrow(videoId: string) {bucket: videos.bucket,}).from(videos)- .where(eq(videos.id, videoId));+ .where(eq(videos.id, Video.VideoId.make(videoId)));if (!video) {throw new Error("Video not found");diff --git a/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsxindex 1bdcdb202..8db9fa5b9 100644--- a/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx+++ b/apps/web/app/(org)/dashboard/_components/Notifications/NotificationItem.tsx@@ -126,7 +126,5 @@ function getLink(notification: APINotification) {case "view":case "anon_view":return `/s/${notification.videoId}`;- default:- return `/s/${notification.videoId}`;}}diff --git a/apps/web/app/api/developer/sdk/v1/[...route]/upload.ts b/apps/web/app/api/developer/sdk/v1/[...route]/upload.tsindex ef8017944..79cfe9a60 100644--- a/apps/web/app/api/developer/sdk/v1/[...route]/upload.ts+++ b/apps/web/app/api/developer/sdk/v1/[...route]/upload.ts@@ -8,7 +8,7 @@ import {import { provideOptionalAuth, S3Buckets } from "@cap/web-backend";import { zValidator } from "@hono/zod-validator";import { and, eq, sql } from "drizzle-orm";-import { Effect } from "effect";+import { Effect, Option } from "effect";import { Hono } from "hono";import { z } from "zod";import { runPromise } from "@/lib/server";@@ -73,7 +73,7 @@ app.post(try {const uploadId = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess();+ const [bucket] = yield* S3Buckets.getBucketAccess(Option.none());const { UploadId } = yield* bucket.multipart.create(s3Key, {ContentType: resolvedContentType,CacheControl: "max-age=31536000",@@ -126,7 +126,7 @@ app.post(try {const presignedUrl = await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess();+ const [bucket] = yield* S3Buckets.getBucketAccess(Option.none());return yield* bucket.multipart.getPresignedUploadPartUrl(s3Key,uploadId,@@ -268,7 +268,7 @@ app.post(}await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess();+ const [bucket] = yield* S3Buckets.getBucketAccess(Option.none());const sortedParts = [...parts].sort((a, b) => a.partNumber - b.partNumber,@@ -338,7 +338,7 @@ app.post(try {await Effect.gen(function* () {- const [bucket] = yield* S3Buckets.getBucketAccess();+ const [bucket] = yield* S3Buckets.getBucketAccess(Option.none());yield* bucket.multipart.abort(s3Key, uploadId);}).pipe(provideOptionalAuth, runPromise);diff --git a/apps/web/app/embed/[videoId]/page.tsx b/apps/web/app/embed/[videoId]/page.tsxindex 179517179..ee56bf3e6 100644--- a/apps/web/app/embed/[videoId]/page.tsx+++ b/apps/web/app/embed/[videoId]/page.tsx@@ -146,6 +146,7 @@ export default async function EmbedVideoPage(height: videos.height,duration: videos.duration,fps: videos.fps,+ firstViewEmailSentAt: videos.firstViewEmailSentAt,hasPassword: sql`${videos.password} IS NOT NULL`.mapWith(Boolean),sharedOrganization: {organizationId: sharedVideos.organizationId,diff --git a/apps/web/app/s/[videoId]/page.tsx b/apps/web/app/s/[videoId]/page.tsxindex 6eafdca3c..8741a78e8 100644--- a/apps/web/app/s/[videoId]/page.tsx+++ b/apps/web/app/s/[videoId]/page.tsx@@ -118,7 +118,7 @@ const ALLOWED_REFERRERS = [function PolicyDeniedView({ reason }: { reason?: string }) {let title = "This video is private";- let description = (+ let description: React.ReactNode = (<>If you own this video, please <Link href="/login">sign in</Link> to managesharing.@@ -329,6 +329,7 @@ export default async function ShareVideoPage(props: PageProps<"/s/[videoId]">) {height: videos.height,duration: videos.duration,fps: videos.fps,+ firstViewEmailSentAt: videos.firstViewEmailSentAt,hasPassword: sql`${videos.password} IS NOT NULL`.mapWith(Boolean),sharedOrganization: {organizationId: sharedVideos.organizationId,diff --git a/apps/web/components/pages/HomePage/InstantModeDetail.tsx b/apps/web/components/pages/HomePage/InstantModeDetail.tsxindex ebd3887eb..f67b1fdd0 100644--- a/apps/web/components/pages/HomePage/InstantModeDetail.tsx+++ b/apps/web/components/pages/HomePage/InstantModeDetail.tsx@@ -112,7 +112,7 @@ const MockSharePage = () => {const observer = new IntersectionObserver(([entry]) => {- if (entry.isIntersecting) {+ if (entry?.isIntersecting) {if (!videoLoadedRef.current) {video.src = "/illustrations/homepage-animation.mp4";videoLoadedRef.current = true;@@ -138,7 +138,10 @@ const MockSharePage = () => {let index = 0;const interval = setInterval(() => {index = (index + 1) % TABS.length;- setActiveTab(TABS[index]);+ const nextTab = TABS[index];+ if (nextTab) {+ setActiveTab(nextTab);+ }}, 3000);return () => clearInterval(interval);}, [tabInteracted]);diff --git a/apps/web/components/pages/HomePage/RecordingModePicker.tsx b/apps/web/components/pages/HomePage/RecordingModePicker.tsxindex 25c2b4e10..4f511de47 100644--- a/apps/web/components/pages/HomePage/RecordingModePicker.tsx+++ b/apps/web/components/pages/HomePage/RecordingModePicker.tsx@@ -101,7 +101,8 @@ const RecordingModePicker = () => {const interval = setInterval(() => {setSelected((prev) => {const currentIndex = modes.findIndex((m) => m.id === prev);- return modes[(currentIndex + 1) % modes.length].id;+ const nextMode = modes[(currentIndex + 1) % modes.length];+ return nextMode ? nextMode.id : prev;});}, AUTO_CYCLE_INTERVAL);@@ -114,7 +115,9 @@ const RecordingModePicker = () => {const observer = new IntersectionObserver(([entry]) => {- setIsInView(entry.isIntersecting);+ if (entry) {+ setIsInView(entry.isIntersecting);+ }},{ threshold: 0.3 },);diff --git a/apps/web/components/pages/HomePage/ScreenshotModeDetail.tsx b/apps/web/components/pages/HomePage/ScreenshotModeDetail.tsxindex 22ffd6e50..5fb6146f7 100644--- a/apps/web/components/pages/HomePage/ScreenshotModeDetail.tsx+++ b/apps/web/components/pages/HomePage/ScreenshotModeDetail.tsx@@ -374,7 +374,7 @@ const MockScreenshotEditor = () => {const observer = new IntersectionObserver(([entry]) => {- if (entry.isIntersecting && !isInView) {+ if (entry?.isIntersecting && !isInView) {setIsInView(true);}},@@ -413,6 +413,7 @@ const MockScreenshotEditor = () => {if (cancelled) return;const next = (current + 1) % AUTO_CONFIGS.length;const cfg = AUTO_CONFIGS[next];+ if (!cfg) return;setGradientIndex(cfg.gradientIndex);setPadding(cfg.padding);setRounded(cfg.rounded);diff --git a/apps/web/components/pages/HomePage/StudioModeDetail.tsx b/apps/web/components/pages/HomePage/StudioModeDetail.tsxindex 34a5642c4..e8b39f71e 100644--- a/apps/web/components/pages/HomePage/StudioModeDetail.tsx+++ b/apps/web/components/pages/HomePage/StudioModeDetail.tsx@@ -283,6 +283,7 @@ const MockEditor = () => {if (cancelled) return;const next = (current + 1) % AUTO_CONFIGS.length;const cfg = AUTO_CONFIGS[next];+ if (!cfg) return;setGradientIndex(cfg.gradientIndex);setPadding(cfg.padding);setRounded(cfg.rounded);diff --git a/apps/web/lib/Notification.ts b/apps/web/lib/Notification.tsindex 9b6cd9558..b5d6989bd 100644--- a/apps/web/lib/Notification.ts+++ b/apps/web/lib/Notification.ts@@ -5,7 +5,7 @@ import { nanoId } from "@cap/database/helpers";import { comments, notifications, users, videos } from "@cap/database/schema";import { buildEnv, serverEnv } from "@cap/env";import type { Notification, NotificationBase } from "@cap/web-api-contract";-import { type Comment, Video } from "@cap/web-domain";+import { type Comment, User, Video } from "@cap/web-domain";import { and, eq, gte, isNull, sql } from "drizzle-orm";import { revalidatePath } from "next/cache";import type { UserPreferences } from "@/app/(org)/dashboard/dashboard-data";@@ -368,7 +368,7 @@ export async function sendFirstViewEmail(const [viewer] = await database.select({ name: users.name, email: users.email }).from(users)- .where(eq(users.id, params.viewerUserId))+ .where(eq(users.id, User.UserId.make(params.viewerUserId))).limit(1);viewerName = viewer?.name || viewer?.email || "Someone";}