Skip to content

Commit 1fd738c

Browse files
committed
Merge pull request DefinitelyTyped#1495 from johnnyreilly/master
jQuery.validation: Gave definition to errorMap
2 parents 040763a + da19826 commit 1fd738c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

jquery.validation/jquery.validation-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ function test_validate() {
111111
submitHandler: function () { alert("Submitted!") }
112112
});
113113
$(".selector").validate({
114-
showErrors: function (errorMap, errorList) {
114+
showErrors: function (errorMap: ErrorDictionary, errorList: ErrorListItem[]) {
115115
$("#summary").html("Your form contains " + this.numberOfInvalids() + " errors, see details below.");
116116
this.defaultShowErrors();
117117
}
@@ -193,7 +193,7 @@ function test_methods() {
193193
validator.hideErrors();
194194
var isValid: boolean = validator.valid();
195195
var size: number = validator.size();
196-
var errorMap: Object = validator.errorMap;
196+
var errorMap: ErrorDictionary = validator.errorMap;
197197
var errorList: ErrorListItem[] = validator.errorList;
198198

199199
$("#summary").text(validator.numberOfInvalids() + " field(s) are invalid");

jquery.validation/jquery.validation.d.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,19 @@ interface ValidationOptions
2828
onkeyup?: boolean;
2929
onsubmit?: boolean;
3030
rules?: Object;
31-
showErrors?: (errorMap: Object, errorList: ErrorListItem[]) => void;
31+
showErrors?: (errorMap: ErrorDictionary, errorList: ErrorListItem[]) => void;
3232
submitHandler?: (form: HTMLFormElement) => void;
3333
success?: any;
3434
unhighlight?: (element: HTMLElement, errorClass: string, validClass: string) => void;
3535
validClass?: string;
3636
wrapper?: string;
3737
}
3838

39+
interface ErrorDictionary
40+
{
41+
[name: string]: string;
42+
}
43+
3944
interface ErrorListItem
4045
{
4146
message: string;
@@ -59,7 +64,7 @@ interface Validator
5964
valid(): boolean;
6065
size(): number;
6166

62-
errorMap: Object;
67+
errorMap: ErrorDictionary;
6368
errorList: ErrorListItem[];
6469
}
6570

0 commit comments

Comments
 (0)