From e09a35b4bd50dce414fef250670b6cd1a5af5d3f Mon Sep 17 00:00:00 2001 From: Ajay Ghanwat Date: Thu, 20 Aug 2026 01:15:35 +0530 Subject: [PATCH] fix(store): give the fix-round-2 regression test explicit generics The single-branch 'shared'-only action fixture failed to infer through defineStore's actions generic, typing store.increment as never and failing bun run typecheck (TS2349) even though bun test passed. Explicit type arguments fix the inference without weakening the test. Co-Authored-By: Claude Opus 5 --- .../store/test/legacy-runtime-removal.test.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/store/test/legacy-runtime-removal.test.ts b/packages/store/test/legacy-runtime-removal.test.ts index 80e9ebde..28b8cd6b 100644 --- a/packages/store/test/legacy-runtime-removal.test.ts +++ b/packages/store/test/legacy-runtime-removal.test.ts @@ -9,7 +9,11 @@ import { createStoreContainer, defineStore } from "../src/index.ts"; // action once `store-codegen.ts` stopped emitting it) and has been removed. // This test locks in the remaining `options.runtime` -> `"shared"` chain so a // future edit can't silently drop the `"shared"` fallback too. -const OnlySharedActionStore = defineStore({ +const OnlySharedActionStore = defineStore< + { count: number }, + Record, + { increment: (amount?: number) => void } +>({ name: "OnlySharedActionStore", kind: "global" as const, createSharedState: () => ({ count: 0 }), @@ -17,12 +21,14 @@ const OnlySharedActionStore = defineStore({ // No "client" or "server" definition exists for this action — only // "shared". A server-runtime container must still resolve it via the // "shared" fallback. - increment: { - runtime: "shared" as const, - handler: ({ state }: any, amount = 1) => { - state.count += amount; + increment: [ + { + runtime: "shared" as const, + handler: ({ state }: any, amount = 1) => { + state.count += amount; + }, }, - }, + ], }, });