Skip to content

Commit

Permalink
[typescript] Allow module augmentation for Mixins (#32798)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnajdova authored May 20, 2022
1 parent 0f4f675 commit f859ef9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/mui-material/src/styles/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export {
duration,
easing,
} from './createTransitions';
export { Mixins } from './createMixins';
export {
Direction,
Breakpoint,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { Interpolation } from '@mui/system';
import { createTheme, styled } from '@mui/material/styles';

declare module '@mui/material/styles' {
interface Mixins {
customMixin: Interpolation<{}>;
}
}

// ensure MixinsOptions work
const theme = createTheme({ mixins: { customMixin: { paddingLeft: 2 } } });

// ensure Mixins work
const Example = styled('div')(({ theme: t }) => t.mixins.customMixin);
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "../../../../../tsconfig",
"files": ["createTheme.spec.ts"]
}

0 comments on commit f859ef9

Please sign in to comment.