npm i class-validator
Here is what the above code is Doing:
1. We are importing the class-validator package.
2. We are creating a class called User.
3. We are adding a property called name to the User class.
4. We are adding a decorator called IsString to the name property.
5. We are adding a decorator called IsNotEmpty to the name property.
6. We are creating a new instance of the User class.
7. We are assigning a value to the name property.
8. We are validating the User instance.
9. We are printing the validation errors.