File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change 1- import  React  from  'react' 
1+ import  React ,   { useRef }  from  'react' 
22import  { Button }  from  '../Button' 
33
44export  function  shouldAcceptOnlyAChildProp ( )  { 
55  return  < Button > child</ Button > 
66} 
77
8+ export  function  ShouldAcceptKnownButtonPropsAndDomProps ( )  { 
9+   const  buttonEl  =  useRef < HTMLButtonElement > ( ) 
10+   return  ( 
11+     < Button 
12+       ref = { buttonEl } 
13+       leadingIcon = { ( )  =>  < > </ > } 
14+       trailingIcon = { ( )  =>  < > </ > } 
15+       size = "medium" 
16+       variant = "primary" 
17+       disabled 
18+       aria-label = "some label" 
19+       onClick = { e  =>  { 
20+         // current target is assignable to HTMLButtonElement 
21+         buttonEl . current  =  e . currentTarget 
22+       } } 
23+       sx = { { 
24+         m : 1 
25+       } } 
26+     > 
27+       Child
28+     </ Button > 
29+   ) 
30+ } 
31+ 
832export  function  shouldNotAcceptOutlandishProps ( )  { 
933  // @ts -expect-error system props should not be accepted 
1034  return  < Button  anOutlandshPropThatShouldNotBeAllowedOnA = { 'Button' }  /> 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments