createTheme throwing type errors with typescript
See original GitHub issuecreateTheme 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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:21 (13 by maintainers)
Top Results From Across the Web
createTheme throwing type errors with typescript · Issue #27139
createTheme is throwing compile time error The issue is present in the latest release. I have searched the issues of this repository and...
Read more >Typescript Type error when Adding custom new property 'tab ...
Correct theme setting. import { createTheme } from "@material-ui/core"; const arcBlue = "#0B72B9"; const arcOrange = "#FF8C00"; ...
Read more >Get a catch block error message with TypeScript - Kent C. Dodds
TypeScript forces you to acknowledge you can't know what was thrown making getting the error message a pain. Here's how you can manage...
Read more >Theming - Material UI - MUI
To promote greater consistency between apps, light and dark theme types are available to choose from. ... It will throw an error if...
Read more >Extend Material-UI theme in TypeScript - In Plain English
Combination of React and TypeScript is super powerful and beautiful. ... The answer is extending Material UI theme type by yourself.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.