пользовательский валидатор белый список

/*
* Even if your object is an instance of a validation class 
* it can contain additional properties that are not defined. 
* If you do not want to have such properties on your object, 
* pass special flag to validate method:
*/

import {validate, Allow, Min} from "class-validator";

export class Post {

    @Allow()
    title: string;

    @Min(0)
    views: number;

    nonWhitelistedProperty: number;
}

let post = new Post();
post.title = 'Hello world!';
post.views = 420;

post.nonWhitelistedProperty = 69;
(post as any).anotherNonWhitelistedProperty = "something";

validate(post).then(errors => {
  // post.nonWhitelistedProperty is not defined
  // (post as any).anotherNonWhitelistedProperty is not defined
  ...
});
Puzzled Puffin