Skip to content

feat: IsPort decorator should accept number value #826

@skobaken

Description

@skobaken

I was trying to...

class Config {
  @IsPort()
  port: number;
}
const c = new Config();
c.port = 3000;
console.log(validateSync(c)) // error occurred

The problem:
validateSync returns an error in the above snippet.
The error doesn't appear when port type is string.
Is this behavior intended?

return typeof value === 'string' && isPortValidator(value);

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions