Last active
July 26, 2019 17:42
-
-
Save miloszpp/8cdf68c12db923ad28aa9ed8b688690f to your computer and use it in GitHub Desktop.
This file contains 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
declare function bind<T>(component: React.ComponentType<T & InjectedProps>): React.ComponentType<T>; | |
declare class A<B> extends React.Component<PubProps<B> & InjectedProps> { } | |
const APrimeComponent = bind(A); | |
// type inferred to: React.ComponentType<PubProps<unknown>> | |
declare function AFunc<B>(props: PubProps<B> & InjectedProps): React.ReactElement; | |
const AFuncPrimeComponent = bind(AFunc); | |
// type inferred to: React.ComponentType<PubProps<unknown>> | |
declare function bindHack<T>(component: (props: T & InjectedProps) => React.ReactElement): (props: T) => React.ReactElement; | |
const AFuncPrimeComponentHack = bindHack(AFunc); | |
// type inferred correctly! AFuncPrimeComponentHack is generic | |
const render = () => <AFuncPrimeComponentHack foo={5} />; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment