score:4

Accepted answer
import { StyledComponentProps } from 'material-ui';
import { Theme } from 'material-ui/styles/createMuiTheme';
import { StyleRules, StyleRulesCallback, WithStylesOptions } from 'material-ui/styles/withStyles';
import { withStyles } from 'material-ui/styles'
declare module 'material-ui/styles' {
  export function withStyles(
    style: StyleRules | StyleRulesCallback,
    options?: WithStylesOptions
  ): <C extends React.ComponentType<P & { classes: ClassNames; theme?: Theme }>, P = {}, ClassNames = {}> (
      component: C
    ) => C & React.ComponentClass<P & StyledComponentProps<ClassNames>>;

}
@withStyles(styles) // no error now
class MyComponent extends React.Component<any, any> {
  manager: any;
}

score:1

import { withStyles, WithStyles } from './withStyles';

@withStyles(styles)
export class MyClass extends React.Component<MyClassProps> {
  render() {
    // classes will always exist so use `!`.
    const classes = this.props.classes!;

    return (
      <div className={classes.root} />
    );
  }
}

Related Query

More Query from same tag