@@ -50,7 +50,7 @@ declare namespace JQueryValidation {
5050 *
5151 * default: Places the error label after the invalid element
5252 */
53- errorPlacement ?( error : JQuery , element : JQuery ) : void ;
53+ errorPlacement ?( this : Validator , error : JQuery , element : JQuery ) : void ;
5454 /**
5555 * If enabled, removes the errorClass from the invalid elements and hides all error messages whenever the element is focused.
5656 * Avoid combination with focusInvalid.
@@ -76,7 +76,7 @@ declare namespace JQueryValidation {
7676 *
7777 * default: Adds errorClass (see the option) to the element
7878 */
79- highlight ?( element : HTMLElement , errorClass : string , validClass : string ) : void ;
79+ highlight ?( this : Validator , element : HTMLElement , errorClass : string , validClass : string ) : void ;
8080 /**
8181 * Elements to ignore when validating, simply filtering them out. jQuery's not-method is used, therefore everything that is
8282 * accepted by not() can be passed as this option. Inputs of type submit and reset are always ignored, so are disabled elements.
@@ -93,7 +93,7 @@ declare namespace JQueryValidation {
9393 * Callback for custom code when an invalid form is submitted. Called with an event object as the first argument, and the validator
9494 * as the second.
9595 */
96- invalidHandler ?( event : JQueryEventObject , validator : Validator ) : void ;
96+ invalidHandler ?( this : HTMLFormElement , event : JQueryEventObject , validator : Validator ) : void ;
9797 /**
9898 * Key/value pairs defining custom messages. Key is the name of an element, value the message to display for that element. Instead
9999 * of a plain message, another map with specific messages for each rule can be used. Overrides the title attribute of an element or
@@ -154,12 +154,12 @@ declare namespace JQueryValidation {
154154 * be a single element when doing validation onblur/keyup. You can trigger (in addition to your own messages) the default
155155 * behaviour by calling this.defaultShowErrors().
156156 */
157- showErrors ?( errorMap : ErrorDictionary , errorList : ErrorListItem [ ] ) : void ;
157+ showErrors ?( this : Validator , errorMap : ErrorDictionary , errorList : ErrorListItem [ ] ) : void ;
158158 /**
159159 * Callback for handling the actual submit when the form is valid. Gets the form and the event object. Replaces the default submit.
160160 * The right place to submit a form via Ajax after it is validated.
161161 */
162- submitHandler ?( form : HTMLFormElement , event ?: JQueryEventObject ) : void ;
162+ submitHandler ?( this : Validator , form : HTMLFormElement , event ?: JQueryEventObject ) : void ;
163163 /**
164164 * String or Function. If specified, the error label is displayed to show a valid element. If a String is given, it is added as
165165 * a class to the label. If a Function is given, it is called with the label (as a jQuery object) and the validated input (as a DOM element).
@@ -171,7 +171,7 @@ declare namespace JQueryValidation {
171171 *
172172 * default: Removes the errorClass
173173 */
174- unhighlight ?( element : HTMLElement , errorClass : string , validClass : string ) : void ;
174+ unhighlight ?( this : Validator , element : HTMLElement , errorClass : string , validClass : string ) : void ;
175175 /**
176176 * This class is added to an element after it was validated and considered valid.
177177 *
@@ -218,8 +218,8 @@ declare namespace JQueryValidation {
218218 */
219219 addMethod (
220220 name : string ,
221- method : ( value : any , element : HTMLElement , params : any ) => boolean ,
222- message ?: string | ( ( params : any , element : HTMLElement ) => string ) ,
221+ method : ( this : Validator , value : any , element : HTMLElement , params : any ) => boolean ,
222+ message ?: string | ( ( this : Validator , params : any , element : HTMLElement ) => string ) ,
223223 ) : void ;
224224 /**
225225 * Replaces {n} placeholders with arguments.
@@ -240,6 +240,8 @@ declare namespace JQueryValidation {
240240 }
241241
242242 interface Validator {
243+ defaultShowErrors ( ) : void ;
244+
243245 element ( element : string | JQuery ) : boolean ;
244246 checkForm ( ) : boolean ;
245247 /**
@@ -255,6 +257,9 @@ declare namespace JQueryValidation {
255257 * Returns the number of invalid fields.
256258 */
257259 numberOfInvalids ( ) : number ;
260+
261+ optional ( element : HTMLElement ) : boolean ;
262+
258263 /**
259264 * Resets the controlled form.
260265 */
0 commit comments