11import React from 'react' ;
22import PropTypes from 'prop-types' ;
3- import { RequiredValidation , Validations } from './interfaces' ;
3+ import { RequiredValidation , ValidationError , Validations } from './interfaces' ;
44declare const propTypes : {
55 innerRef : PropTypes . Requireable < ( ...args : any [ ] ) => any > ;
66 name : PropTypes . Validator < string > ;
@@ -9,46 +9,50 @@ declare const propTypes: {
99 value : PropTypes . Requireable < any > ;
1010} ;
1111export interface WrapperProps < V > {
12- innerRef ?: ( ref : any ) => void ;
12+ innerRef ?: ( ref : React . Ref < any > ) => void ;
1313 name : string ;
1414 required ?: RequiredValidation < V > ;
15- validationError ?: any ;
16- validationErrors ?: any ;
15+ validationError ?: ValidationError ;
16+ validationErrors ?: {
17+ [ key : string ] : ValidationError ;
18+ } ;
1719 validations ?: Validations < V > ;
1820 value ?: V ;
1921}
2022export interface WrapperState < V > {
2123 [ key : string ] : unknown ;
22- externalError : null ;
2324 formSubmitted : boolean ;
2425 isPristine : boolean ;
2526 isRequired : boolean ;
2627 isValid : boolean ;
27- pristineValue : any ;
28- validationError : any [ ] ;
28+ pristineValue : V ;
29+ validationError : ValidationError [ ] ;
2930 value : V ;
3031}
3132export interface InjectedProps < V > {
32- errorMessage : any ;
33- errorMessages : any ;
33+ errorMessage : ValidationError ;
34+ errorMessages : ValidationError [ ] ;
3435 hasValue : boolean ;
3536 isFormDisabled : boolean ;
3637 isFormSubmitted : boolean ;
3738 isPristine : boolean ;
3839 isRequired : boolean ;
3940 isValid : boolean ;
4041 isValidValue : ( value : V ) => boolean ;
41- ref ?: any ;
42+ ref ?: React . Ref < any > ;
4243 resetValue : ( ) => void ;
4344 setValidations : ( validations : Validations < V > , required : RequiredValidation < V > ) => void ;
4445 setValue : ( value : V ) => void ;
4546 showError : boolean ;
4647 showRequired : boolean ;
4748}
48- export interface WrapperInstanceMethods {
49+ export interface WrapperInstanceMethods < V > {
50+ getErrorMessage : ( ) => null | ValidationError ;
51+ getErrorMessages : ( ) => ValidationError [ ] ;
52+ getValue : ( ) => V ;
53+ isFormDisabled : ( ) => boolean ;
4954 isValid : ( ) => boolean ;
50- getValue : ( ) => any ;
51- getErrorMessage : ( ) => any ;
55+ setValue : ( value : V ) => void ;
5256}
5357export declare type PassDownProps < V > = WrapperProps < V > & InjectedProps < V > ;
5458export { propTypes } ;
0 commit comments