@nestjs/mapped-types
Advanced tools
Comparing version 0.4.1 to 1.0.0
import { Type } from '@nestjs/common'; | ||
import { MappedType } from './mapped-type.interface'; | ||
export declare function IntersectionType<A, B>(classARef: Type<A>, classBRef: Type<B>): MappedType<A & B>; | ||
export declare function IntersectionType<A, B>(target: Type<A>, source: Type<B>): MappedType<A & B>; | ||
export declare function IntersectionType<A, B, C>(target: Type<A>, sourceB: Type<B>, sourceC: Type<C>): MappedType<A & B & C>; | ||
export declare function IntersectionType<A, B, C, D>(target: Type<A>, sourceB: Type<B>, sourceC: Type<C>, sourceD: Type<D>): MappedType<A & B & C & D>; |
@@ -5,15 +5,18 @@ "use strict"; | ||
const type_helpers_utils_1 = require("./type-helpers.utils"); | ||
function IntersectionType(classARef, classBRef) { | ||
function IntersectionType(classA, ...classRefs) { | ||
const allClassRefs = [classA, ...classRefs]; | ||
class IntersectionClassType { | ||
constructor() { | ||
type_helpers_utils_1.inheritPropertyInitializers(this, classARef); | ||
type_helpers_utils_1.inheritPropertyInitializers(this, classBRef); | ||
allClassRefs.forEach((classRef) => { | ||
type_helpers_utils_1.inheritPropertyInitializers(this, classRef); | ||
}); | ||
} | ||
} | ||
type_helpers_utils_1.inheritValidationMetadata(classARef, IntersectionClassType); | ||
type_helpers_utils_1.inheritValidationMetadata(classBRef, IntersectionClassType); | ||
type_helpers_utils_1.inheritTransformationMetadata(classARef, IntersectionClassType); | ||
type_helpers_utils_1.inheritTransformationMetadata(classBRef, IntersectionClassType); | ||
allClassRefs.forEach((classRef) => { | ||
type_helpers_utils_1.inheritValidationMetadata(classRef, IntersectionClassType); | ||
type_helpers_utils_1.inheritTransformationMetadata(classRef, IntersectionClassType); | ||
}); | ||
const intersectedNames = allClassRefs.reduce((prev, ref) => prev + ref.name, ''); | ||
Object.defineProperty(IntersectionClassType, 'name', { | ||
value: `Intersection${classARef.name}${classBRef.name}`, | ||
value: `Intersection${intersectedNames}`, | ||
}); | ||
@@ -20,0 +23,0 @@ return IntersectionClassType; |
{ | ||
"name": "@nestjs/mapped-types", | ||
"version": "0.4.1", | ||
"version": "1.0.0", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@mapped-types)", | ||
@@ -22,26 +22,26 @@ "author": "Kamil Mysliwiec", | ||
"devDependencies": { | ||
"@commitlint/cli": "12.0.1", | ||
"@commitlint/config-angular": "12.0.1", | ||
"@nestjs/common": "7.6.15", | ||
"@types/jest": "26.0.22", | ||
"@types/node": "7.10.14", | ||
"@typescript-eslint/eslint-plugin": "4.20.0", | ||
"@typescript-eslint/parser": "4.20.0", | ||
"@commitlint/cli": "12.1.4", | ||
"@commitlint/config-angular": "12.1.4", | ||
"@nestjs/common": "8.0.0", | ||
"@types/jest": "26.0.24", | ||
"@types/node": "14.17.4", | ||
"@typescript-eslint/eslint-plugin": "4.28.2", | ||
"@typescript-eslint/parser": "4.28.2", | ||
"class-transformer": "0.4.0", | ||
"class-validator": "0.13.1", | ||
"eslint": "7.23.0", | ||
"eslint-config-prettier": "8.1.0", | ||
"eslint-plugin-import": "2.22.1", | ||
"husky": "6.0.0", | ||
"jest": "26.6.3", | ||
"lint-staged": "10.5.4", | ||
"prettier": "2.2.1", | ||
"eslint": "7.30.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-import": "2.23.4", | ||
"husky": "7.0.1", | ||
"jest": "27.0.6", | ||
"lint-staged": "11.0.0", | ||
"prettier": "2.3.2", | ||
"reflect-metadata": "0.1.13", | ||
"release-it": "14.5.0", | ||
"release-it": "14.10.0", | ||
"rimraf": "3.0.2", | ||
"ts-jest": "26.5.4", | ||
"typescript": "4.2.3" | ||
"ts-jest": "27.0.3", | ||
"typescript": "4.3.5" | ||
}, | ||
"peerDependencies": { | ||
"@nestjs/common": "^7.0.8", | ||
"@nestjs/common": "^7.0.8 || ^8.0.0", | ||
"class-transformer": "^0.2.0 || ^0.3.0 || ^0.4.0", | ||
@@ -48,0 +48,0 @@ "class-validator": "^0.11.1 || ^0.12.0 || ^0.13.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
22045
332
1