Make the Validator constructor public instead of protected.
Current implementation
The validator constructor is protected, and we always need to override it in the child validator
class MyValidator extends Validator<string> {
constructor() {
super();
}
}
.
class MySchema extends Schema {
@StringField({ validators: [new TimeZoneValidator()]})
myField: string
}
We are forced by typescript to override the constructor, because we cannot use new TimeZoneValidator(), if the constructor is protected
Proposed solution
Make the constructor public, so we don't need to override it.
Make the
Validatorconstructor public instead of protected.Current implementation
The validator constructor is protected, and we always need to override it in the child validator
We are forced by typescript to override the constructor, because we cannot use
new TimeZoneValidator(), if the constructor is protectedProposed solution
Make the constructor public, so we don't need to override it.