Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

535
Visualizações
DefaultTheme in Material-UI causes `Invalid module name in augmentation` error

As described in the migration docs (v4 to v5) I've added this to my theme:

import { createTheme, Theme } from '@mui/material/styles'
import { grey } from '@mui/material/colors'

declare module '@mui/styles/defaultTheme' { // <-- ts error
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
  interface DefaultTheme extends Theme {}
}

const { palette } = createTheme()
const { augmentColor } = palette

// Create a theme instance.
export const theme: Theme = createTheme({
  palette: {
    neutral: augmentColor({ color: { main: grey[400] } }),
  }
})

But I get the ts error Invalid module name in augmentation, module '@mui/styles/defaultTheme' cannot be found.ts(2664)

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I don't know why, but importing the module for side-effects fix it:

import { Theme } from "@mui/material/styles";
import "@mui/styles";

declare module "@mui/styles/defaultTheme" {
  // eslint-disable-next-line @typescript-eslint/no-empty-interface (remove this line if you don't have the rule enabled)
  interface DefaultTheme extends Theme {}
}
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda