explicitly define node-form module with export = Validation

This commit is contained in:
rsamec
2014-07-28 08:36:08 +02:00
parent c51cfd5670
commit 9084225d44
+20 -7
View File
@@ -1,14 +1,9 @@
// Type definitions for node-form v1.0.0
// Project: https://github.com/rsamec/form
// Definitions by: Roman Samec <https://github.com/rsamec>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../underscore/underscore.d.ts" />
/// <reference path="../q/Q.d.ts" />
/// <reference path="../moment/moment.d.ts" />
declare module Validation {
/**
* It represents a propert y validator for atomic object.
* It represents a property validator for atomic object.
*/
interface IPropertyValidator {
isAcceptable(s: any): boolean;
@@ -163,11 +158,18 @@ declare module Validation {
TranslateArgs?: IErrorTranslateArgs;
}
/**
* Custom message functions.
*/
interface IErrorCustomMessage {
(config: any, args: any): string;
}
/**
* support for localization of error messages
*/
interface IErrorTranslateArgs {
TranslateId: string;
MessageArgs: any;
CustomMessage?: IErrorCustomMessage;
}
/**
* It defines conditional function.
@@ -636,7 +638,9 @@ declare module Validation {
};
constructor(Name: string, validatorsToAdd?: IPropertyValidator[]);
public AddValidator(validator: any): void;
public Errors : IError[];
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
@@ -669,13 +673,22 @@ declare module Validation {
public Name: string;
private ValidateFce;
public Error: IError;
public ValidationFailures: {
[name: string]: IValidationFailure;
};
constructor(Name: string, ValidateFce: IValidate);
public Optional: IOptional;
public Validate(context: any): boolean;
public HasError : boolean;
public Errors : {
[name: string]: IValidationFailure;
};
public HasErrors : boolean;
public ErrorCount : number;
public ErrorMessage : string;
public TranslateArgs : IErrorTranslateArgs[];
}
}
declare module "node-form" {
export = Validation ;
}