nestjs-architects/typed-cqrs
No description provided
Tired of hand-typing types for NestJS CQRS package? We got you covered!
All features provided by @nestjs-architects/typed-cqrs are now available natively in @nestjs/cqrs starting from NestJS 11.
This library will no longer be maintained or developed, but it will still work with NestJS@11 and old versions.
Migrating to @nestjs/cqrs is simple:
@nestjs-architects/typed-cqrs to @nestjs/cqrs.Inferred from IInferredQueryHandler and IInferredCommandHandler – IQueryHandler and ICommandHandler now support its extensions.First install base @nestjs/cqrs package.
$ npm i @nestjs/cqrs
All you need to do, is to extend your query with type of expected response.
import { Query } from '@nestjs-architects/typed-cqrs';
export class GetProfileQuery extends Query<ResultType> {}
Now, when implementing handler, you get all type completion & safety!

import { IInferredQueryHandler, QueryHandler } from '@nestjs/cqrs';
@QueryHandler(GetProfileQuery)
export class GetProfileHandler implements IInferredQueryHandler<GetProfileQuery> {}
As well as, results are correctly typed as well!

No download data available
No tracked packages depend on this.