Skip to content

Commit

Permalink
Unparameterize Theme type (mui#9295)
Browse files Browse the repository at this point in the history
  • Loading branch information
pelotom authored and sebald committed Nov 27, 2017
1 parent 6159f5c commit be0d4fd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/styles/MuiThemeProvider.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from 'react';
import { Theme } from './createMuiTheme';

export interface MuiThemeProviderProps {
theme?: Theme<any>;
theme?: Theme;
sheetsManager?: Object;
children: React.ReactNode;
}
Expand Down
10 changes: 5 additions & 5 deletions src/styles/createMuiTheme.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export interface ThemeOptions {
overrides?: { [name: string]: StyleRules };
}

export type Theme<T = {}> = {
export type Theme = {
direction: 'ltr' | 'rtl';
palette: Palette;
typography: Typography;
Expand All @@ -31,8 +31,8 @@ export type Theme<T = {}> = {
spacing: Spacing;
zIndex: ZIndex;
overrides?: { [name: string]: StyleRules; };
} & T;
};

export default function createMuiTheme<T = {}>(
options?: ThemeOptions & T
): Theme<T>;
export default function createMuiTheme(
options?: ThemeOptions
): Theme;
8 changes: 5 additions & 3 deletions src/styles/withTheme.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Theme } from './createMuiTheme';

export default function withTheme<P = {}, T extends Theme = Theme>():
(component: React.ComponentType<P & { theme: T }>
) => React.ComponentClass<P>;
declare const withTheme: <P = {}>() => (
component: React.ComponentType<P & { theme: Theme }>
) => React.ComponentClass<P>;

export default withTheme

0 comments on commit be0d4fd

Please sign in to comment.