You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
How does the page see the renderer bridge's type? #228
Does the page get one renderer bridge type derived from the preload plus a Window declaration, replacing the rule that a .ts page file casts window through unknown? Or does the cast stay? Where does the type live so the page still does not import the preload's channel strings?
The page sees the renderer bridge through one declared interface and a Window declaration. No cast.
Declared, not derived. One RendererBridge interface in src/common/rendererBridge.ts, types only. The preload's object is checked against it (satisfies). It is not derived with typeof from the preload, because ipcRenderer.invoke types every result as any.
Reached through Window. A global Window declaration adds rendererBridge, so a page file reads window.rendererBridge with no cast. This replaces the tracker rule that a .ts page file casts window through unknown.
Call sites keep their shape.const { rendererBridge } = window; stays inside each method with only the cast removed. Tests replace window.rendererBridge between cases, so it is not read once at module load.
Crossing payloads are typed once, in main. Main owns the type in both directions: what the page sends, what main returns, and the events main emits. Main exports the types it already declares beside its handlers (StartRunPayload, ModelSelectionPayload, AstralPayload, AlignmentParseResult, CheckOutputResult, SelectedAlignment), and the bridge type file imports them with type-only imports. This is additive exports only, no main behaviour change, and an exception to the coding standard's "inject types stay module-local" for crossing types.
Event payloads have no named type in main today (they go through the send helper in src/main/processHelpers.ts). The leaf that first needs one adds it in main.
The interface grows leaf by leaf. The first leaf names every member and gives it the types that are free: plain parameters and results main already declares. Each later page leaf tightens the members that file calls. The finished interface is the sum of the leaves; it is not written complete on day one.
First leaf. One leaf, before any page file: the bridge type file, src/preload/index.js renamed to .ts and checked against it, the Window declaration, and the cast removed from src/app/bootstrap.ts. Still-JavaScript page files keep their @type {any} cast until their own leaf.
Jest stand-ins stay untyped.jest/setup.js, jest/storeBridge.js and the test files are JavaScript with @ts-nocheck.
For the spec: the leaf updates the Renderer bridge cast rule in docs/agents/issue-tracker.md and notes the crossing-types exception under TypeScript renames in CODING_STANDARDS.md. No glossary change; no ADR.
Activity
jtklein-agents commentedon Nov 16, 2026
Resolution
The page sees the renderer bridge through one declared interface and a
Windowdeclaration. No cast.RendererBridgeinterface insrc/common/rendererBridge.ts, types only. The preload's object is checked against it (satisfies). It is not derived withtypeoffrom the preload, becauseipcRenderer.invoketypes every result asany.Window. A globalWindowdeclaration addsrendererBridge, so a page file readswindow.rendererBridgewith no cast. This replaces the tracker rule that a.tspage file castswindowthroughunknown.const { rendererBridge } = window;stays inside each method with only the cast removed. Tests replacewindow.rendererBridgebetween cases, so it is not read once at module load.StartRunPayload,ModelSelectionPayload,AstralPayload,AlignmentParseResult,CheckOutputResult,SelectedAlignment), and the bridge type file imports them with type-only imports. This is additiveexports only, no main behaviour change, and an exception to the coding standard's "inject types stay module-local" for crossing types.sendhelper insrc/main/processHelpers.ts). The leaf that first needs one adds it in main.src/preload/index.jsrenamed to.tsand checked against it, theWindowdeclaration, and the cast removed fromsrc/app/bootstrap.ts. Still-JavaScript page files keep their@type {any}cast until their own leaf.jest/setup.js,jest/storeBridge.jsand the test files are JavaScript with@ts-nocheck.For the spec: the leaf updates the Renderer bridge cast rule in
docs/agents/issue-tracker.mdand notes the crossing-types exception under TypeScript renames inCODING_STANDARDS.md. No glossary change; no ADR.