how can I use decorator for method variable inside class in nestjs?

Viewed 154
import {isNotEmpty} from "class-validator";

export Service   {

create(createdto)
{
const {name,age} = createdto;

@isNotEmpty()
name          //using decorator to check whether name is null or 
undefined
} 
}

Since, the decorator is only useful to class methods, I cannot use it inside method variables. How can it validate the method variables?

0 Answers
Related