Skip to content

[docs] Add necessary imports to Typescript theme augmentation example #47425

@em843

Description

@em843

Related page

https://mui.com/material-ui/customization/palette/#typescript-2

Kind of issue

Missing information

Issue description

The "Theme augmentation" example looks complete, but it actually breaks other @mui/material/styles imports in your app if you don't include the module imports. It should include the necessary imports to avoid confusion.

People have been making this mistake: #31864

My suggestion for the theme augmentation example:

import '@mui/material/styles'; // <-- Add this line

declare module '@mui/material/styles' {
  interface PaletteColor {
    darker?: string;
  }

  interface SimplePaletteColorOptions {
    darker?: string;
  }
}

Context

No response

Search keywords: Theme augmentation, Typescript, theme, import

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsImprovements or additions to the documentation.support: docs-feedbackFeedback from documentation page.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions