types(hook): add type declarations and JSDoc for musicKit integration#61
Merged
flexiondotorg merged 4 commits intomainfrom Mar 27, 2026
Merged
types(hook): add type declarations and JSDoc for musicKit integration#61flexiondotorg merged 4 commits intomainfrom
flexiondotorg merged 4 commits intomainfrom
Conversation
- Define SendChannel and ReceiveChannel string literal types to constrain IPC messaging between renderer and main process. - Add SidraHook interface for methods exposed on window.__sidra by the hook script, with Promise return types for async operations. - Add AMWrapperBridge interface for the contextBridge-exposed IPC bridge. - Add SidraCommandMessage interface for the postMessage bridge contract between preload and hook script. - Narrow Set<string> to Set<SendChannel> and Set<ReceiveChannel> in preload to enforce type-checked channel validation. This establishes a type-checkable contract between assets/musicKitHook.js and src/preload.ts, Signed-off-by: Martin Wimpress <code@wimpress.io>
- Document attachToInstance function, event listeners, and message handler in musicKitHook - Document createSvgElement, createButton, and factory functions in navigationBar - Reference type declarations from Phase 1 (SidraHook, SidraCommandMessage) - Clarify COMMANDS set and volume polling fallback behaviour Signed-off-by: Martin Wimpress <code@wimpress.io>
Add two test suites verifying the type contract between SidraHook and the preload at compile time. First suite checks that SidraHook method names match the COMMANDS set; second suite verifies SendChannel and ReceiveChannel types stay in sync with preload definitions. Enables compile-time detection of misalignment between hook script and IPC interface. Signed-off-by: Martin Wimpress <code@wimpress.io>
- Add src/types/hook.d.ts to source structure file listing - Add src/aboutWindow.ts module; remove About window from tray.ts description - Correct showAboutWindow() export location to src/aboutWindow.ts - Document type contract enforcement mechanism in IPC Event Flow section Signed-off-by: Martin Wimpress <code@wimpress.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add comprehensive TypeScript type declarations and JSDoc documentation for the musicKit integration, including window.__sidra interface, IPC channel types, and hook implementations. Enables type-safe communication between renderer and preload contexts.
Changes
Testing