Skip to content

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

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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