__Steps to reproduce:__
npx create-react-app use-styles-tscd use-styles-tsyarn add react-jss@next typescriptyarn add -D @types/reactApp.js -> App.tsx and implement a simple usage of createUseStyles hookimport React from 'react';
import { createUseStyles } from 'react-jss';
const useStyles = createUseStyles({
App: { textAlign: 'center' },
})
function App() {
const classes = useStyles();
return (
<div className={classes.App}>
...
yarn start__Expected behavior:__
__Describe the bug:__
Failed to compile.
/Users/robcmills/src/jss-use-styles/src/App.tsx
TypeScript error in /Users/robcmills/src/jss-use-styles/src/App.tsx(2,10):
Module '"../../../../../Users/robcmills/src/jss-use-styles/node_modules/react-jss/src"' has no exported member 'createUseStyles'. TS2305
1 | import React from 'react';
> 2 | import { createUseStyles } from 'react-jss';
| ^
3 | import logo from './logo.svg';
4 | import './App.css';
createUseStyles is missing from react-jss/src/index.d.tscreateUseStyles to this file silences the error__Versions:__
@kof
Looks like this is already accomplished in @HenriBeck 's udpate-ts-typings branch:
https://github.com/cssinjs/jss/commit/a9881d9f34b50bf366faef0787ddff2a2644bdee
Just needs to be PR'd and merged?
I started already with the typings. I will finish them today
I want to do some more testing tomorrow, and then we will release a new version.
Sorry, had a few busy weeks with work and university. Finally got to check the typing and they look good.
I also started on adding proper type completion for the style object, but it's not correctly inferred at the moment.
@HenriBeck Hi there! May I wonder why this was closed? The types seem to still be missing, for _createUseStyles_ anyways.
I guess, it is not entirely relevant, since I've found out there is a v.10 release of react-jss and documentation I was reffering to was issued for this new version, which is not part of npm package(v8.6.1).
Could you clarify what's the state of new version and if there are any working typescript examples for current version 8.6.1?
Having the same issue, just wondering why the issue has been closed.
@Dar0n there should be @types/react-jss version which is for v8 of react-jss.
@Kudze can you provide an example then maybe? It works for me. You also need to be on the latest v10 alpha for it to work.
Any update on this?
@stewartduffy I know this is now closed but I am having a similar issue: https://github.com/cssinjs/jss/issues/1344
React, using Material-UI via @material-ui/core/styles I'm getting all kinds of type errors when trying to define styles.
Most helpful comment
Having the same issue, just wondering why the issue has been closed.