From 8c8e7a4fb5e174130a467da326f0ed3a462e6779 Mon Sep 17 00:00:00 2001 From: jmartin Date: Fri, 24 Jul 2026 12:25:25 -0400 Subject: [PATCH] Fix VimeoEmbed TypeScript player instance types --- client/src/components/VimeoEmbed.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/client/src/components/VimeoEmbed.tsx b/client/src/components/VimeoEmbed.tsx index 450f93e..2860688 100644 --- a/client/src/components/VimeoEmbed.tsx +++ b/client/src/components/VimeoEmbed.tsx @@ -14,14 +14,16 @@ declare global { Player: new ( el: HTMLIFrameElement | HTMLElement, opts?: { id?: string | number; url?: string } - ) => { - on: (event: string, cb: (data?: unknown) => void) => void; - destroy: () => void; - }; + ) => VimeoPlayerInstance; }; } } +type VimeoPlayerInstance = { + on: (event: string, cb: (data?: unknown) => void) => void; + destroy: () => void; +}; + let playerSdkPromise: Promise | null = null; function loadVimeoSdk(): Promise { @@ -57,7 +59,7 @@ export function VimeoEmbed({ videoId, title, watchUrl, poster }: Props) { const embedSrc = `https://player.vimeo.com/video/${videoId}?title=0&byline=0&portrait=0`; useEffect(() => { - let player: { destroy: () => void } | null = null; + let player: VimeoPlayerInstance | null = null; let cancelled = false; setBlocked(false); @@ -66,7 +68,7 @@ export function VimeoEmbed({ videoId, title, watchUrl, poster }: Props) { .then(() => { if (cancelled || !iframeRef.current || !window.Vimeo?.Player) return; player = new window.Vimeo.Player(iframeRef.current); - player.on("error", (data: unknown) => { + player.on("error", (data?: unknown) => { // Privacy / password / unavailable — leave site only as last resort console.warn("Vimeo player error", data); if (!cancelled) setBlocked(true);