diff --git a/packages/create-emotion-styled/types/common.d.ts b/packages/create-emotion-styled/types/common.d.ts index 52fbea3a8..11cb5abcd 100644 --- a/packages/create-emotion-styled/types/common.d.ts +++ b/packages/create-emotion-styled/types/common.d.ts @@ -1,7 +1,7 @@ // Definitions by: Junyoung Clare Jang // TypeScript Version: 2.3 -import { Emotion, Interpolation as BaseInterpolation } from 'create-emotion'; +import { Emotion, Interpolation as BaseInterpolation, CSSObject } from 'create-emotion'; export interface ArrayInterpolation extends Array> {} export type FunctionInterpolation = (props: Props, context: any) => Interpolation; diff --git a/packages/create-emotion-styled/types/test.tsx b/packages/create-emotion-styled/types/test.tsx index dfd29f3b6..ec8a9c076 100644 --- a/packages/create-emotion-styled/types/test.tsx +++ b/packages/create-emotion-styled/types/test.tsx @@ -191,3 +191,10 @@ const ComposingComp = createStyled.div` color: black; } `; + +const CSSPropComp = createStyled.div(); +; +; diff --git a/packages/create-emotion/types/index.d.ts b/packages/create-emotion/types/index.d.ts index 2b0331f14..9a8b87f75 100644 --- a/packages/create-emotion/types/index.d.ts +++ b/packages/create-emotion/types/index.d.ts @@ -90,3 +90,18 @@ export interface EmotionOptions { } export default function createEmotion(context: EmotionContext, options?: EmotionOptions): Emotion; + +declare module 'react' { + interface HTMLAttributes { + css?: Interpolation; + } +} + +// Preact support for css prop +declare global { + namespace JSX { + interface HTMLAttributes { + css?: Interpolation; + } + } +} diff --git a/packages/emotion/types/index.d.ts b/packages/emotion/types/index.d.ts index a186a17c4..6b912f9b4 100644 --- a/packages/emotion/types/index.d.ts +++ b/packages/emotion/types/index.d.ts @@ -15,9 +15,3 @@ export const injectGlobal: Emotion['injectGlobal']; export const keyframes: Emotion['keyframes']; export const sheet: Emotion['sheet']; export const caches: Emotion['caches']; - -declare module 'react' { - interface HTMLAttributes { - css?: Interpolation; - } -} diff --git a/packages/preact-emotion/types/test.tsx b/packages/preact-emotion/types/test.tsx index d31a33654..389f6ab15 100644 --- a/packages/preact-emotion/types/test.tsx +++ b/packages/preact-emotion/types/test.tsx @@ -157,6 +157,25 @@ mount = {}} />; Component = Component.withComponent('input'); mount = {}} />; +/** + * css prop + */ +Component = styled.div({ color: 'red' }); +mount = ; +mount = ( + +); +mount =
; +mount = ( +
+); + /* * Reference to other styled component */ diff --git a/packages/react-emotion/types/tests.tsx b/packages/react-emotion/types/tests.tsx index 82e68a4cd..2f6b953d4 100644 --- a/packages/react-emotion/types/tests.tsx +++ b/packages/react-emotion/types/tests.tsx @@ -153,6 +153,25 @@ mount = {}} />; Component = Component.withComponent('input'); mount = {}} />; +/** + * css prop + */ +Component = styled.div({ color: 'red' }); +mount = ; +mount = ( + +); +mount =
; +mount = ( +
+); + /* * Reference to other styled component */