Skip to content

Commit 85d9921

Browse files
tylergraydevTyler Grayclaude
authored
fix(types): close 3 svelte-check errors — sessions prop + invoke mock (#214 PR4) (#227)
Part of the #214 cleanup. Brings `npm run check` from 50 -> 47 errors (closes 3). Scoped to the two genuinely mechanical fixes from #214's proposed PR4 — groups E and M turned out to need real investigation, see below. ## Changes - **Group H** — `routes/sessions/+page.svelte` passed `sessionSummary={sessionStore.selectedSessionSummary}` to `SessionDetailPanel`. Neither side exists anymore: `SessionStoreState` has no `selectedSessionSummary`, and `SessionDetailPanel`'s `Props` is `{ detail, onClose }`. The prop was already dead — removed the line. - **Group K** — `tests/helpers/invokeMock.ts` typed the `invoke` mock implementation's `args` as `Record<string, unknown>`. Tauri's `invoke` signature is `(cmd, args?: InvokeArgs, ...)` and `InvokeArgs` is wider (e.g. `number[]`), so the narrower callback param made the mock unassignable. Widened to `InvokeArgs` and cast at the boundary where it's handed to the ergonomic `handler` callback. ## Deferred from #214's PR4 grouping - **Group E** (keybindings `"Input"` context, 6 errors) — not a fixture cleanup. The tests pass at runtime (31/31) but reference `'Input'`, which is in neither `KEYBINDING_CONTEXTS` nor `KEYBINDING_ACTIONS`; they only pass via cross-test override state. Adding `'Input'` to the `KeybindingContext` union would be a phantom-value behavior change; rewriting the tests needs care around their state dependencies. - **Group M** (`AgentMemoryPanel` `selectedProject`, 1 error) — a latent runtime bug, not drift. `projectsStore` has no project-selection concept at all, so `projectsStore.selectedProject?.path ?? null` is always `null` — the panel's project-scope memory silently never gets a path. Needs a data-flow decision (prop vs. route param). ## Test plan - [x] `npm run check` — 50 errors (down from 53 on `main`) - [x] `npx vitest run` (sessionStore + helpers consumers) — pass - [x] Zero new errors Co-authored-by: Tyler Gray <tylerg@emergentsoftware.net> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent ae71218 commit 85d9921

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/routes/sessions/+page.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
{:else if sessionStore.sessionDetail}
140140
<SessionDetailPanel
141141
detail={sessionStore.sessionDetail}
142-
sessionSummary={sessionStore.selectedSessionSummary}
143142
onClose={() => sessionStore.clearSession()}
144143
/>
145144
{/if}

src/tests/helpers/invokeMock.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { vi } from 'vitest';
22
import { invoke } from '@tauri-apps/api/core';
3+
import type { InvokeArgs } from '@tauri-apps/api/core';
34

45
/**
56
* Set up command-routing mock for Tauri invoke.
@@ -33,7 +34,7 @@ export function mockInvokeResponses(responses: Record<string, unknown>): void {
3334
export function mockInvokeHandler(
3435
handler: (cmd: string, args?: Record<string, unknown>) => unknown
3536
): void {
36-
vi.mocked(invoke).mockImplementation(async (cmd: string, args?: Record<string, unknown>) => {
37-
return handler(cmd, args);
37+
vi.mocked(invoke).mockImplementation(async (cmd: string, args?: InvokeArgs) => {
38+
return handler(cmd, args as Record<string, unknown> | undefined);
3839
});
3940
}

0 commit comments

Comments
 (0)