Skip to content

Commit

Permalink
jQuery.validation: Gave definition to errorMap
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyreilly committed Jan 2, 2014
1 parent 925a128 commit da19826
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jquery.validation/jquery.validation-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function test_validate() {
submitHandler: function () { alert("Submitted!") }
});
$(".selector").validate({
showErrors: function (errorMap, errorList) {
showErrors: function (errorMap: ErrorDictionary, errorList: ErrorListItem[]) {
$("#summary").html("Your form contains " + this.numberOfInvalids() + " errors, see details below.");
this.defaultShowErrors();
}
Expand Down Expand Up @@ -193,7 +193,7 @@ function test_methods() {
validator.hideErrors();
var isValid: boolean = validator.valid();
var size: number = validator.size();
var errorMap: Object = validator.errorMap;
var errorMap: ErrorDictionary = validator.errorMap;
var errorList: ErrorListItem[] = validator.errorList;

$("#summary").text(validator.numberOfInvalids() + " field(s) are invalid");
Expand Down
9 changes: 7 additions & 2 deletions jquery.validation/jquery.validation.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ interface ValidationOptions
onkeyup?: boolean;
onsubmit?: boolean;
rules?: Object;
showErrors?: (errorMap: Object, errorList: ErrorListItem[]) => void;
showErrors?: (errorMap: ErrorDictionary, errorList: ErrorListItem[]) => void;
submitHandler?: (form: HTMLFormElement) => void;
success?: any;
unhighlight?: (element: HTMLElement, errorClass: string, validClass: string) => void;
validClass?: string;
wrapper?: string;
}

interface ErrorDictionary
{
[name: string]: string;
}

interface ErrorListItem
{
message: string;
Expand All @@ -59,7 +64,7 @@ interface Validator
valid(): boolean;
size(): number;

errorMap: Object;
errorMap: ErrorDictionary;
errorList: ErrorListItem[];
}

Expand Down

0 comments on commit da19826

Please sign in to comment.