mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 01:31:45 +00:00
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:
Vendored
+2
-1
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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');
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user