import * as React from 'react'; import { withStyles, WithStyles, createStyles, Theme } from '@material-ui/core/styles'; import Typography, { TypographyProps } from '@material-ui/core/Typography'; const styles = ({ palette, spacing }: Theme) => createStyles({ root: { padding: spacing.unit, backgroundColor: palette.background.default, color: palette.primary.dark, }, }); interface Props extends WithStyles { color: TypographyProps['color']; text: string; variant: TypographyProps['variant']; } const DecoratedSFC = withStyles(styles)(({ text, variant, color, classes }: Props) => ( {text} )); const DecoratedClass = withStyles(styles)( class extends React.Component { render() { const { text, variant, color, classes } = this.props; return ( {text} ); } }, ); const DecoratedNoProps = withStyles(styles)( class extends React.Component> { render() { return Hello, World!; } }, ); const sfcElem = ; const classElem = ; const noPropsElem = ; interface Book { category: 'book'; author: string; } interface Painting { category: 'painting'; artist: string; } type ArtProps = Book | Painting; const DecoratedUnionProps = withStyles(styles)( class extends React.Component> { render() { const props = this.props; return ( {props.category === 'book' ? props.author : props.artist} ); } }, ); const unionPropElem = ;