From fe0910342b05b2726e8d4c03627f9f3d5b0b884e Mon Sep 17 00:00:00 2001 From: Rodrigo Pombo Date: Wed, 25 Sep 2019 17:42:15 -0300 Subject: [PATCH] [theme-ui] Make styles' properties optional (#38261) * Make theme-ui styles properties optional * Add theme-ui styles test --- types/theme-ui/index.d.ts | 3 ++- types/theme-ui/theme-ui-tests.tsx | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/types/theme-ui/index.d.ts b/types/theme-ui/index.d.ts index 9291c22bc7..5db03511ff 100644 --- a/types/theme-ui/index.d.ts +++ b/types/theme-ui/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Erik Stockmeier // Ifiok Jr. // Brian Andrews +// Rodrigo Pombo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.1 @@ -111,7 +112,7 @@ export interface Theme extends StyledSystemTheme { * fonts, etc. */ styles?: { - [P in StyledTags]: SystemStyleObject; + [P in StyledTags]?: SystemStyleObject; }; } diff --git a/types/theme-ui/theme-ui-tests.tsx b/types/theme-ui/theme-ui-tests.tsx index c274f3dda0..fd638df2c2 100644 --- a/types/theme-ui/theme-ui-tests.tsx +++ b/types/theme-ui/theme-ui-tests.tsx @@ -96,3 +96,19 @@ const incompleteThemeColorModes: Theme = { }, }, }; + +const themeWithStyles: Theme = { + colors: { + text: '#000', + background: '#fff', + primary: '#07c', + }, + styles: { + h1: { + fontSize: 32, + color: 'primary', + mt: 4, + mb: 2, + }, + }, +};