Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

331
Views
Opciones con nombre personalizado de MUI en la paleta: la propiedad 'principal' no existe en el tipo 'TypeBackground'

Estoy tratando de extender la paleta MUI para poder usar mis propias propiedades con nombre con el siguiente código:

 declare module '@mui/material/styles' { interface Palette { border: Palette['primary'] background: Palette['primary'] } // allow configuration using `createTheme` interface PaletteOptions { border?: PaletteOptions['primary'] background?: PaletteOptions['primary'] } }

border funciona sin problemas, sin embargo, al intentar agregar un nuevo fondo, se queja de este.

Error completo:

 Property 'primary' does not exist on type 'TypeBackground'. TS2339 8 | 9 | const DocumentUploadContainer = styled('div')` > 10 | color: ${props => props.theme.palette.background.primary}; | ^ 11 | ` 12 | export const Documents = () => { 13 | return (

ingrese la descripción de la imagen aquí

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede verificar en el archivo createPalette.d.ts de mui. Porque background ya está en interface PaletteOptions (como puede ver aquí)

 export interface PaletteOptions { primary?: PaletteColorOptions; secondary?: PaletteColorOptions; error?: PaletteColorOptions; warning?: PaletteColorOptions; info?: PaletteColorOptions; success?: PaletteColorOptions; mode?: PaletteMode; tonalOffset?: PaletteTonalOffset; contrastThreshold?: number; common?: Partial<CommonColors>; grey?: ColorPartial; text?: Partial<TypeText>; divider?: string; action?: Partial<TypeAction>; background?: Partial<TypeBackground>; getContrastText?: (background: string) => string; } export interface TypeBackground { default: string; paper: string; }

Por lo tanto, no puede usar el aumento de módulos para anularlo de esta manera. Solo usa otro nombre.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!