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.

Types don't work on on `createUseStyles`

See original GitHub issue

Expected 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... image

Describe the bug: There is no autocompletion when using createUseStyles image

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

github_iconTop GitHub Comments

4reactions
k-ylecommented, Feb 17, 2021

Was this ever working in react-jss?

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

3reactions
kofcommented, Jan 18, 2021

@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

Read more comments on GitHub >

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

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