material-ui: createTheme throwing type errors with typescript
createTheme is throwing compile time error
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior ๐ฏ
node_modules/@material-ui/core/styles/createTheme.d.ts:10:18 - error TS2430: Interface 'import("/Users/vrajole/sg-core/frontend-monorepo/packages/lib/auth/node_modules/@material-ui/core/styles/createTheme").ThemeOptions' incorrectly extends interface 'import("/Users/vrajole/sg-core/frontend-monorepo/packages/lib/auth/node_modules/@material-ui/system/createTheme/createTheme").ThemeOptions'.
Types of property 'zIndex' are incompatible.
Type 'Partial<ZIndex> | undefined' is not assignable to type 'Record<string, number> | undefined'.
Type 'Partial<ZIndex>' is not assignable to type 'Record<string, number>'.
Property 'mobileStepper' is incompatible with index signature.
Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'.
10 export interface ThemeOptions extends SystemThemeOptions {
~~~~~~~~~~~~
Found 1 error.
error Command failed with exit code 1.
Expected Behavior ๐ค
Steps to Reproduce ๐น
Steps:
- Use material ui mentioned version with typescript (No need to create new theme)
Context ๐ฆ
Your Environment ๐
@material-ui/core: 5.0.0-alpha.37,
@material-ui/icons: 5.0.0-alpha.37,
Node: 15.8.0
Yarn: 1.22.4
npm: 7.17.0
`npx @material-ui/envinfo`
Don't forget to mention which browser you used.
Output from `npx @material-ui/envinfo` goes here.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 9
- Comments: 21 (13 by maintainers)
Commits related to this issue
- [types] Fix discrepancy between core and system `ThemeOptions` Fixes #27139. — committed to fmeum/material-ui by fmeum 3 years ago
- [types] Fix discrepancy between core and system `ThemeOptions` Fixes #27139. — committed to fmeum/material-ui by fmeum 3 years ago
@vishalrajole Interesting, @mnajdova I see 3 solutions:
https://stackoverflow.com/questions/54489817/typescript-partialt-type-without-undefined.
PR welcome.
@oliveirag thanks for the interest and sorry for the late response. I would go with Option 3 ๐ Feel free to grab it if you are still interested.
This is the only type error I am seeing with my codebase. I could try to develop a reproducer for this, but I donโt think this would reliably uncover other potential type issues.
I just submitted https://github.com/mui-org/material-ui/pull/30095 to get this fixed.
solved it by adding
"skipLibCheck": truetocompilerOptionsintsconfig.jsonfile. Weird.Same issue also observed on
@material-ui/core: 5.0.0-beta.0version