Interface ContextQueryDefinition<TQuery, TResult>

Definition for registering a query with its handler within a context.

interface ContextQueryDefinition<
    TQuery extends Query = Query,
    TResult = unknown,
> {
    name: string;
    queryType: new (...args: unknown[]) => TQuery;
    handler: QueryHandler<TQuery, TResult>;
}

Type Parameters

  • TQuery extends Query = Query

    The query type

  • TResult = unknown

    The result type returned by the handler

Properties

name: string

Unique name for the query type.

queryType: new (...args: unknown[]) => TQuery

The query class constructor.

The handler instance for this query.