Setu-TS
    Preparing search index...

    Interface CommandHandlerRegistration

    One command handler and the command type the bus routes to it.

    A PAIR rather than a bare handler because that is exactly what ICommandBus.register(type, handler) takes: the type is a string the command carries, and deriving it from the handler's class name would invent a second source of truth for the same value.

    The handler is typed at ICommandHandler's defaults (CqrsCommand, unknown) so a heterogeneous list of concretely-typed handlers is assignable without any: handle is declared with METHOD syntax, so TypeScript compares its parameter bivariantly even under strictFunctionTypes.

    0.1.0

    interface CommandHandlerRegistration {
        handler:
            | ICommandHandler<CqrsCommand<unknown>, unknown>
            | RegistryFactory<ICommandHandler<CqrsCommand<unknown>, unknown>>;
        type: string;
    }
    Index
    handler:
        | ICommandHandler<CqrsCommand<unknown>, unknown>
        | RegistryFactory<ICommandHandler<CqrsCommand<unknown>, unknown>>

    The handler to register for that type, or a factory that builds one from the service registry.

    An instance registers on the bus during register(). A factory is called at the onInit phase — after every plugin has registered — and its result is registered under this entry's type, so it can resolve a capability (the event bus, the logger) its contract's message parameter cannot carry.

    type: string

    Command type name, matching command.type.