question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing decorator signature for withStyles in Typescript

See original GitHub issue

Problem 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:closed
  • Created 6 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RichardPergamentcommented, Sep 6, 2017

Edit: nevermind, was a different issue. I followed the test examples and got it to work.

Thanks for the great work sebald!

0reactions
sebaldcommented, Sep 5, 2017

I think this can only be resolved by reinstalling all @types/* and/or other typings need to fix this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found