From 4b497b71c304d28c00eda453ac666d32d7990db9 Mon Sep 17 00:00:00 2001 From: Tom Crockett Date: Tue, 21 Aug 2018 23:57:30 -0700 Subject: [PATCH 1/2] Use interfaces for typography types to allow customizing via module augmentation --- .../src/styles/createTypography.d.ts | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/packages/material-ui/src/styles/createTypography.d.ts b/packages/material-ui/src/styles/createTypography.d.ts index f7e80a4a9cc048..ccbca390d18eec 100644 --- a/packages/material-ui/src/styles/createTypography.d.ts +++ b/packages/material-ui/src/styles/createTypography.d.ts @@ -16,24 +16,23 @@ export type TextStyle = export type Style = TextStyle | 'button'; -export interface FontStyle - extends Required<{ - fontFamily: CSSProperties['fontFamily']; - fontSize: number; - fontWeightLight: CSSProperties['fontWeight']; - fontWeightRegular: CSSProperties['fontWeight']; - fontWeightMedium: CSSProperties['fontWeight']; - }> {} +export interface FontStyle extends Required<{ + fontFamily: CSSProperties['fontFamily']; + fontSize: number; + fontWeightLight: CSSProperties['fontWeight']; + fontWeightRegular: CSSProperties['fontWeight']; + fontWeightMedium: CSSProperties['fontWeight']; +}> {} export interface FontStyleOptions extends Partial { htmlFontSize?: number; allVariants?: CSSProperties; } -export type TypographyStyle = Required< - Pick -> & - Partial>; +export type TypographyStyle = + & Required> + & Partial> + ; export interface TypographyStyleOptions extends Partial {} @@ -41,9 +40,9 @@ export interface TypographyUtils { pxToRem: (px: number) => string; } -export type Typography = Record & FontStyle & TypographyUtils; +export interface Typography extends Record, FontStyle, TypographyUtils {} -export type TypographyOptions = Partial & FontStyleOptions>; +export interface TypographyOptions extends Partial & FontStyleOptions> {} export default function createTypography( palette: Palette, From 7a11ba06d44ef2b8c1820e45b34992ccf74fd183 Mon Sep 17 00:00:00 2001 From: Tom Crockett Date: Wed, 22 Aug 2018 00:07:05 -0700 Subject: [PATCH 2/2] Run Prettier --- .../src/styles/createTypography.d.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/packages/material-ui/src/styles/createTypography.d.ts b/packages/material-ui/src/styles/createTypography.d.ts index ccbca390d18eec..b71387878b110f 100644 --- a/packages/material-ui/src/styles/createTypography.d.ts +++ b/packages/material-ui/src/styles/createTypography.d.ts @@ -16,23 +16,24 @@ export type TextStyle = export type Style = TextStyle | 'button'; -export interface FontStyle extends Required<{ - fontFamily: CSSProperties['fontFamily']; - fontSize: number; - fontWeightLight: CSSProperties['fontWeight']; - fontWeightRegular: CSSProperties['fontWeight']; - fontWeightMedium: CSSProperties['fontWeight']; -}> {} +export interface FontStyle + extends Required<{ + fontFamily: CSSProperties['fontFamily']; + fontSize: number; + fontWeightLight: CSSProperties['fontWeight']; + fontWeightRegular: CSSProperties['fontWeight']; + fontWeightMedium: CSSProperties['fontWeight']; + }> {} export interface FontStyleOptions extends Partial { htmlFontSize?: number; allVariants?: CSSProperties; } -export type TypographyStyle = - & Required> - & Partial> - ; +export type TypographyStyle = Required< + Pick +> & + Partial>; export interface TypographyStyleOptions extends Partial {} @@ -42,7 +43,8 @@ export interface TypographyUtils { export interface Typography extends Record, FontStyle, TypographyUtils {} -export interface TypographyOptions extends Partial & FontStyleOptions> {} +export interface TypographyOptions + extends Partial & FontStyleOptions> {} export default function createTypography( palette: Palette,