Skip to content

Make the Validator constructor public, so we don't need to override it in the child class #30

@razvanbretoiu

Description

@razvanbretoiu

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions