From 7e6e4d7915fb31b0463386ac211d2709e4aefbb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Olivera?= Date: Sun, 6 Jan 2019 17:58:19 -0300 Subject: [PATCH] Correct the return value of the first method It return the first error message or false. It never returns true. --- types/validatorjs/index.d.ts | 3 ++- types/validatorjs/validatorjs-tests.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/types/validatorjs/index.d.ts b/types/validatorjs/index.d.ts index ceaf2cfc93..9a489980de 100644 --- a/types/validatorjs/index.d.ts +++ b/types/validatorjs/index.d.ts @@ -9,6 +9,7 @@ declare namespace Validator { interface TypeCheckingRule { [attribute: string]: Array; } + interface Rules { [attribute: string]: string | Array | Rules; } @@ -31,7 +32,7 @@ declare namespace Validator { errors: ValidationErrors; add(attribute: string, message: string): void; get(attribute: string): Array; - first(attribute: string): string | boolean; + first(attribute: string): string | false; all(): ValidationErrors; has(attribute: string): boolean; } diff --git a/types/validatorjs/validatorjs-tests.ts b/types/validatorjs/validatorjs-tests.ts index a02ed2351e..eb8eda9656 100644 --- a/types/validatorjs/validatorjs-tests.ts +++ b/types/validatorjs/validatorjs-tests.ts @@ -83,7 +83,7 @@ const check: boolean = validator.check(); const errors: Validator.Errors = validator.errors; const all: Validator.ValidationErrors = errors.all(); const error: Array = errors.get('foo'); -const first: string | boolean = errors.first('foo'); +const first: string | false = errors.first('foo'); const has: boolean = errors.has('foo'); /**