File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,19 @@ This function takes an initial value and a yup schema.
33This function returns ` Field `  object.
44
55## Parameters  
6- The ` field() `  takes 3 parameters and 2  generic type parameters:
6+ The ` field() `  takes 3 parameters and some  generic type parameters:
77
88``` typescript 
9- function  field<T ,  U   extends   T   =   T >(
9+ declare   function  field<T >(
1010  value :  T  |  Ref <T >,
1111  schema ? :  FieldSchema ,
1212  validateOptions ? :  ValidateOptions 
13- ):  Field <T , T  extends  U  ?  T  :  U >;
13+ ):  Field <T , T >;
14+ declare  function  field<T , U  extends  T >(
15+   value :  T  |  Ref <T >,
16+   schema ? :  FieldSchema ,
17+   validateOptions ? :  ValidateOptions 
18+ ):  Field <T , U >;
1419``` 
1520
1621### 1. ` value `  <Badge  type =" danger "  text =" Required "  />  
@@ -74,7 +79,7 @@ Since `validateSync()` is used internally, Async tests are not available.
7479### ` T `  <Badge  type =" info "  text =" Optional "  /> 
7580-  Pass the type of ` $value `  explicitly like ` ref<T>() ` .
7681
77- ### ` U `  <Badge  type =" info "  text =" Optional / Default: T  "  /> 
82+ ### ` U `  <Badge  type =" info "  text =" Optional "  /> 
7883-  Pass the preferred type as the result of [ ` toObject() ` ] ( /api/toObject ) .
7984
8085## Details of ` Field `  object  
Original file line number Diff line number Diff line change @@ -210,11 +210,21 @@ export function defineForm<T extends Form>(form: T): T {
210210  return  form ; 
211211} 
212212
213- export  function  field < T ,   U   extends   T   =   T > ( 
213+ export  function  field < T > ( 
214214  value : T  |  Ref < T > , 
215215  schema ?: FieldSchema , 
216216  validateOptions ?: ValidateOptions 
217- ) : Field < T ,  T  extends  U  ? T  : U >  { 
217+ ) : Field < T ,  T > ; 
218+ export  function  field < T ,  U  extends  T > ( 
219+   value : T  |  Ref < T > , 
220+   schema ?: FieldSchema , 
221+   validateOptions ?: ValidateOptions 
222+ ) : Field < T ,  U > ; 
223+ export  function  field < T > ( 
224+   value : T  |  Ref < T > , 
225+   schema ?: FieldSchema , 
226+   validateOptions ?: ValidateOptions 
227+ )  { 
218228  return  new  Field ( value ,  schema ,  validateOptions ) ; 
219229} 
220230
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments