While going through NestJS tutorials, I came across two different syntaxes for the UsePipes Decorator:
@UsePipes(ValidationPipe)
@UsePipes(new ValidationPipe())
Based on my understanding, ValidationPipe
is a standalone class, and when using new ValidationPipe()
, it simply creates a new instance of the ValidationPipe class.
So, which option should I go with? What sets them apart? Are there any specific scenarios where one is more suitable than the other?