File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -18,10 +18,10 @@ const STATES = {
1818  INIT : 'init' , 
1919  PENDING : 'pending' , 
2020  SUCCESS : 'success' , 
21- } ; 
21+ }   as   const ; 
2222
2323const  AsyncButton  =  React . forwardRef ( 
24-   < T  extends  React . ElementType > ( 
24+   < T  extends  React . ElementType   =   'button' > ( 
2525    { 
2626      as, 
2727      errorConfig, 
@@ -33,7 +33,7 @@ const AsyncButton = React.forwardRef(
3333    } : AsyncButtonProps < T > , 
3434    ref : React . ForwardedRef < any > , 
3535  )  =>  { 
36-     const  [ buttonState ,  setButtonState ]  =  useState ( STATES . INIT ) ; 
36+     const  [ buttonState ,  setButtonState ]  =  useState < typeof   STATES [ keyof   typeof   STATES ] > ( STATES . INIT ) ; 
3737    const  cancellablePromise  =  useRef < ReturnType < typeof  makeCancellable > > ( ) ; 
3838    const  timeout  =  useRef < ReturnType < typeof  setTimeout > > ( ) ; 
3939
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments