Skip to content

Commit

Permalink
🤖 Merge PR DefinitelyTyped#45114 (styled-system/css) Export types for…
Browse files Browse the repository at this point in the history
… clarity by @hasparus

* (styled-system/css) Export EmotionLabel

* Explicitly export for clarity
  • Loading branch information
hasparus committed May 28, 2020
1 parent 6500571 commit 3062109
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
22 changes: 12 additions & 10 deletions types/styled-system__css/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@

import * as CSS from 'csstype';

type StandardCSSProperties = CSS.PropertiesFallback<number | string>;
export {};

export type StandardCSSProperties = CSS.PropertiesFallback<number | string>;

/**
* Omit exists in TypeScript >= v3.5, we're putting this here so typings can be
* used with earlier versions of TypeScript.
*/
type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;
export type Omit<T, K> = Pick<T, Exclude<keyof T, K>>;

/**
* The `css` function accepts arrays as values for mobile-first responsive styles.
Expand Down Expand Up @@ -42,12 +44,12 @@ export type CSSPseudoSelectorProps = { [K in CSS.Pseudos]?: SystemStyleObject };
*/
export interface CSSObject extends CSSPropertiesWithMultiValues, CSSPseudosForCSSObject, CSSOthersObjectForCSSObject {}

type CSSPropertiesWithMultiValues = {
export type CSSPropertiesWithMultiValues = {
[K in keyof CSSProperties]: CSSProperties[K];
};
type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
type CSSInterpolation = undefined | number | string | CSSObject;
interface CSSOthersObjectForCSSObject {
export type CSSPseudosForCSSObject = { [K in CSS.Pseudos]?: CSSObject };
export type CSSInterpolation = undefined | number | string | CSSObject;
export interface CSSOthersObjectForCSSObject {
[propertiesName: string]: CSSInterpolation;
}

Expand All @@ -58,7 +60,7 @@ export interface CSSSelectorObject {
[cssSelector: string]: SystemStyleObject;
}

interface AliasesCSSProperties {
export interface AliasesCSSProperties {
/**
* The **`background-color`** CSS property sets the background color of an element.
*
Expand Down Expand Up @@ -305,7 +307,7 @@ interface AliasesCSSProperties {
paddingY?: StandardCSSProperties['paddingTop'];
}

interface OverwriteCSSProperties {
export interface OverwriteCSSProperties {
/**
* The **`box-shadow`** CSS property adds shadow effects around an element's frame. You can set multiple effects separated by commas. A box shadow is described by X and Y offsets relative to the
* element, blur and spread radii, and color.
Expand Down Expand Up @@ -352,7 +354,7 @@ interface OverwriteCSSProperties {
* Only used internally to map CCS properties to input types (responsive value,
* theme function or nested) in `SystemCssProperties`.
*/
interface AllSystemCSSProperties
export interface AllSystemCSSProperties
extends Omit<CSSProperties, 'boxShadow' | 'fontWeight' | 'zIndex'>,
AliasesCSSProperties,
OverwriteCSSProperties {}
Expand Down Expand Up @@ -393,7 +395,7 @@ export interface UseThemeFunction {
(theme: any): SystemStyleObject;
}

interface EmotionLabel {
export interface EmotionLabel {
label?: string;
}

Expand Down
13 changes: 12 additions & 1 deletion types/styled-system__css/styled-system__css-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const theme = {
},
zIndicies: {
base: 100,
}
},
};

export const themeWithVariants: Theme = {
Expand Down Expand Up @@ -249,3 +249,14 @@ css({

// ignores null
css(null);

css({
label: 'foo',
button: {
label: 'bar',
color: 'blue',
},
'> *': {
label: 'baz',
},
});

0 comments on commit 3062109

Please sign in to comment.