Skip to content

Commit

Permalink
chore: cleanup TransformProps
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathantneal committed Aug 10, 2021
1 parent 013a22d commit 32654ce
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/react/types/styled-component.d.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -8,7 +7,7 @@ export interface StyledComponent<
Type = 'span',
Props = {},
Media = Default.Media,
TransformedProps = TransformProps<Omit<Props, 'css'>, Media> & { css?: Props['css'] }
TransformedProps = TransformProps<Props, Media>
> extends React.ForwardRefExoticComponent<
Util.Assign<
Type extends React.ElementType
Expand Down Expand Up @@ -40,7 +39,7 @@ export interface CssComponent<
Type = 'span',
Props = {},
Media = Default.Media,
TransformedProps = TransformProps<Omit<Props, 'css'>, Media> & { css?: Props['css'] }
TransformedProps = TransformProps<Props, Media>
> {
(
props?:
Expand All @@ -51,7 +50,7 @@ export interface CssComponent<
): string & {
className: string
selector: string
props: object
props: {}
}

className: string
Expand All @@ -63,15 +62,20 @@ export interface CssComponent<
}

export type TransformProps<Props, Media> = {
[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]
}
)
)
)
}

Expand Down

0 comments on commit 32654ce

Please sign in to comment.