import { IsDefined, Max, MaxLength, Min, MinLength } from 'class-validator';
class UserDto {
@MinLength(2)
@MaxLength(10)
public readonly nickname: string;
@Min(1)
@Max(100)
public readonly age: number;
}
class CreateUserDto extends UserDto{} // I want nickname and age to be required in this class
class UpdateUserDto extends UserDto{} // I want nickname and age to be optional in this class
Is there any way to achieve this without repeating the same code three times?