[Box] No MuiBox property defined in ThemeOptions.overrides (typescript)
See original GitHub issuecan not override MuiBox theme from createMuiTheme in typescrpt, because ThemeOptions.overrides doesn’t provide MuiBox
- 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 😯
when we try to add MuiBox property in overrides object for creating new theme, it says :
Object literal may only specify known properties, and 'MuiBox' does not exist in type 'Overrides'
Expected Behavior 🤔
ThemeOptions.overrides type should contain MuiBox property
Steps to Reproduce 🕹
- create a theme with createMuiTheme
- add overrides property to it
- try adding MuiBox to overrides
`npx @material-ui/envinfo`
System: OS: Linux 5.4 Linux Mint 20.1 (Ulyssa) Binaries: Node: 15.14.0 - ~/.nvm/versions/node/v15.14.0/bin/node Yarn: Not Found npm: 7.7.6 - ~/.nvm/versions/node/v15.14.0/bin/npm Browsers: Chrome: 89.0.4389.114 Firefox: 87.0 npmPackages: @material-ui/core: ^4.11.0 => 4.11.0 @material-ui/icons: ^4.9.1 => 4.9.1 @material-ui/lab: 4.0.0-alpha.56 => 4.0.0-alpha.56 @material-ui/pickers: ^3.2.10 => 3.2.10 @material-ui/styles: ^4.10.0 => 4.10.0 @material-ui/system: 4.9.14 @material-ui/types: 5.1.0 @material-ui/utils: 4.10.2 @types/react: ^16.9.0 => 16.9.46 react: ^16.13.1 => 16.13.1 react-dom: ^16.13.1 => 16.13.1 styled-components: 5.2.0 typescript: ^3.9.7 => 3.9.7
tsconfig
{ "compilerOptions": { "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "noImplicitAny": false, "strictFunctionTypes": false, "forceConsistentCasingInFileNames": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "baseUrl": "src", "jsx": "preserve", "experimentalDecorators": true }, "include": ["src"], "exclude": ["node_modules"] }Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top GitHub Comments
@mnajdova thanks. It would help my migration if you would add this class back.
@dknadratsenka my bad for not adding the
MuiBox-root
class on theBox
component, we should definitely add it. Would that help your migration? I’d say you could easily move the overrides from theMuiBox
to theMuiCssBaseline
style overrides inside the theme for example, by using theMuiBox-root
class:https://codesandbox.io/s/nervous-dust-fmbl6?file=/src/App.js