Typed command map — define action names, target, payload, and result shapes. Use with createCommandBus() for type-safe dispatch and register.
type AppCommands = { cartAdd: { target: { id: number }; payload: { qty: number }; result: void }; cartClear: { target: {}; result: number };};const bus = createCommandBus<AppCommands>();bus.dispatch('cartAdd', { id: 1 }, { qty: 2 }); // fully typed Copy
type AppCommands = { cartAdd: { target: { id: number }; payload: { qty: number }; result: void }; cartClear: { target: {}; result: number };};const bus = createCommandBus<AppCommands>();bus.dispatch('cartAdd', { id: 1 }, { qty: 2 }); // fully typed
Typed command map — define action names, target, payload, and result shapes. Use with createCommandBus() for type-safe dispatch and register.