Hi,
I have this issue https://github.com/mui-org/material-ui/issues/16198, although it says it's been fixed.
Is there something I'm missing?
Thanks!
@polll Do you have a reproduction?
The project fails to compile and gives a Typescript error:
Type 'CreateCSSProperties<{}>' is not assignable to type 'CreateCSSProperties<{}> | ((props: {}) => CreateCSSProperties<{}>)'.
Type 'CreateCSSProperties<{}>' is not assignable to type '(props: {}) => CreateCSSProperties<{}>'.
No compilation errors.
Link to live codesandbox: https://codesandbox.io/embed/create-react-app-with-typescript-s4n6m
But I haven't been able to repro just yet. Standby.
Steps (pending):
1.
2.
3.
4.
tsconfig
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "build/dist",
"module": "esnext",
"moduleResolution": "node",
"target": "es5",
"downlevelIteration": true,
"jsx": "preserve",
"experimentalDecorators": true,
"sourceMap": true,
"skipDefaultLibCheck": true,
"keyofStringsOnly": true,
"strict": false,
"strictNullChecks": false,
"allowSyntheticDefaultImports": true,
"lib": [
"es6",
"dom"
],
"noImplicitAny": false,
"types": [
"node"
],
"typeRoots": [
"node_modules/@types",
"typing"
],
"allowJs": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"esModuleInterop": true
},
"exclude": [
"node_modules",
"build",
"scripts",
"acceptance-tests",
"webpack",
"jest",
"src/setupTests.ts"
],
"include": [
"src"
]
}
| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.4.2 |
| React | v16.8 |
| Browser | Chrome 76 |
| TypeScript | 3.3.4 |
| etc. | |
Please provide a full example (follow the issue template), the snippet you included doesn't produce any errors for me.
Haven't been able to repro in the live sandbox so it could be my local env which I'm currently investigating
It might be the tsconfig, codesandbox has strict mode, yours doesn't. Give this a quick read and see if it helps https://material-ui.com/guides/typescript/
Should we close the issue, having no reproduction?
Hey all, I just thought I'd update this with info about what solved this issue for me.
Turns out I was using 2nd and 3rd level deep imports together in the makeStyles hook. Converting everything to the 3rd level deep import solved it for me.
So basically go from something like this:
import { createStyles, Theme } from '@material-ui/core/styles';
import { makeStyles } from '@material-ui/styles';
to:
import { createStyles, Theme, makeStyles } from '@material-ui/core/styles';
Hope this helps! @oliviertassinari
Most helpful comment
Please provide a full example (follow the issue template), the snippet you included doesn't produce any errors for me.