Skip to content

Instantly share code, notes, and snippets.

@jtmthf
Last active May 5, 2018 20:59
Show Gist options
  • Save jtmthf/b114489f1a83324a59e5e4af19bdf62f to your computer and use it in GitHub Desktop.
Save jtmthf/b114489f1a83324a59e5e4af19bdf62f to your computer and use it in GitHub Desktop.
class Any<T = 'div'> extends Component<Props<T>> {
public static ofType<T>() {
return Any as Constructor<Any<T>>;
}
public render() {
const { is: Cmp = 'div', innerRef, ...props } = this.props as any;
return <Cmp ref={innerRef} {...props} />;
}
}
type Constructor<T = {}> = new (...args: any[]) => T;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment