# @nestjs-architects/typed-cqrs

> Enhance the @nestjs/cqrs building blocks with auto-inferring types.

Latest version **2.1.0** (published 2024-09-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nestjs-architects/typed-cqrs
pnpm add @nestjs-architects/typed-cqrs
yarn add @nestjs-architects/typed-cqrs
bun add @nestjs-architects/typed-cqrs
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2024-09-04 |
| First published | 2021-04-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 31 |
| Maintainers | sikora00 |
| Keywords | nestjs, node.js, cqrs |

## Links

- npm: https://www.npmjs.com/package/@nestjs-architects/typed-cqrs
- Repository: https://github.com/nestjs-architects/typed-cqrs
- Issues: https://github.com/nestjs-architects/typed-cqrs/issues
- npm.io page: https://npm.io/package/@nestjs-architects/typed-cqrs

## Recent versions

- 2.1.0 (latest) — 2024-09-04
- 2.1.0-alpha.0 — 2024-09-04
- 2.0.1 — 2024-07-11
- 2.0.0 — 2024-07-11
- 1.1.2-alpha.0 — 2023-02-06
- 1.1.1 — 2023-02-06
- 1.1.0 — 2023-02-06
- 1.0.1-alpha.0 — 2023-01-31
- 1.0.0 — 2022-02-20
- 0.1.1 — 2021-04-27
- 0.1.1-alpha.0 — 2021-04-27
- 0.1.0 — 2021-04-27
- 0.1.0-alpha.3 — 2021-04-26
- 0.1.0-alpha.2 — 2021-04-24
- 0.1.0-alpha.1 — 2021-04-23

## README

# @nestjs-architects/typed-cqrs

[![version](https://img.shields.io/npm/v/@nestjs-architects/typed-cqrs.svg)](https://www.npmjs.com/package/@nestjs-architects/typed-cqrs)
[![downloads](https://img.shields.io/npm/dt/@nestjs-architects/typed-cqrs.svg)](https://www.npmjs.com/package/@nestjs-architects/typed-cqrs)

Tired of hand-typing types for NestJS CQRS package? We got you covered!

# Usage

First install base `@nestjs/cqrs` package.

```sh
$ npm i @nestjs/cqrs
```

All you need to do, is to extend your query with type of expected response.

```typescript
import { Query } from '@nestjs-architects/typed-cqrs';

export class GetProfileQuery extends Query<ResultType> {}
```

# Profit

Now, when implementing handler, you get all type completion & safety!

![showcase-handler](typed-handler.gif)

```typescript
import { IInferredQueryHandler, QueryHandler } from '@nestjs/cqrs';

@QueryHandler(GetProfileQuery)
export class GetProfileHandler implements IInferredQueryHandler<GetProfileQuery> {}
```

As well as, results are correctly typed as well!
![showcase-handler](typed-outcome.gif)

# Development - verify if package works

After running `npm run build`, run `npm link` from the root directory to have it visible as globally installed package.

Next, in the project you want to use it, within its root directory, run `npm link @nestjs-architects/typed-cqrs`

---
_Source: https://npm.io/package/@nestjs-architects/typed-cqrs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
