Files
SubMiner/backlog/tasks/task-5 - Eliminate-type-duplication-between-renderer.ts-and-types.ts.md
2026-02-11 09:33:47 -08:00

1.5 KiB

id, title, status, assignee, created_date, labels, milestone, dependencies, references, priority
id title status assignee created_date labels milestone dependencies references priority
TASK-5 Eliminate type duplication between renderer.ts and types.ts To Do
2026-02-11 08:20
refactor
types
renderer
Codebase Clarity & Composability
src/renderer/renderer.ts
src/types.ts
src/main.ts
high

Description

renderer.ts locally redefines 20+ interfaces/types that already exist in types.ts: MergedToken, SubtitleData, MpvSubtitleRenderMetrics, Keybinding, SubtitlePosition, SecondarySubMode, all Jimaku/Kiku types, RuntimeOption types, SubsyncSourceTrack, SubsyncManualPayload, etc.

This creates divergence risk — changes in types.ts don't automatically propagate to the renderer's local copies.

Additionally, DEFAULT_MPV_SUBTITLE_RENDER_METRICS and sanitizeMpvSubtitleRenderMetrics() exist only in renderer.ts despite being shared concerns (main.ts also has DEFAULT_MPV_SUBTITLE_RENDER_METRICS).

Acceptance Criteria

  • #1 All shared types are imported from types.ts — no local redefinitions in renderer.ts
  • #2 DEFAULT_MPV_SUBTITLE_RENDER_METRICS lives in one canonical location (types.ts or a shared module)
  • #3 sanitizeMpvSubtitleRenderMetrics moved to a shared module importable by both main and renderer
  • #4 TypeScript compiles cleanly with no type errors
  • #5 Renderer-only types (ChordAction, KikuModalStep, KikuPreviewMode) can stay local