GlobalCommands — module-augmentation hook that types the SHARED bus (pinia-style). Augment it once in your app and every useCommand() / getCommandBus() call site gets typed dispatch/register with autocomplete and compile errors:
useCommand()
getCommandBus()
declare module 'vapor-chamber' { interface GlobalCommands { cartAdd: { target: Product; payload: { qty: number }; result: Cart }; cartClear: { target: null; result: Cart }; }}Unaugmented, everything stays exactly as loose as before (string actions,`any` targets). Schema users: derive the entries with `CommandsOf<S>` from'./schema' instead of writing them by hand. Copy
declare module 'vapor-chamber' { interface GlobalCommands { cartAdd: { target: Product; payload: { qty: number }; result: Cart }; cartClear: { target: null; result: Cart }; }}Unaugmented, everything stays exactly as loose as before (string actions,`any` targets). Schema users: derive the entries with `CommandsOf<S>` from'./schema' instead of writing them by hand.
GlobalCommands — module-augmentation hook that types the SHARED bus (pinia-style). Augment it once in your app and every
useCommand()/getCommandBus()call site gets typed dispatch/register with autocomplete and compile errors:Example