-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Description
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
I couldn't find a way to augment the common key of a Palette anymore.
Expected Behavior 🤔
That it is possible like before.
Steps to Reproduce 🕹
Material-UI 4.9.5: https://codesandbox.io/s/peaceful-hodgkin-i05mi (working)
Material-UI 4.9.6: https://codesandbox.io/s/nameless-sun-r7nrv (not working)
Context 🔦
After upgrade to 4.9.6 of Material UI our builds started to break.
In version 4.9.6 the common colors are exported from @material-ui/core/colors/common as default and with their name CommonColors as well. This made it possible to augment the types.
Sadly TypeScript doesn't allow augmentation of default exports. That's why it isn't possible in 4.9.6 anymore since CommonColors is gone and a const named common is just exported as default.
Please see microsoft/TypeScript#14080 as reference for the mentioned TypeScript issue.
I also can't augment Palette directly since with augmentation we can't redefine an already defined key of the Palette.
I'm also wondering why the interface was removed. Before there was the interface, a type variable called common and the default export. By just getting the interface back and exported by its name like before this issue would be fixed.
Your Environment 🌎
| Tech | Version |
|---|---|
| Material-UI | v4.9.6 |
| TypeScript | 4.8 |