Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
@binochoi/nestjs-mapped-types
Advanced tools
Nest - modern, fast, powerful node.js web framework (@mapped-types)
A progressive Node.js framework for building efficient and scalable server-side applications.
This fork removes dependency to @nestjs/common, makes usable mapped types on the browser side
$ npm i --save nestjs-mapped-types
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 typeOmitType
- constructs a type by picking all properties from an input type and then removing a particular set of keysIntersectionType
- combines two types into one new type (class)Read more in this article.
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.
Nest is MIT licensed.
FAQs
Nest - modern, fast, powerful node.js web framework (@mapped-types)
The npm package @binochoi/nestjs-mapped-types receives a total of 2 weekly downloads. As such, @binochoi/nestjs-mapped-types popularity was classified as not popular.
We found that @binochoi/nestjs-mapped-types demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.