Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regarding showing error with withStyles ( version v1.0.0-beta.44 ) #11252

Closed
Uma19 opened this issue May 6, 2018 · 2 comments
Closed

Regarding showing error with withStyles ( version v1.0.0-beta.44 ) #11252

Uma19 opened this issue May 6, 2018 · 2 comments

Comments

@Uma19
Copy link

Uma19 commented May 6, 2018

Hello Team,
I am currently using latest material-ui beta 44 version and by doing below i am getting some error?
can you help me to explain why it is thrwing this error specially for position: 'relative'

export const styles = {
drawerPaper: {
position: 'relative'
},
};
export default withStyles(styles)(Sidebar);

by this because of position: relateive mentioned, withStyles(styles) is showing error as

Argument of type '(theme: Theme) => { root: {}; drawerPaper: { width: strin...' is not assignable to parameter of type
'Record<"root" | "expansionPanel" | "drawerPaper", CSSProperties> | StyleRulesCallback<"root

@franklixuefei
Copy link
Contributor

franklixuefei commented May 7, 2018

@Uma19 Please take a look at #10995
For now, you can do the following

type classList =
  | 'drawerPaper';

export default withStyles<classList>(styles)(Sidebar);

or

type classList =
  | 'drawerPaper';

const decorate = withStyles<classList>((theme) => ({
  drawerPaper: {
    position: 'relative'
  }
}));

export default decorate</*your Sidebar props interface here*/>(Sidebar);

@oliviertassinari
Copy link
Member

@franklixuefei Thanks for answering the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants