method ICommandBus.execute
ICommandBus.execute<TResult = unknown>(command: CqrsCommand): Promise<TResult>

Executes a command.

Type Parameters

TResult = unknown

The expected result type

Parameters

command: CqrsCommand

The command to execute

Return Type

Promise<TResult>

The handler's result

Throws

HandlerNotFoundError

(from the plugin) — as a REJECTION — if no handler is registered for command.type

TypeError

— as a REJECTION — if command.type is not a string

Usage

import { type ICommandBus } from "common/src/index.ts";