• Stars
    star
    374
  • Rank 114,346 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Configuration module for Nest framework (node.js) 🐺

Nest Logo

A progressive Node.js framework for building efficient and scalable server-side applications.

NPM Version Package License NPM Downloads Coverage Discord Backers on Open Collective Sponsors on Open Collective

Description

Mapped Types module for Nest used by the @nestjs/graphql and @nestjs/swagger packages.

Installation

$ npm i --save @nestjs/mapped-types

Quick Start

As you build out features, it's often useful to construct variants on a base entity type. A good example of such a variant is a Data Transfer Object (DTO). A Data Transfer Object is an object that is used to encapsulate data, and send it from one part of your application to another. DTO’s help us define the input and output interfaces of our system.

Let's imagine a real-world example, where we typically need to build both a create and update variations for the same entity type.

The create variant may require all fields, while the update variant may make all fields optional. Not to mention, both these types can also be variants of an entity type (to some extent).

That's a lot of redundant code!

Thus, NestJS now provides several utility functions that perform type transformations to help us avoid doing this, and make life a little bit easier.

Available mapped types:

  • PartialType - returns a type (class) with all the properties of the input type set to optional (requirement: at least 1 validation decorator applied to each property)
  • PickType - constructs a new type (class) by picking a set of properties from an input type
  • OmitType - constructs a type by picking all properties from an input type and then removing a particular set of keys
  • IntersectionType - combines two types into one new type (class)

Read more in this article.

Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.

Stay in touch

License

Nest is MIT licensed.

More Repositories

1

nest

A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
TypeScript
67,297
star
2

awesome-nestjs

A curated list of awesome things related to NestJS 😎
10,616
star
3

nest-cli

CLI tool for Nest applications 🍹
TypeScript
1,939
star
4

typeorm

TypeORM module for Nest framework (node.js) 🍇
TypeScript
1,906
star
5

typescript-starter

Nest framework TypeScript starter ☕
TypeScript
1,854
star
6

swagger

OpenAPI (Swagger) module for Nest framework (node.js) 🌎
TypeScript
1,671
star
7

graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
TypeScript
1,453
star
8

docs.nestjs.com

The official documentation https://docs.nestjs.com 📕
TypeScript
1,190
star
9

cqrs

A lightweight CQRS module for Nest framework (node.js) 🎈
TypeScript
827
star
10

terminus

Terminus module for Nest framework (node.js) 🤖
TypeScript
668
star
11

throttler

A rate limiting module for NestJS to work with Fastify, Express, GQL, Websockets, and RPC 🧭
TypeScript
619
star
12

bull

Bull module for Nest framework (node.js) 🐮
TypeScript
602
star
13

jwt

JWT utilities module based on the jsonwebtoken package 🔓
TypeScript
599
star
14

mongoose

Mongoose module for Nest framework (node.js) 🍸
TypeScript
520
star
15

config

Configuration module for Nest framework (node.js) 🍓
TypeScript
513
star
16

passport

Passport module for Nest framework (node.js) 🔑
TypeScript
497
star
17

serve-static

Serve static websites (SPA's) using Nest framework (node.js) 🥦
TypeScript
454
star
18

ng-universal

Angular Universal module for Nest framework (node.js) 🌷
TypeScript
441
star
19

elasticsearch

Elasticsearch module based on the official elasticsearch package 🌿
TypeScript
382
star
20

schematics

Nest architecture element generation based on Angular schematics 🎬
TypeScript
382
star
21

schedule

Schedule module for Nest framework (node.js) ⏰
TypeScript
350
star
22

sequelize

Sequelize module for Nest framework (node.js) 🍈
TypeScript
231
star
23

axios

Axios module for Nest framework (node.js) 🗂
TypeScript
219
star
24

event-emitter

Event Emitter module for Nest framework (node.js) 🦋
TypeScript
193
star
25

serverless-core-deprecated

[Deprecated] Serverless Core module for Nest framework (node.js) 🦊
TypeScript
171
star
26

azure-func-http

Azure Functions HTTP adapter for Nest framework (node.js) 🌥
TypeScript
151
star
27

nestjs.com

The official website https://nestjs.com 🏆
HTML
135
star
28

courses.nestjs.com

Official NestJS Courses website https://courses.nestjs.com 🏡
HTML
126
star
29

cache-manager

Cache manager module for Nest framework (node.js) 🗃
TypeScript
118
star
30

javascript-starter

Nest framework JavaScript (ES6, ES7, ES8) + Babel starter 🍰
JavaScript
117
star
31

azure-database

Azure CosmosDB Database module for Nest framework (node.js) ☁️
TypeScript
105
star
32

azure-storage

Azure Storage module for Nest framework (node.js) ☁️
TypeScript
86
star
33

enterprise.nestjs.com

The official website https://enterprise.nestjs.com 🌁
HTML
18
star
34

newsletter.nestjs.com

Official NestJS Newsletter website https://newsletter.nestjs.com 📩
HTML
12
star