In Nestjs I’m using a DTO whose properties have the same set of values, so decided to use the same enum for both. But I was informed that using same enum for multiple properties is incorrect.
I have been searching for this across internet, but no answer regarding this. Providing the sample DTO for details. Kindly let me know if an Enum can be used for multiple properties in a DTO.
Thanks for your efforts in answering the question.
enum Answer {
YES = 'YES',
NO = 'NO',
}
export class SampleDTO {
@IsEnum(Answer)
@IsOptional()
isMultiColured: string = Answer.NO;
@IsEnum(Answer)
@IsOptional()
isBranded: string = Answer.NO;
}