DEV Community

Discussion on: Using Property Decorators in Typescript with a real example

Collapse
 
snowfrogdev profile image
Philippe Vaillancourt

Could other decorators with a similar implementation be used along with this one? Something like this:

class User {
    username: string;
    @Min(8)
    @Max(12)
    @SpecialChar(2)
    password: string;
    constructor(username: string, password: string){
        this.username = username;
        this.password = password;
    }    
}
Enter fullscreen mode Exit fullscreen mode
Collapse
 
danywalls profile image
Dany Paredes

Yes, you can use nested decorators :D