Last active
          June 26, 2018 05:22 
        
      - 
      
- 
        Save cvle/eed44f1b20b5f4ac79f4fe869d581efa to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import React from "react"; | |
| type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>; | |
| type InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> = | |
| <P extends TInjectedProps>( | |
| component: React.ComponentType<P> | |
| ) => React.ComponentType<Omit<P, keyof TInjectedProps> & TNeedsProps>; | |
| type DefaultingInferableComponentEnhancer<TInjectedProps> = | |
| InferableComponentEnhancerWithProps<TInjectedProps, Partial<TInjectedProps>>; | |
| const withX: DefaultingInferableComponentEnhancer<{x: string}> = null as any; | |
| const withY: DefaultingInferableComponentEnhancer<{y: string}> = null as any; | |
| const withZ: DefaultingInferableComponentEnhancer<{z: string}> = null as any; | |
| const withO: DefaultingInferableComponentEnhancer<{o: string}> = null as any; | |
| const A: React.ComponentType<{a: string, x: string, y: string, z: string, o: string}> = null as any; | |
| const X = withO(withZ(withY(withX(A)))); | |
| X.defaultProps = { | |
| a: "I don't exist :-(", | |
| }; | 
      
      
  Author
  
  
        
      
            cvle
  
      
      
      commented 
        Jun 26, 2018 
      
    
  
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment