Skip to content Skip to sidebar Skip to footer

Add Property To Background Prop In Createmuitheme In Material-ui Using Typescript

I'm trying to add a new property inside the createMuiTheme. But Typescript don't let me do. I followed the instructions here : https://next.material-ui.com/guides/typescript/#custo

Solution 1:

Ok, so I just found a solution. But I don't really understand why is it working.

I modified the "declare module" line :

declare module'@material-ui/core/styles/createPalette'

I just added "createPalette" after styles. Now it's working, I just can't figure out why ^^!

Solution 2:

You need export the interface in the module declaration.

exportinterfaceTypeBackground {
    darker: string;
  }

Post a Comment for "Add Property To Background Prop In Createmuitheme In Material-ui Using Typescript"