Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

js Validating promises

// If your object contains property with Promise-returned 
// value that should be validated, then you need to use 
// the @ValidatePromise() decorator:

import { ValidatePromise, Min } from 'class-validator';

export class Post {
  @Min(0)
  @ValidatePromise()
  userId: Promise<number>;
}
Source by github.com #
 
PREVIOUS NEXT
Tagged: #js #Validating #promises
ADD COMMENT
Topic
Name
1+4 =