diff --git a/revalidator/revalidator-tests.ts b/revalidator/revalidator-tests.ts new file mode 100644 index 0000000000..b65c9f971b --- /dev/null +++ b/revalidator/revalidator-tests.ts @@ -0,0 +1,3 @@ +/// + +revalidator.validate(null, null, null); \ No newline at end of file diff --git a/revalidator/revalidator.d.ts b/revalidator/revalidator.d.ts new file mode 100644 index 0000000000..63f492e9c3 --- /dev/null +++ b/revalidator/revalidator.d.ts @@ -0,0 +1,48 @@ +// Type definitions for revalidator 0.3.1 +// Project: https://github.com/flatiron/revalidator +// Definitions by: Jason Turner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare module Revalidator { + interface RevalidatorStatic { + validate(object: any, schema: ISchema, options: any): IReturnMessage; + } + + interface IErrrorProperty { + property: string; + message: string; + } + + interface IReturnMessage { + valid: boolean; + errors: IErrrorProperty[]; + } + + interface ISchema { + required?: boolean; + type: string; + pattern?: any; + maxLength?: number; + minLength?: number; + minimum?: number; + maximum?: number; + allowEmpty: boolean; + exclusiveMinimum: number; + exclusiveMaximum?: number; + divisibleBy?: number; + minItems?: number; + maxItems?: number; + uniqueItems?: boolean; + enum?: any; + format?: string; + conform?: (data:any) => boolean; + depdendencies?: string; + + } +} + +declare var revalidator: Revalidator.RevalidatorStatic; + +declare module "revalidator" { + export = revalidator; +} \ No newline at end of file