From a8140efe58703ed77c6ebd4edf376f2134350989 Mon Sep 17 00:00:00 2001 From: Fathy Boundjadj Date: Fri, 1 Sep 2017 23:40:26 +0200 Subject: [PATCH] [TypeScript] Make createMuiTheme's ThemeOptions recursively partial (#7993) --- src/styles/createMuiTheme.d.ts | 4 +++- test/typescript/styles.spec.tsx | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/styles/createMuiTheme.d.ts b/src/styles/createMuiTheme.d.ts index c91e70da63ae7f..ba939af4b35cbf 100644 --- a/src/styles/createMuiTheme.d.ts +++ b/src/styles/createMuiTheme.d.ts @@ -24,5 +24,7 @@ export type Theme = { T; export default function createMuiTheme( - options?: Partial & T + options?: { + [K in keyof ThemeOptions]?: Partial + } & T ): Theme; diff --git a/test/typescript/styles.spec.tsx b/test/typescript/styles.spec.tsx index aa4924b617b5ea..bdf290dd00bf10 100644 --- a/test/typescript/styles.spec.tsx +++ b/test/typescript/styles.spec.tsx @@ -70,6 +70,12 @@ const theme = createMuiTheme({ }, }); +const customTheme = createMuiTheme({ + palette: { + type: 'dark' + } +}); + function OverridesTheme() { return (