Types don't work on on `createUseStyles`
See original GitHub issueExpected behavior:
I expect the same type inference/autocompletion when using createUseStyles
that I get when I use the style
attribute in jsx. Here you can see the autocompletion offered on <div style...
Describe the bug:
There is no autocompletion when using createUseStyles
I’m a little bit confused because it appears as though a PR was merged to fix this behaviour but it doesn’t seem to be working: https://github.com/cssinjs/jss/pull/1352
@moshest is the behavior you were aiming to fix with that PR? or am I misunderstanding something?
Codesandbox link: https://codesandbox.io/s/react-jss-ts-13cqf
Versions (please complete the following information):
- jss: 10.5.0
- react-jss: 10.5.0
- react: 17.0.0 Feel free to add any additional versions which you may think are relevant to the bug.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
TypeScript Typings with createUseStyles from react-jss
I think I've found the solution. The passing of theme/props to the classes still feels strange to me but it works and satisfies...
Read more >JSS integration with React
Use useTheme() hook to access the theme inside of the function component. import React from 'react' import {createUseStyles, useTheme, ThemeProvider} ...
Read more >@types/jss | Yarn - Package Manager
jss provides its own type definitions, so you don't need @types/jss installed! ... Since you are interested in what happens next, in case,...
Read more >How To Style React Components | DigitalOcean
You won't be using it in your application and you should remove unused files as you work. It will save you from confusion...
Read more >jsstyles - Bountysource
const useStyles = createUseStyles({ styles: { margin: props ... that the object itself extending multiple objects (an array), the jss seem doesn't work....
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 FreeTop 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
Top GitHub Comments
we’ve being using JSS for 2 years and it’s never worked. but I’ve made a PR that should make this work for TypeScript and JavaScript users: #1454
@moshest I have added you to the core team since you have contributed to many typescript changes already, so you can review and merge them as you see fit, feel free to ping me if anything in twitter dm https://twitter.com/kof