Added an interface for the object returned during synchronous validations.

This commit is contained in:
Nick Lee
2015-05-16 15:25:33 -04:00
parent 7d2f0aa875
commit 5bf40c59d1
+6 -2
View File
@@ -61,6 +61,11 @@ declare module 'joi' {
options?: ValidationOptions;
}
export interface ValidationResult<T> {
error: ValidationError;
value: T;
}
export interface SchemaMap {
[key: string]: Schema;
}
@@ -461,8 +466,7 @@ declare module 'joi' {
*/
export function validate<T>(value: T, schema: Schema, callback: (err: ValidationError, value: T) => void): void;
export function validate<T>(value: T, schema: Object, callback: (err: ValidationError, value: T) => void): void;
export function validate<T>(value: T, schema: Schema, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): void;
export function validate<T>(value: T, schema: Object, options?: ValidationOptions, callback?: (err: ValidationError, value: T) => void): ValidationResult<T>;
/**
* Converts literal schema definition to joi schema object (or returns the same back if already a joi schema object).