Skip to content

Instantly share code, notes, and snippets.

@jtmthf
Last active May 5, 2018 20:55
Show Gist options
  • Save jtmthf/85901a1e9bdb850b4b8dfc5e0551919e to your computer and use it in GitHub Desktop.
Save jtmthf/85901a1e9bdb850b4b8dfc5e0551919e to your computer and use it in GitHub Desktop.
type Props<T> = T extends 'div'
? JSX.IntrinsicElements['div']
: T extends keyof JSX.IntrinsicElements
? TagProps<T>
: T extends Component<infer P>
? ComponentClassProps<T, P>
: T extends SFC<infer P> ? StatelessComponentProps<P> : never;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment