Missing decorator signature for withStyles in Typescript
See original GitHub issueProblem description
The typescript definition for withStyles
doesn’t allow for the function to be used as a decorator.
Steps to reproduce
@withStyles(styles)
export class Test extends React.Component<StylingProps> {
render() {
const {classes} = this.props;
return <h1 className={classes.h1}>{this.props.children}</h1>;
}
}
Versions
- Material-UI:
v1-beta
- React:
- Browser:
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Missing decorator signature for withStyles in Typescript #8030
Problem description The typescript definition for withStyles doesn't allow for the function to be used as a decorator.
Read more >How to type the use of Material-UI's `withStyles` decorator in ...
Unfortunately due to a current limitation of TypeScript decorators, withStyles(styles) ... Probably your props type is missing classes field.
Read more >Documentation - Decorators - TypeScript
Decorators provide a way to add both annotations and a meta-programming syntax for class declarations and members. Decorators are a stage 2 proposal...
Read more >the types returned by 'render()' are incompatible between ...
React: ComponentClass has incompatible render signature #18765 Closed sebald mentioned this issue on Sep 4, 2017 Missing decorator signature for withStyles ...
Read more >mobxjs/mobx - Gitter
If I use the inject decorator the interface for the props will be infered ... -and-observer-with-the-decorator-syntax-with-typescript-and-avoid-the-missing- ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Edit: nevermind, was a different issue. I followed the test examples and got it to work.
Thanks for the great work sebald!
I think this can only be resolved by reinstalling all
@types/*
and/or other typings need to fix this.