From 9084225d447d22acdee8b0102274e92b8f4bbebf Mon Sep 17 00:00:00 2001 From: rsamec Date: Mon, 28 Jul 2014 08:36:08 +0200 Subject: [PATCH] explicitly define node-form module with export = Validation --- node-form/node-form.d.ts | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/node-form/node-form.d.ts b/node-form/node-form.d.ts index b842368963..8c9bc73a84 100644 --- a/node-form/node-form.d.ts +++ b/node-form/node-form.d.ts @@ -1,14 +1,9 @@ -// Type definitions for node-form v1.0.0 -// Project: https://github.com/rsamec/form -// Definitions by: Roman Samec -// Definitions: https://github.com/borisyankov/DefinitelyTyped - /// /// /// 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 ; +} \ No newline at end of file