From 32654ce8d150b594f1aac63794cc777fb7173a3c Mon Sep 17 00:00:00 2001 From: Jonathan Neal Date: Tue, 10 Aug 2021 16:50:41 -0400 Subject: [PATCH] chore: cleanup TransformProps --- packages/react/types/styled-component.d.ts | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/packages/react/types/styled-component.d.ts b/packages/react/types/styled-component.d.ts index db775b3b..7df0d241 100644 --- a/packages/react/types/styled-component.d.ts +++ b/packages/react/types/styled-component.d.ts @@ -1,4 +1,3 @@ -import type * as CSSUtil from './css-util' import type * as Default from './default' import type * as React from 'react' import type * as Util from './util' @@ -8,7 +7,7 @@ export interface StyledComponent< Type = 'span', Props = {}, Media = Default.Media, - TransformedProps = TransformProps, Media> & { css?: Props['css'] } + TransformedProps = TransformProps > extends React.ForwardRefExoticComponent< Util.Assign< Type extends React.ElementType @@ -40,7 +39,7 @@ export interface CssComponent< Type = 'span', Props = {}, Media = Default.Media, - TransformedProps = TransformProps, Media> & { css?: Props['css'] } + TransformedProps = TransformProps > { ( props?: @@ -51,7 +50,7 @@ export interface CssComponent< ): string & { className: string selector: string - props: object + props: {} } className: string @@ -63,15 +62,20 @@ export interface CssComponent< } export type TransformProps = { - [K in keyof Props]: - | Props[K] - | ( - & { - [KMedia in Util.Prefixed<'@', 'initial' | keyof Media>]?: Props[K] - } - & { - [KMedia in string]: Props[K] - } + [K in keyof Props]: ( + K extends 'css' + ? Props[K] + : ( + | Props[K] + | ( + & { + [KMedia in Util.Prefixed<'@', 'initial' | keyof Media>]?: Props[K] + } + & { + [KMedia in string]: Props[K] + } + ) + ) ) }