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.

[typescript] `withStyles()` complains unless using `as`

See original GitHub issue
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

No type errors should be reported for adding legal styles kv pairs in withStyles()

Current Behavior

For some style properties, like position, overflow, etc, specifying a valid value, e.g., position: 'absolute' or overflow: 'auto' reports type errors. Example: image

The only hack is to use as: image

Your Environment

Tech Version
Material-UI beta.41
React 16.2.0
etc

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:17 (14 by maintainers)

github_iconTop GitHub Comments

3reactions
pelotomcommented, May 28, 2018

This should be resolved by #11609, take a look at the updated TypeScript guide there and feel free to comment.

3reactions
estaubcommented, Apr 12, 2018

This is a result of the recent updates to @types/jss, at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jss.
AFAICT, no one’s raised an issue on it there yet; someone from mui definitely should!

They (the folks working on the jss type defs) are doing some very radical changes without a good rollout process, imho. It’s not clear to me what a better process would be, though; maybe someone else has a thought.

(I’m not a mui project member or anything, I’m just sharing what I know/think.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

[typescript] withStyles() complains unless using as #10995
I have searched the issues of this repository and believe that this is not a duplicate. Expected Behavior No type errors should be...
Read more >
Typescript Material UI Property 'classes' is missing in type for ...
But you have export your component using export default withStyles(styles)(YourComponent) because otherwise TypeScript will still complain ...
Read more >
TypeScript React with Material-ui's makeStyles/withStyles ...
I don't see why classes should even have a delta property, unless material ui adds the property from the hook to the parent,...
Read more >
TypeScript - Yakov Fain
If you run the app with the browser console open, you'll see the message “useEffect() was invoked” each time when you enter a...
Read more >
TypeScript - Material-UI
Unfortunately due to a current limitation of TypeScript decorators, withStyles(styles) can't be used as a decorator in TypeScript. Customization of Theme. When ...
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