Skip to content

Commit dcd637b

Browse files
committed
fix(cli): align snapshot's local InjectFn return type with engine
`injectVideoFramesBatch` now returns `Promise<string[]>` so the caller can filter cache entries to videos the page actually painted. The cli-side snapshot command does not use the return value, but its local `InjectFn` declared `Promise<void>` which made the `as { injectVideoFramesBatch: InjectFn }` cast on the dynamic engine import fail typecheck under TS's "sufficiently overlapping types" rule. Match the engine's actual export shape.
1 parent 93ddea4 commit dcd637b

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/cli/src/commands/snapshot.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,16 @@ async function captureSnapshots(
232232

233233
// Chrome-headless ignores programmatic <video>.currentTime writes, so
234234
// we extract frames via FFmpeg and overlay them as <img> elements.
235+
//
236+
// The engine's injectVideoFramesBatch returns the subset of videoIds it
237+
// actually painted (skipped ancestor-hidden videos are excluded).
238+
// Snapshot doesn't use the return value, but the local type must match
239+
// the real export — a `Promise<void>` shape rejects the `as` cast on
240+
// the dynamic import.
235241
type InjectFn = (
236242
page: unknown,
237243
updates: Array<{ videoId: string; dataUri: string }>,
238-
) => Promise<void>;
244+
) => Promise<string[]>;
239245
type SyncVisibilityFn = (page: unknown, activeVideoIds: string[]) => Promise<void>;
240246
type ExtractMediaMetadataFn = (
241247
filePath: string,

0 commit comments

Comments
 (0)