[theme-ui] Make styles' properties optional (#38261)

* Make theme-ui styles properties optional

* Add theme-ui styles test
This commit is contained in:
Rodrigo Pombo 2019-09-25 17:42:15 -03:00 committed by Michael Crane
parent ad9de8655d
commit fe0910342b
2 changed files with 18 additions and 1 deletions

View File

@ -3,6 +3,7 @@
// Definitions by: Erik Stockmeier <https://github.com/erikdstock>
// Ifiok Jr. <https://github.com/ifiokjr>
// Brian Andrews <https://github.com/sbardian>
// Rodrigo Pombo <https://github.com/pomber>
// 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;
};
}

View File

@ -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,
},
},
};