-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"TS2554: Expected 1 arguments, but got 0." on hook returned by makeStyles #14018
Comments
Please include your Unrelated nitpick: Prefer resolved version strings |
I'm not running The version bundled with the WebStorm I'm using is Updated the OP to reflect the React version I use:
(I get the same message when
|
Then your setup has an issue too. We test for callback usage and that is working fine. It does however has a reproducible bug when using a static styles object. |
The issue is back with combination of |
@TeoTN Thanks for the report. I think I know why this happens. |
@TeoTN Could you include the code that is causing trouble. I can't reproduce it. |
@eps1lon here's a repo that reproduces the bug: TeoTN/mui-ts-bug |
I also came across the error of this ticket with When downgrading to
I was able to fix this in combination with
Perhaps worth mentioning is that only the Using |
Since this issues only occurs in a release candidate of typescript I'll close this. We can't support unstable versions of our dependencies. Please file a new issue if this error re-appears in a stable version of Typescript. |
It seems to be actual for typescript 3.5.1, which is the latest stable version for now (together with material-ui 4) |
With the 4.0.2 version and ts 3.5.1 I can trigger this error by adding "strictNullChecks": false to my tsconfig.json. |
This is not supported by our typings:
-- https://material-ui.com/guides/typescript/ Every package published under |
I’m surprised. I’ve inherited projects with strict:false and never had it generate more errors before. Since v3.x worked, I assumed that 4.x would too. Anyway, that note might help others who are reporting this problem, it’s certainly an unexpected cost to upgrading. |
There were other issues in 3.x as far as I remember. You either didn't encounter them or already had unsound types. This requirement wasn't introduced with 4.x. |
I'm sure that there were and I lucked out. But, if I take a sample project that compiles fine with |
Has to do with utility types that break with |
This issue needs re-open! |
How do I get around this issue for now? If I pass in null, makeStyles throws 'cannot find classes of undefined' error. Sometimes I don't have props to pass, so what do I pass? |
@krazyjakee try |
Thanks this worked! |
I come across this error with typescript 3.7.5. |
FWIW, seeing the same thing. I've tried the suggestions posted here (#16867) with |
+ locked @material-ui dependencies version because of typing errors on new versions => mui/material-ui#14018
Expected Behavior 🤔
TypeScript shouldn't show an error when doing:
Outside the component:
const useStyles = makeStyles(styles);
Inside the component:
const {/* stuff */} = useStyles();
Current Behavior 😯
The
useStyles();
function call is underlined, and WebStorm says "TS2554: Expected 1 arguments, but got 0." on it.The text was updated successfully, but these errors were encountered: