Skip to content

Commit

Permalink
[TypeScript] Make createMuiTheme's ThemeOptions recursively partial (m…
Browse files Browse the repository at this point in the history
  • Loading branch information
fathyb authored and sebald committed Sep 1, 2017
1 parent 585783e commit a8140ef
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/styles/createMuiTheme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ export type Theme<T = {}> = {
T;

export default function createMuiTheme<T = {}>(
options?: Partial<ThemeOptions> & T
options?: {
[K in keyof ThemeOptions]?: Partial<ThemeOptions[K]>
} & T
): Theme<T>;
6 changes: 6 additions & 0 deletions test/typescript/styles.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ const theme = createMuiTheme({
},
});

const customTheme = createMuiTheme({
palette: {
type: 'dark'
}
});

function OverridesTheme() {
return (
<MuiThemeProvider theme={theme}>
Expand Down

0 comments on commit a8140ef

Please sign in to comment.