@@ -166,7 +166,7 @@ export default class Field extends Base implements FieldInterface {
166166
167167 validationErrorStack : string [ ] = [ ] ;
168168 validationFunctionsData : any [ ] = [ ] ;
169- validationAsyncData : any ;
169+ validationAsyncData = { valid : true , message : null } ;
170170 debouncedValidation : any ;
171171
172172 disposeValidationOnBlur : any ;
@@ -288,8 +288,7 @@ export default class Field extends Base implements FieldInterface {
288288
289289 get checkValidationErrors ( ) : boolean {
290290 return (
291- ( ( this . validationAsyncData as any ) ?. valid === false &&
292- ! _ . isEmpty ( this . validationAsyncData ) ) ||
291+ ! this . validationAsyncData . valid ||
293292 ! _ . isEmpty ( this . validationErrorStack ) ||
294293 _ . isString ( this . errorAsync ) ||
295294 _ . isString ( this . errorSync )
@@ -743,15 +742,15 @@ export default class Field extends Base implements FieldInterface {
743742 this . showErrors ( true , deep ) ;
744743 }
745744
746- setValidationAsyncData ( valid : boolean = false , message : string = "" ) : void {
745+ setValidationAsyncData ( valid : boolean = false , message : string | null = null ) : void {
747746 this . validationAsyncData = { valid, message } ;
748747 }
749748
750749 resetValidation ( deep : boolean = false ) : void {
751750 this . showError = false ;
752751 this . errorSync = null ;
753752 this . errorAsync = null ;
754- this . validationAsyncData = undefined ;
753+ this . validationAsyncData = { valid : true , message : null } ;
755754 this . validationFunctionsData = [ ] ;
756755 this . validationErrorStack = [ ] ;
757756 Promise . resolve ( ) . then ( action ( ( ) => {
@@ -825,7 +824,7 @@ export default class Field extends Base implements FieldInterface {
825824 showErrors ( show : boolean = true , deep : boolean = true ) : void {
826825 this . showError = show ;
827826 this . errorSync = _ . head ( this . validationErrorStack ) as string || null ;
828- this . errorAsync = ( this . validationAsyncData ? .valid === false ) ? this . validationAsyncData ? .message as string : null
827+ this . errorAsync = ! this . validationAsyncData . valid ? this . validationAsyncData . message : null
829828 deep && this . each ( ( field : FieldInterface ) => field . showErrors ( show , deep ) ) ;
830829 }
831830
0 commit comments