CSS auto-completion in React TypeScript not working

CSS suggestions and auto-completion work fine in a JavaScript React project like in the first picture, but nothing shows up when it's in TypeScript. Is there a way to enable those in tsx also?

 

js:

 

tsx:

 

7 comments
Comment actions Permalink

It should work in the same way in Typescript

Please could you share code snippets/files the issue can be repeated with?

0
Comment actions Permalink

Sorry, I didn't articulate my question properly yesterday. I'm using @material-ui/core dependency and the problem is with its 'makeStyles' hook which uses JSS. I've tried several times creating a new React app, npm installing the dependency and typing the code like in the picture below. Suggestions always only show up in js but not in Typescript project. To clarify, they work fine within a seperate CSS file. 

 

 

 

0
Comment actions Permalink

What @material-ui/core version do you use? Can be related to https://youtrack.jetbrains.com/issue/WEB-48038

0
Comment actions Permalink

I was using 4.11.2 but seeing that issue you linked I just tried 4.0.0 and alpha 5.0.0 on new projects but still the same problem exists.

0
Comment actions Permalink

Thank you Elena. However, I tried in WS-202.8194.6 and it doesn't work for me, and I looked at the screenshots you took for the issue ticket and I don't think it works for you either. It only shows @font-face there but this is what it shows in javascript:

 

 

And if you try again what you did in the second screenshot but in the older version now, I believe it won't show you anything when you start typing 'border' for example. At least doesn't for me.

0
Comment actions Permalink

Yaaay, just found out that everything works when using createStyles: https://material-ui.com/styles/api/

 

0

Please sign in to leave a comment.