nestjs / mapped-types Goto Github PK
View Code? Open in Web Editor NEWConfiguration module for Nest framework (node.js) 🐺
Home Page: https://nestjs.com
License: MIT License
Configuration module for Nest framework (node.js) 🐺
Home Page: https://nestjs.com
License: MIT License
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
I have a abstract base class and want to use OmitType
to omit some properties
abstract class OptionalClass {
@IsOptional()
@IsString()
name?: string | null;
@IsInt()
age!: number;
}
class RequiredClass extends OmitType(OptionalClass, ['name']) {
@IsString()
name: string;
}
RequiredClass
removes name
property from OptionalClass
.
Expect to work properly.
But it shows me this error:
Argument of type 'typeof OptionalClass' is not assignable to parameter of type 'Type<OptionalClass>'.
Cannot assign an abstract constructor type to a non-abstract constructor type.
The above code.
To be able use abstract classes with mapped-types.
@nestjs/mapped-types: ^1.0.0
For Tooling issues:
- Node version: 14.16.1
- Platform: Mac
https://github.com/nestjs/mapped-types/blob/master/package.json#L45
dev dependency is set properly, peer dependency is not. this will also have a downstream impact on @nestjs/swagger
.
(here is the security notice: typestack/class-transformer#339)
class TestDto {
firstname: string;
lastname: string;
@Expose({ toPlainOnly: true })
get fullName() {
return `${this.firstname} ${this.lastname}`;
}
}
class PickTestDto extends PickType(TestDto, [] as const) {}
@Get('picktype')
getPickTypeTest(): TestDto {
const instance = plainToInstance(PickTestDto, {
firstname: 'John',
lastname: 'Doe',
});
const plain = instanceToPlain(instance);
return plain as unknown as TestDto;
}
The API returns: {"firstname":"John","lastname":"Doe"}
https://github.com/erikash/picktype
pnpm start:dev
curl http://localhost:3000/picktype
use this to see the expected result
3. curl http://localhost:3000/inheritence
I would expect the Expose
on get fullName
to be inherited and the API to return{"firstname":"John","lastname":"Doe","fullName":"John Doe"}
as per step 3) above.
2.0.5
18.17.1
No response
Using IntersectionType
on more than 4 classes produces a TypeScript error.
n/a
class ClassA {}
class ClassB {}
class ClassC {}
class ClassD {}
class ClassE {}
IntersectionType(ClassA, ClassB, ClassC, ClassD, ClassE)
<snip>:10:50 - error TS2554: Expected 2-4 arguments, but got 5.
8 IntersectionType(ClassA, ClassB, ClassC, ClassD, ClassE)
~~~~~~
TypeScript does not complain about more than four arguments.
1.1.0
18.7.0
I suspect this is because the declaration file in the compiled library does not have the wildcard clause. I'm not sure if that is intended or if there is a workaround.
First install class-validator: npm install class-validator
. This will install currently version 0.14.0
Afterwards install mapped-types: npm install @nestjs/mapped-types
This fails with a npm error unable to resolve dependency tree.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/class-validator
npm ERR! class-validator@"^0.14.0" from the root project
npm ERR! peerOptional class-validator@"*" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/common
npm ERR! @nestjs/common@"^9.0.0" from the root project
npm ERR! peer @nestjs/common@"^7.0.8 || ^8.0.0 || ^9.0.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/mapped-types
npm ERR! @nestjs/mapped-types@"^1.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional class-validator@"^0.11.1 || ^0.12.0 || ^0.13.0" from @nestjs/[email protected]
npm ERR! node_modules/@nestjs/mapped-types
npm ERR! @nestjs/mapped-types@"^1.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Just following your NestJS course.
Added some random nestjs example public repo in which it also occurs.
https://github.com/hantsy/nestjs-rest-sample
npm i class-validator
npm i @nestjs/mapped-types
Should install without errors.
1.2.0
16.19.0
No response
[ ] Regression
[ x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
When two DTO classes are combine into one through IntersectionType(A,B), default values are missing.
Controller
import {
Controller,
Get,
Post,
Body,
UsePipes,
ValidationPipe,
Logger,
} from '@nestjs/common';
import { AppService } from './app.service';
import { combineDto } from './dto/CreateUserDto.dto';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get()
getHello(): string {
return this.appService.getHello();
}
@Post()
@UsePipes(new ValidationPipe({ transform: true }))
create(@Body('table') dto: combineDto) {
Logger.debug(dto);
return 'This action adds a new user';
}
}
DTO:
import { IsString, IsArray } from 'class-validator';
import { IntersectionType } from '@nestjs/swagger';
export class DtoA {
@IsArray()
table: number[] = [1, 2, 3, 4];
}
export class DtoB {
@IsString()
text: string = 'test';
}
export class combineDto extends IntersectionType(DtoA, DtoB) {}
Request:
:PORT=3000
POST http://localhost::PORT/
Content-Type: application/json
[]
Response
{
"statusCode": 400,
"message": [
"table must be an array",
"text must be a string"
],
"error": "Bad Request"
}
// POST http://localhost:3000/
// HTTP/1.1 400 Bad Request
// X-Powered-By: Express
// Content-Type: application/json; charset=utf-8
// Content-Length: 101
// ETag: W/"65-SZ7wO0aLvWpcz1ckl5CCuSRtItI"
// Date: Mon, 26 Oct 2020 16:45:12 GMT
// Connection: keep-alive
// Request duration: 0.051707s
For one DTO:
@Post()
@UsePipes(new ValidationPipe({ transform: true }))
create(@Body('table') dto: DtoA) {
Logger.debug(dto);
return 'OK';
}
Response
OK
<!-- POST http://localhost:3000/ -->
<!-- HTTP/1.1 201 Created -->
<!-- X-Powered-By: Express -->
<!-- Content-Type: text/html; charset=utf-8 -->
<!-- Content-Length: 2 -->
<!-- ETag: W/"2-nOO9QiTIwXgNtWtBJezz8kv3SLc" -->
<!-- Date: Mon, 26 Oct 2020 16:50:52 GMT -->
<!-- Connection: keep-alive -->
<!-- Request duration: 0.021819s -->
Log:
[5:50:04 PM] File change detected. Starting incremental compilation...
[5:50:04 PM] Found 0 errors. Watching for file changes.
[Nest] 12954 - 10/26/2020, 5:50:04 PM [NestFactory] Starting Nest application...
[Nest] 12954 - 10/26/2020, 5:50:04 PM [InstanceLoader] AppModule dependencies initialized +14ms
[Nest] 12954 - 10/26/2020, 5:50:04 PM [RoutesResolver] AppController {}: +5ms
[Nest] 12954 - 10/26/2020, 5:50:04 PM [RouterExplorer] Mapped {, GET} route +3ms
[Nest] 12954 - 10/26/2020, 5:50:04 PM [RouterExplorer] Mapped {, POST} route +1ms
[Nest] 12954 - 10/26/2020, 5:50:04 PM [NestApplication] Nest application successfully started +3ms
[Nest] 12954 - 10/26/2020, 5:50:04 PM Listen to port : 3000 +5ms
[Nest] 12954 - 10/26/2020, 5:50:52 PM Object:
{
"table": [
1,
2,
3,
4
]
}
+47510ms
We should be able to combine two classes, with default value properties.
Combined class shall get all default values;
export class combineDto extends IntersectionType(DtoA, DtoB) {
@IsArray()
table: number[] = [1, 2, 3, 4];
@IsString()
text: string = 'test';
}
OK
<!-- POST http://localhost:3000/ -->
<!-- HTTP/1.1 201 Created -->
<!-- X-Powered-By: Express -->
<!-- Content-Type: text/html; charset=utf-8 -->
<!-- Content-Length: 2 -->
<!-- ETag: W/"2-nOO9QiTIwXgNtWtBJezz8kv3SLc" -->
<!-- Date: Mon, 26 Oct 2020 17:43:57 GMT -->
<!-- Connection: keep-alive -->
<!-- Request duration: 0.053858s -->
[6:44:15 PM] File change detected. Starting incremental compilation...
[6:44:16 PM] Found 0 errors. Watching for file changes.
[Nest] 20063 - 10/26/2020, 6:44:16 PM [NestFactory] Starting Nest application...
[Nest] 20063 - 10/26/2020, 6:44:16 PM [InstanceLoader] AppModule dependencies initialized +13ms
[Nest] 20063 - 10/26/2020, 6:44:16 PM [RoutesResolver] AppController {}: +5ms
[Nest] 20063 - 10/26/2020, 6:44:16 PM [RouterExplorer] Mapped {, GET} route +3ms
[Nest] 20063 - 10/26/2020, 6:44:16 PM [RouterExplorer] Mapped {, POST} route +2ms
[Nest] 20063 - 10/26/2020, 6:44:16 PM [NestApplication] Nest application successfully started +2ms
[Nest] 20063 - 10/26/2020, 6:44:16 PM Listen to port : 3000 +5ms
test
combineDto { table: [ 1, 2, 3, 4 ], text: 'test' }
[Nest] 20063 - 10/26/2020, 6:45:59 PM Object:
{
"table": [
1,
2,
3,
4
],
"text": "test"
}
+103031ms
(https://github.com/tosiek88/nest_research)
"@nestjs/common": "^7.0.0",
"@nestjs/core": "^7.0.0",
"@nestjs/mapped-types": "^0.1.0",
"@nestjs/platform-express": "^7.0.0",
"@nestjs/swagger": "^4.6.1",
For Tooling issues:
- Node version: v10.19
- Platform: Linux
When running npm run lint
locally, the command does not complete due to an error:
$ npm run lint
> @nestjs/[email protected] lint
> eslint 'lib/**/*.ts' --fix
Oops! Something went wrong! :(
ESLint: 8.32.0
Error: Cannot read config file: /Users/rossm/projects/mapped-types/node_modules/eslint-config-prettier/@typescript-eslint.js
Error: "prettier/@typescript-eslint" has been merged into "prettier" in eslint-config-prettier 8.0.0. See: https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md#version-800-2021-02-21
Referenced from: /Users/rossm/projects/mapped-types/.eslintrc.js
at Object.<anonymous> (/Users/rossm/projects/mapped-types/node_modules/eslint-config-prettier/@typescript-eslint.js:1:7)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Module.require (node:internal/modules/cjs/loader:1105:19)
at module.exports [as default] (/Users/rossm/projects/mapped-types/node_modules/import-fresh/index.js:31:59)
at loadJSConfigFile (/Users/rossm/projects/mapped-types/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2562:47)
at loadConfigFile (/Users/rossm/projects/mapped-types/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2646:20)
at ConfigArrayFactory._loadConfigData (/Users/rossm/projects/mapped-types/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2963:42)
Not applicable -- reproducible from command line alone
npm run lint
$ npm run lint
Output:
> @nestjs/[email protected] lint
> eslint 'lib/**/*.ts' --fix
1.2.0
18.13.0
No response
The code published to NPM does not correspond with github code, root package.json doesn't seem to be receiving version bumps to properly publish
N/A
yarn add @nestjs/mapped-types
Installing this package should use the latest version. Bumping dependency versions in the package.json should at some point result in a build that can be pulled down and installed
1.0.0
No response
I am specifically attempting to resolve the class-transformer warnings I am getting while installing. The fix appears to already be in the code here, but I can't pull it in
Can't inherit getter/setter and function.
import { PickType } from "@nestjs/mapped-types";
class A {
foo: number;
bar: number;
get baz() {
return this.foo;
}
}
class B extends PickType(A, ['foo', 'baz']) {}
const b = new B();
b.foo = 1;
console.log(b.baz); // undefined
https://github.com/CodyTseng/example/blob/master/mapped-types/index.js
No response
Can inherit getter/setter and function.
import { PickType } from "@nestjs/mapped-types";
class A {
foo: number;
bar: number;
get baz() {
return this.foo;
}
}
class B extends PickType(A, ['foo', 'baz']) {}
const b = new B();
b.foo = 1;
console.log(b.baz); // 1
1.1.0
16.14.2
No response
import { IntersectionType, PartialType } from '@nestjs/mapped-types';
import { IsOptional, IsString } from 'class-validator';
class MandatoryField {
@IsString()
public my_test: string;
}
class OtherFields {
@IsOptional()
@IsString()
public my_optional_field?: string;
}
class MyCombinaison extends IntersectionType(
PartialType(MandatoryField),
OtherFields,
) {}
function t(r: MyCombinaison) {
console.debug(r);
}
t({});
# Argument of type '{}' is not assignable to parameter of type 'MyCombinaison'.
Type '{}' is missing the following properties from type 'MyCombinaison': my_test, my_optional_field
Here I expect to have only optional parameter, but they are all mandatory.
When I use @nestjs/swagger, no issue.
Also version < 2 works as expected.
All fields above should be optional.
2.0.1
v18.16.0
No response
UpdateUserDto allow { name: null }
thereby giving validation issues
QueryFailedError: SqliteError: NOT NULL constraint failed: user.name
For ORM, null and undefined usually have different meanings
usersRepository.update({ name: null })
means update user.name
to null
usersRepository.update({ name: undefined })
means don't update user.name
I think that PartialType should not use the @IsOptional()
decorator, but should use @ValidateIf((_object, value) => value !== undefined)
https://github.com/yodhcn/mapped-types-example
npm i
npm start
QueryFailedError: SqliteError: NOT NULL constraint failed: user.name
UpdateUserDto should allow { name: undefined }
, but should not allow { name: null }
1.1.0
16.17.0
No response
When running with nest start, it works as expected. When running with build --webpack, it fails because it cannot find some path. This seems to have been removed by upstream (typestack/class-transformer#563)
Implemented the proposed solution in the link
https://github.com/hjf/mapped-types-bug
It should build with no errors
1.0.0
14.17.4
No response
I'm trying to interect two classes to obtain a dto like that:
export class QueryPageDto extends IntersectionType(PartialType(OmitType(CreatePageDto,['metafields','translations'])),PaginationDTO) {}
export default class PaginationDTO {
@ApiProperty({
minimum: 1,
default: 1,
})
@IsNumber()
@IsOptional()
@IsInt()
@Min(1)
@Type(() => Number)
readonly page?:number = 1;
@ApiProperty({
minimum: 1,
maximum: 250,
default: 50,
})
@IsNumber()
@IsOptional()
@IsInt()
@Min(1)
@Max(250)
@Type(() => Number)
readonly limit?:number = 50;
get skip(): number {
return (this.page - 1) * this.limit;
}
get take(): number {
return this.limit;
}
}
but when i type queryPageDto.skip (or take) also if is suggested they always returns undefined
i tried that whitout IntersectionType and obviously works.
No response
I'm expecting returning values
2.0.5
20.11.0
"@nestjs/mapped-types": "*",
"@nestjs/swagger": "^7.2.0",
This feature is related to my issue that closed without any solution.
Previous issue:
#471
We can create inheritMethods
function like this:
export function inheritMethods(
parentClass: Type<any>,
targetClass: Function,
isPropertyInherited?: (key: string) => boolean,
) {
Object.getOwnPropertyNames(parentClass.prototype)
.filter(
(propertyName) =>
!isPropertyInherited || isPropertyInherited(propertyName),
)
.forEach((name) => {
Object.defineProperty(
targetClass.prototype,
name,
Object.getOwnPropertyDescriptor(parentClass.prototype, name) ||
Object.create(null),
);
});
}
and edit omit-type.helper.ts
like this:
import { Type } from '@nestjs/common';
import { MappedType } from './mapped-type.interface';
import {
inheritPropertyInitializers,
inheritTransformationMetadata,
inheritValidationMetadata,
inheritMethods,
} from './type-helpers.utils';
export function OmitType<T, K extends keyof T>(
classRef: Type<T>,
keys: readonly K[],
): MappedType<Omit<T, typeof keys[number]>> {
const isInheritedPredicate = (propertyKey: string) =>
!keys.includes(propertyKey as K);
abstract class OmitClassType {
constructor() {
inheritPropertyInitializers(this, classRef, isInheritedPredicate);
}
}
inheritValidationMetadata(classRef, OmitClassType, isInheritedPredicate);
inheritTransformationMetadata(classRef, OmitClassType, isInheritedPredicate);
inheritMethods(classRef, OmitClassType, isInheritedPredicate);
return OmitClassType as MappedType<Omit<T, typeof keys[number]>>;
}
and add inheritMethods(classRef, OmitClassType, isInheritedPredicate);
too all type helpers.
We just need to add this function in type-helpers.utils.ts
export function inheritMethods(
parentClass: Type<any>,
targetClass: Function,
isPropertyInherited?: (key: string) => boolean,
) {
Object.getOwnPropertyNames(parentClass.prototype)
.filter(
(propertyName) =>
!isPropertyInherited || isPropertyInherited(propertyName),
)
.forEach((name) => {
Object.defineProperty(
targetClass.prototype,
name,
Object.getOwnPropertyDescriptor(parentClass.prototype, name) ||
Object.create(null),
);
});
}
and use it in all type-helpers.
We can now inherit methods using type helpers
I follow along the official NestJs Course. In the input validation chapter, mapped-types are installed and the UpdateCoffeeDto class should extend PartialType.
However i cannot import the PartialType clase, because of the error message:
Module '"@nestjs/mapped-types"' has no exported member 'PartialType'.
https://github.com/GBeushausen/nestjs-course
No response
The PartialType class should be importable
?
14.15.5
No response
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
[ ] Regression
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
class A {
constructor(a: string) {}
}
class B {
constructor(b: number) {}
}
class C extends IntersectionType(A, B) {
constructor() {
super();// <- hint `Type(...args: any[]): A & B` shown here
}
}
I've checked the source code, found that for each mapped type, a new class with no constructor is created, and "base"(?) classes's constructor are never called.
Add a new type
export type MappedType<T> = new () => T
as return type of mapped types.
This can clearify the constuctor parameter of mapped types, implies that constructors of base classes will not be called.
Nest version: 7.1.3
For Tooling issues:
- Node version: XX
- Platform:
Others:
#339 (comment)
After comment @jmcdo29 I've checked override behaviour and found a bug
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
class ClassA {
@MinLength(10)
@Transform(({ value }) => value + '_transformed')
login = 'default';
@Transform(({ value }) => value + '_transformed')
@MinLength(10)
password!: string;
}
class ClassB {
@IsString()
@Transform(({ value }) => value + '_transformed2')
login = 'default2';
@Transform(({ value }) => value + '_transformed')
@MinLength(5)
lastName!: string;
}
class UpdateUserDto extends IntersectionType(ClassA, ClassB) {}
// 1) overwrite property initializers
const updateUserDto = new UpdateUserDto();
// Expected: "default2"
// Received: "default"
expect(updateUserDto.login).toEqual('default2');
// 2) Is it better to remove older ValidationMetadata decorator properties from ClassA?
const validationErrors = await validate(updateDto);
console.log(validationErrors[0]);
ValidationError {
target: UpdateUserDto { login: 'default', password: '1234567' },
value: 'default',
property: 'login',
children: [],
constraints: {
minLength: 'login must be longer than or equal to 10 characters'
}
}
1) override property initializers
const updateUserDto = new UpdateUserDto();
// Expected: "default2"
console.log(updateUserDto.login);
master...trycontrolmymind:test/intersection-overwrite
git clone [email protected]:trycontrolmymind/mapped-types.git
yarn test:e2e
If anyone wants to rewrite behaviour of the proporty from ClassB to ClassA, he will encounter with strange override behaviour.
- Nestjs v7.6.15
- Platform: Linux
- Nodejs: v14.16.0
Others:
Same issue from Nestjs/swagger#2659
I have three class:
class Grandparent {
@Expose()
@Transform(function grandparentTransform() {
transformExecuteSequenceList.push(Grandparent.name);
return 0;
})
value!: number;
}
class Parent extends Grandparent {
@Transform(function parentTransform() {
transformExecuteSequenceList.push(Parent.name);
return 1;
})
value!: number;
}
class Children extends PickType(Parent, ["value"]) {
@Transform(function childrenTransform(params) {
transformExecuteSequenceList.push(Children.name);
return params.value;
})
value!: number;
}
Execute
const children = plainToInstance(Children, {});
console.log({ transformExecuteSequenceList, childrenValue: children.value });
It should be
{
transformExecuteSequenceList: [ 'Grandparent', 'Parent', 'Children' ],
childrenValue: 1
}
Children ignored Parent's Transform function.
https://github.com/KuanWenChen/mapped-types-issue
Result should be:
{
transformExecuteSequenceList: [ 'Grandparent', 'Parent', 'Children' ],
childrenValue: 1
}
^2.0.2
v20.9.0
No response
[x] Feature request
Could you add RequiredType besides to PartialType that already exists, please?
Or whether any other variant with the type optional fields are created into with the same fields required.
Hi,
I am currently trying to build a monorepo (using nrwl/nx) with both nestjs as a backend and nextjs as a frontend. My idea was to write DTOs in a single shared lib across my backend and frontend. The problem is that @nestjs/mapped-types uses @nestjs/common and I don't think it would be the best idea to have it has a dependency in my client side application.
But since I am fairly new to this ecosystem I could be mistaken. Maybe since it is in a monorepo, the tree shaking that should occur during the build of my nextjs application would remove the unused dependencies? Or is it not that simple?
I still have the same problem with nestjs/swagger dependency which I use to decorate my DTOs, but I think I could work around it using the cli plugin but that's just another matter I guess.
Make @nestjs/mapped-types independent of @nestjs/common if possible
N/A
It would make using @nestjs/mapped-types possible on client side applications
In version 2.0.0 we are getting this error. user Partial
https://github.com/nestjs/mapped-types
install @nestjs/mapped-types with 2.0.0 version
User "Partial" method from it.
Getting the error like: Class 'CreateUserDto' incorrectly extends base class 'RemoveFieldsWithType<Partial, Function>'.
Property 'status' is optional in type 'CreateUserDto' but required in type 'RemoveFieldsWithType<Partial, Function>'.
This error should not come.
2.0.0
14.21.3
No response
2.0.0 -> 2.0.3
sample entities hierarchy:
abstract class BaseEntityHelper {
@IsUUID()
@Expose()
id!: string | number;
@Expose()
anotherField!: string;
}
class SampleEntity extends BaseEntityHelper {
@Expose()
@IsUUID()
override id!: string;
@Expose()
@IsString()
name!: string;
}
class SampleEntityDto extends OmitType(SampleEntity, ['name'] as const) {
}
So we have an abstract class with an id that can be a number or string overriding it and exposing it. Using omit type to create DTO, that has just a name field.
Let's implement a simple test:
it('instance to instance', () => {
let sampleEntityWithoutId = new SampleEntity();
sampleEntityWithoutId.id = 'just id';
sampleEntityWithoutId.name = 'name';
sampleEntityWithoutId.anotherField = 'anotherField';
let dto = plainToInstance(SampleEntityDto, sampleEntityWithoutId, {
excludeExtraneousValues: true,
exposeDefaultValues: true,
ignoreDecorators: true,
exposeUnsetFields: false,
});
let justCopy = plainToInstance(SampleEntity, sampleEntityWithoutId, {
excludeExtraneousValues: true,
exposeDefaultValues: true,
ignoreDecorators: true,
exposeUnsetFields: false,
});
// this is failing but should be ok
expect(dto.anotherField).toEqual('anotherField');
})
The error is handled over here
this behavior recently changed, and it's a breaking change for this case at least.
I'm ok to fix it by myself, just some comments from maintainers on expected behavior will be good to hear
as for me we should apply the most closest decorators or probably merge it somehow, but not sure is it that obvious to do the merge or no
No response
provided
need suggestion
No response
please release a new (patch?) version after the added support to [email protected]
in #292
This blocks me from upgrading class-transformer
.
Thanks!
In lib/types/remove-fields-with-type.type.ts
, we have:
type KeysWithType<T, Type> = {
[K in keyof T]: T[K] extends Type ? K : never;
}[keyof T];
export type RemoveFieldsWithType<T, Type> = Exclude<T, KeysWithType<T, Type>>;
I suspect that Omit
should be used instead of Exclude
in type RemoveFieldsWithType
because Exclude<T, U>
“excludes from T
those types that are assignable to U
”, whereas type Omit<T, K extends keyof any>
“constructs a type with the properties of T
except for those in type K
”, which seems more what we want here.
You can see in the minimum reproduction code linked below a scenario where the type does not behaves correctly. Correct me if I've missed anything :).
https://gist.github.com/brkaisin/a305464bb3e3a25230a51329a929bdcc
Just having the NestJS mapped types dependency.
I think we should not have the error we see in the the minimum reproduction code.
2.0.5
21.7.1
No response
This repo has an hardcoded dependency to "class-validator:0.13.2" which is flagged as security risk. I can't update my project as this dependency breaks the update.
Update the dependency to version "0.14.0".
NA
So I can update my project to no include dependencies that are flagged as security risks.
[ ] Regression
[x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Error when using PartialType
from '@nestjs/mapped-types'
.
[Nest] 99355 - 01/14/2021, 2:38:25 PM [MappedTypes] Transformer ("class-transformer") metadata cannot be inherited for "CreateCoffeeDto" class.
[Nest] 99355 - 01/14/2021, 2:38:25 PM [MappedTypes] Object:
Create a variant from a dto
to avoid code redundancy
https://gist.github.com/gmwill934/c3c68650f773018aa8c656697ea2c625
{
"name": "iluvcoffee",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^7.5.1",
"@nestjs/core": "^7.5.1",
"@nestjs/mapped-types": "^0.1.1",
"@nestjs/platform-express": "^7.5.1",
"@nestjs/typeorm": "^7.1.5",
"class-transformer": "^0.3.2",
"class-validator": "^0.13.1",
"pg": "^8.5.1",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^6.6.3",
"typeorm": "^0.2.30"
},
"devDependencies": {
"@nestjs/cli": "^7.5.1",
"@nestjs/schematics": "^7.1.3",
"@nestjs/testing": "^7.5.1",
"@types/express": "^4.17.8",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.6",
"@types/supertest": "^2.0.10",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"eslint": "^7.12.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.6.3",
"prettier": "^2.1.2",
"supertest": "^6.0.0",
"ts-jest": "^26.4.3",
"ts-loader": "^8.0.8",
"ts-node": "^9.0.0",
"tsconfig-paths": "^3.9.0",
"typescript": "^4.0.5"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^.+\\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
Nest version: 7.5.1
For Tooling issues:
- Node version: 14.15.1
- Platform: Mac
- Using npm
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
package.json
@commitlint/cli 19.3.0
@commitlint/config-angular 19.3.0
@nestjs/common 10.3.10
@types/jest 29.5.12
@types/node 20.14.12
@typescript-eslint/eslint-plugin 7.17.0
@typescript-eslint/parser 7.17.0
class-transformer 0.5.1
class-validator 0.14.1
eslint 8.57.0
eslint-config-prettier 9.1.0
eslint-plugin-import 2.29.1
husky 9.1.1
jest 29.7.0
lint-staged 15.2.7
prettier 3.3.3
reflect-metadata 0.2.2
release-it 17.6.0
rimraf 6.0.1
ts-jest 29.2.3
typescript 5.5.4
@nestjs/common ^8.0.0 || ^9.0.0 || ^10.0.0
class-transformer ^0.4.0 || ^0.5.0
class-validator ^0.13.0 || ^0.14.0
reflect-metadata ^0.1.12 || ^0.2.0
As the title says, using a PartialType inside a PickType will result in a type error.
I'm guessing this is due to the generic not being properly typed.
class CreateOneSomeThing {
@IsString()
name: string;
@IsNumber()
age: number;
}
export class UpdateOneSomeThing extends PickType(
PartialType(CreateOneSomeThing),
[], // Argument of type 'undefined[]' is not assignable to parameter of type 'readonly never[]'.
Type 'undefined' is not assignable to type 'never'.
) {}
export class UpdateOneSomeThingAndPickTypeArrayString extends PickType(
PartialType(CreateOneSomeThing),
['age'], // Type 'string' is not assignable to type 'never'.
) {}
This would solve it, but it would require me to modify too much of my code. This code worked fine the first time I used it, and I haven't updated the version (stayed on 2.0.2 for 5 months), so why is this happening?
export class UpdateOneSomeThingAndPickTypeArrayString extends PickType<
Partial<CreateOneSomeThing>,
keyof CreateOneSomeThing
>(PartialType(CreateOneSomeThing), ['age']) {}
I'm using a translator, so please excuse any awkward sentences.
No response
I'm only getting type errors and no errors are being detected in nest, build is fine I hope it's my version of typescript T.T
2.0.2
21.1.0
"dependencies": {
"@arendajaelu/nestjs-passport-apple": "^1.0.4",
"@nestjs/axios": "^3.0.0",
"@nestjs/cache-manager": "^2.1.0",
"@nestjs/common": "^10.0.0",
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.0.0",
"@nestjs/jwt": "^10.1.0",
"@nestjs/mapped-types": "^2.0.2",
"@nestjs/mongoose": "^10.0.1",
"@nestjs/passport": "^10.0.1",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/schedule": "^3.0.3",
"@nestjs/serve-static": "^4.0.0",
"@nestjs/swagger": "^7.1.8",
...
}
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
@Entity()
export class User {
// ...
// TOP SECRET
@Column()
@IsString()
@IsNotEmpty()
secret!: string;
// ...
}
import { OmitType } from '@nestjs/mapped-types';
import { User } from '../entities/user.entity';
export class UserDto extends OmitType(User, ['secret'] as const) {
// WORKAROUND to prevent leaking `secret` to public
secret?: never;
}
export const userToDto = ({ secret, ...dto }: User): UserDto => dto;
// without the above workaround (`secret?: never`)
@Get('/user')
getUser(): UserDto {
// find user
return user; // no error, user contains secret
}
// with the workaround
@Get('/user')
getUser(): UserDto {
// find user
// return user; // error!
return userToDto(user);
}
import { OmitType, ExactType } from '@nestjs/mapped-types';
import { User } from '../entities/user.entity';
export class UserDto extends ExactType(OmitType(User, ['secret'] as const)) {}
Hi folks, thanks to the nestjs team for the great work.
Is it possible to add Exact
type?
One use case is not leaking secret information as mentioned above.
Thank you.
We are using nesjs in a mono repo setup. To share DTOs between nestjs server app and react client app, we include them in the shared library. We are using class-transformer.plainToClass() on both server and client to transform objects into request and response DTOs respectively.
We found out that mapped types are transformed correctly on server but not in the browser if we use [email protected]+.
It works fine on both server and browser with class-transformer0.3.1. Here's an example
(Using {excludeExtraneousValues: true}
as the options object to plainToClass())
export class ReferralDto {
@Expose()
@IsString()
id: string;
@Expose()
@IsString()
refNum: string;
@Expose()
@IsString()
firstName: string;
@Expose()
@IsString()
lastName: string;
@Expose()
@Type(() => Date)
@IsDate()
dob: Date;
@Expose()
@IsString()
@IsOptional()
healthCardNumber: string | null;
@Expose()
@IsString()
@IsOptional()
email: string | null;
@Expose()
@IsString()
@IsOptional()
phone: string | null;
@Expose()
@IsString()
@IsOptional()
streetAddress: string | null;
@Expose()
@IsString()
@IsOptional()
city: string | null;
@Expose()
@IsString()
@IsOptional()
state: string | null;
@Expose()
@IsString()
@IsOptional()
country: string | null;
@Expose()
@IsString()
@IsOptional()
postalCode: string | null;
@Expose()
@IsString()
referrerFirstName: string;
@Expose()
@IsString()
referrerLastName: string;
@Expose()
@IsString()
referrerProviderNumber: string;
@Expose()
@IsString()
referrerEmail: string;
@Expose()
@IsString()
@IsOptional()
clinicName: string | null;
@Expose()
@IsString()
@IsOptional()
referrerPhone: string | null;
@Expose()
@IsString()
@IsOptional()
referrerFax: string | null;
@Expose()
@IsString()
@IsOptional()
referrerStreetAddress: string | null;
@Expose()
@IsString()
@IsOptional()
referrerCity: string | null;
@Expose()
@IsString()
@IsOptional()
referrerState: string | null;
@Expose()
@IsString()
@IsOptional()
referrerCountry: string | null;
@Expose()
@IsString()
@IsOptional()
referrerPostalCode: string | null;
@Expose()
@Type(() => Date)
@IsDate()
updatedAt: Date;
@Expose()
@Type(() => Date)
@IsDate()
createdAt: Date;
@Expose()
@IsString()
status: ReferralStatus;
@Expose()
@IsOptional()
@Type(() => ShortUserDto)
assignedProgramFacilitator: ShortUserDto | null;
@Expose()
@IsString()
program: Program;
@Expose()
@IsOptional()
@Type(() => ShortUserDto)
updatedBy: ShortUserDto | null;
@Expose()
@IsBoolean()
requiredFieldsCheckPassed: boolean;
}
import { PickType } from '@nestjs/mapped-types';
import { ReferralDto } from './referral.dto';
export class ReferralListItemDto extends PickType(ReferralDto, [
'id',
'refNum',
'firstName',
'lastName',
'dob',
'healthCardNumber',
'referrerFirstName',
'referrerLastName',
'createdAt',
'updatedAt',
'status',
'assignedProgramFacilitator',
'program',
'requiredFieldsCheckPassed',
] as const) {}
Transformed ReferralListItemDto
on client side ([email protected])
Transformed ReferralListItemDto
on client side ([email protected])
For reference here's the webpack config for client
const { merge } = require('webpack-merge');
const webpack = require('webpack');
module.exports = (config, context) => {
const lazyImports = [
'class-transformer/storage',
'class-transformer/cjs/storage',
'class-validator',
];
return merge(config, {
plugins: [
...config.plugins,
new webpack.IgnorePlugin({
checkResource(resource) {
if (lazyImports.includes(resource)) {
try {
require.resolve(resource);
} catch (err) {
return true;
}
}
return false;
},
}),
],
});
};
dsd
No response
[email protected]+ should transform mapped types correctly
1.1.0
16.15.1
No response
Updated my deps today & came across this warning
WARN Issues with peer dependencies found
apps/api
└─┬ @nestjs/mapped-types 1.2.0
└── ✕ unmet peer class-validator@"^0.11.1 || ^0.12.0 || ^0.13.0": found 0.14.0
I guess we can bump up peer deps to 0.14.0 since there arent any breaking changes?
I dont think so these would be required.
To support class-validator 0.14.0 and future versions
Unable to resolve dependency tree when installing npm i @nestjs/mapped-types
using:
https://github.com/mnrendra/iluvcoffee
npm i class-validator class-transformer
npm i @nestjs/mapped-types
When intalling npm i @nestjs/mapped-types
should be success with:
"class-validator": "^0.14.0"
1.2.0
18.12.1
No response
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
When extends using OmitType(), the derived class does not contain Base class methods.
Expect derived class to have parent class methods
import { IsString } from 'class-validator';
import { OmitType } from '@nestjs/mapped-types';
import { plainToClass } from 'class-transformer';
class BaseClass {
@IsString()
a: string;
@IsString()
b: string;
someMethod() {
return 'this is a method';
}
}
class DerivedClass extends OmitType(BaseClass, ['a']) {}
const instance = plainToClass(DerivedClass, {
b: 'some value',
});
console.log(instance.someMethod());
expect this code to log this is a method
but it will throw the following error:
console.log(instance.someMethod());
^
TypeError: instance.someMethod is not a function
...
It should work as normal extends
.
Nest version: ^8.0.0
@nestjs/mapped-types: ^1.0.0
For Tooling issues:
- Node version: v14.16.1
- Platform: Mac
Others:
When I try to use webpack to package, I get an error: class-transformer/storage doesn't exist
[email protected] build:webpack /Users/yanwenjun/My/workplace/nest-demo
nest build --webpack --webpackPath=./webpack.config.js
ERROR in ./node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/dist/type-helpers.utils.js 80:27-63
Module not found: Error: Can't resolve 'class-transformer/storage' in '/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/dist'
resolve 'class-transformer/storage' in '/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/dist'
Parsed request is a module
using description file: /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/package.json (relative path: ./dist)
resolve as module
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/dist/node_modules doesn't exist or is not a directory
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/node_modules doesn't exist or is not a directory
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/node_modules doesn't exist or is not a directory
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules
existing directory /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer
using description file: /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/package.json (relative path: .)
using description file: /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/package.json (relative path: ./storage)
no extension
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/storage doesn't exist
.js
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/storage.js doesn't exist
.ts
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/storage.ts doesn't exist
.json
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/storage.json doesn't exist
as directory
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/class-transformer/storage doesn't exist
looking for modules in /Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/node_modules
/Users/yanwenjun/My/workplace/nest-demo/node_modules/.pnpm/node_modules/class-transformer doesn't exist
/Users/yanwenjun/My/workplace/nest-demo/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /Users/yanwenjun/My/workplace/nest-demo/node_modules
existing directory /Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer
using description file: /Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/package.json (relative path: .)
using description file: /Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/package.json (relative path: ./storage)
no extension
/Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/storage doesn't exist
.js
/Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/storage.js doesn't exist
.ts
/Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/storage.ts doesn't exist
.json
/Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/storage.json doesn't exist
as directory
/Users/yanwenjun/My/workplace/nest-demo/node_modules/class-transformer/storage doesn't exist
/Users/yanwenjun/My/workplace/node_modules doesn't exist or is not a directory
/Users/yanwenjun/My/node_modules doesn't exist or is not a directory
looking for modules in /Users/yanwenjun/node_modules
/Users/yanwenjun/node_modules/class-transformer doesn't exist
/Users/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
@ ./node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/dist/index.js 23:27-58
@ ./node_modules/.pnpm/@nestjs+mapped-types@2.0.5_@nestjs[email protected]_class-transformer@[email protected]_trkzvzgzrsiyav5ekfhp5ta2cm/node_modules/@nestjs/mapped-types/index.js 6:9-26
@ ./src/user/dto/update-user.dto.ts 14:23-54
@ ./src/user/user.controller.ts 20:26-58
@ ./src/user/user.module.ts 12:26-54
@ ./src/app.module.ts 13:22-51
@ ./src/main.ts 4:21-44
webpack 5.90.1 compiled with 1 error in 1607 ms
ELIFECYCLE Command failed with exit code 1.
https://github.com/zhuba-Ahhh/nest-demo
npm i
npm run build:webpack
When I try to use webpack to package, I get an error: class-transformer/storage doesn't exist
No error
2.0.5
18.20.2
I tried to lower the version but still got an error, or not use @nestjs/mapped-types, but still got an error
Hi, I've noticed that when extending a class (Child
) from another (Parent
), using PartialType
(for example, but this is the same with the other wrappers) doesn't add the Parent
properties decorators to the Child
.
How did I notice this ? I've some swagger @ApiProperty()
decorators in my CreateDto
, and when extending the UpdateDto extends PartialType(CreateDto) {}
, the UpdateDto
doesn't have any properties in the Swagger.``
However, removing the PartialType
wrapper "fix" the issue.
https://stackblitz.com/edit/nestjs-issue-minimum-repro-starter-2zmyjl
All the Parent
properties decorators should be copied to the Child
.
2.0.2
18.16.1
No response
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
It respects parent's class but it does not respect parent class's parent class when it's packed to webpack
It should respect every parent class
https://github.com/asomethings/mapped-types-webpack-bug
Well, I have a lot of multiple base classes and use them extending a lot. So I hope the bug gets fixed.
Nest version: 8.0.9
For Tooling issues:
- Node version: 14
- Platform: Linux Ubuntu 20.04
Others:
Raising this for visibility. There is a critical vulnerability in class-validator
which is resolved in 0.14.0
.
Please update the packages dependency and peerDependency of class-validator
to 0.14.0
only.
There is an automated PR open: #930. It has been open for some time, can we please merge it? Many people are urgently waiting for this.
Critical security vulnerability.
[ ] Regression
[ ] Bug report
[x] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
import { IntersectionType } from '@nestjs/mapped-types';
import { BaseTemplateFiltering } from 'validators/BaseTemplateFiltering';
import { LimitOffsetQuery } from 'validators/LimitOffsetQuery';
import { SortByQuery } from 'validators/SortByQuery';
export class BaseTemplateQueryDto extends IntersectionType(
BaseTemplateFiltering,
IntersectionType(LimitOffsetQuery, SortByQuery),
) {}
import { IntersectionMultipleType } from '@nestjs/mapped-types';
import { BaseTemplateFiltering } from 'validators/BaseTemplateFiltering';
import { LimitOffsetQuery } from 'validators/LimitOffsetQuery';
import { SortByQuery } from 'validators/SortByQuery';
export class BaseTemplateQueryDto extends IntersectionMultipleType(
BaseTemplateFiltering,
LimitOffsetQuery,
SortByQuery,
) {}
I don't think is it possible to do things such this...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.