Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

365
Vistas
MUI Property 'palette' does not exist on type 'Theme'

I am using MUI with typescript. And I keep getting this error

Property 'palette' does not exist on type 'Theme'.ts(2339)

Here is the code

const StyledTextField = styled(TextField)(({ theme }) => ({
  backgroundColor: theme.palette.primary.main,
}));

But when I console.log the theme variable, it displays an object with the paletteproperty.

{palette:...}

Why is typescript showing this error, when the object has the properties? what type should I make the theme variable for the compiler to pass?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I tried to simlate your issue and i only could get this error if I import styled from @mui/styles or @mui/styled-engine.

Styled should be import from @mui/material/styles, as you can see here. So, the code will be like:

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

Regarding the difference of the both imports, according to Mui docs:

@mui/styled-engine:

@mui/styled-engine - a thin wrapper around emotion's styled() API, with the addition of few other required utilities, such as the <GlobalStyles /> component, the css and keyframe helpers, etc. This is the default.

* Basically it wont work with other @mui libraries, like ThemeProvider.

@mui/material/styles:

All the MUI components are styled with this styled() utility. This utility is built on top of the styled() module of @mui/styled-engine and provides additional features.

And styled imported from @mui/material/styles use styled code from @mui/styled-engine as base, implementing features and making it possible to work and handle with other @mui librarys such as ThemeProvider and createTheme.

You can check the difference of both implementation below:

  1. from @mui/material/styles

  2. from @mui/styled-engine

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda