Created
July 20, 2018 17:46
-
-
Save quicksnap/c536f59d18d85ca3e0883296b4f4359d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as CSS from 'csstype' | |
type SingleOrArray<Properties, T extends keyof Properties> = { | |
[P in T]: Properties[P] | Array<Properties[P]> | |
} | |
type CSSPropertiesLoosePseudo = { [K in CSS.Pseudos]?: CSSPropertiesLoose } | |
type CSSPropertiesPseudo = { [K in CSS.Pseudos]?: CSSProperties } | |
type CSSPropertiesComplete = SingleOrArray<CSS.Properties, keyof CSS.Properties> | |
interface CSSPropertiesLossy { | |
[propertyName: string]: | |
| string | |
| number | |
| CSSPropertiesComplete | |
| undefined | |
| Array<CSSPropertiesComplete[keyof CSSPropertiesComplete]> | |
| CSSPropertiesLossy | |
} | |
interface CSSPropertiesLoose | |
extends CSSPropertiesComplete, | |
CSSPropertiesLoosePseudo, | |
CSSPropertiesLossy {} | |
interface CSSProperties extends CSSPropertiesComplete, CSSPropertiesPseudo {} | |
type CSSFunction = (props: {}) => Style | |
type Style = | |
| CSSPropertiesComplete & CSSPropertiesPseudo | |
| CSSFunction | |
| StyleArray | |
interface StyleArray extends Array<Style | undefined> {} | |
type StyleLoose = CSSPropertiesLoose | CSSFunction | StyleLooseArray | boolean | |
interface StyleLooseArray extends Array<StyleLoose | undefined> {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment