Correct the return value of the first method

It return the first error message or false. It never returns true.
This commit is contained in:
Matías Olivera
2019-01-06 18:00:03 -03:00
parent 70385fd6e6
commit 7e6e4d7915
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -9,6 +9,7 @@ declare namespace Validator {
interface TypeCheckingRule {
[attribute: string]: Array<any>;
}
interface Rules {
[attribute: string]: string | Array<string | TypeCheckingRule> | Rules;
}
@@ -31,7 +32,7 @@ declare namespace Validator {
errors: ValidationErrors;
add(attribute: string, message: string): void;
get(attribute: string): Array<string>;
first(attribute: string): string | boolean;
first(attribute: string): string | false;
all(): ValidationErrors;
has(attribute: string): boolean;
}
+1 -1
View File
@@ -83,7 +83,7 @@ const check: boolean = validator.check();
const errors: Validator.Errors = validator.errors;
const all: Validator.ValidationErrors = errors.all();
const error: Array<string> = errors.get('foo');
const first: string | boolean = errors.first('foo');
const first: string | false = errors.first('foo');
const has: boolean = errors.has('foo');
/**