Documentation for extending theme is wrong. Module Augmentation does not work.
Open
Nobody has claimed this yet.
docs
scope: all components
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
In https://mui.com/customization/theming/#custom-variables the docs tell you to use following example to extend typescript type but it is not working:
declare module '@mui/material/styles' {
interface Theme {
status: {
danger: string;
};
}
// allow configuration using `createTheme`
interface ThemeOptions {
status?: {
danger?: string;
};
}
}
- 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 😯
Current example in docs does not work.
Expected Behavior 🤔
Example should work.
Steps to Reproduce 🕹
Follow the docs.
The following type does work instead:
declare module "@mui/material/styles/createTheme" {
interface Theme {
test: string,
}
// allow configuration using `createMuiTheme`
interface ThemeOptions {
test?: string;
}
}
Your Environment 🌎
`npx @mui/envinfo`
System:
OS: Linux 5.10 Ubuntu 20.04.2 LTS (Focal Fossa)
Binaries:
Node: 14.17.5 - /usr/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 7.24.1 - /usr/bin/npm
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.