Skip to content

Commit

Permalink
Remove no longer needed StyleProps type parameter (#1685)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored Dec 14, 2019
1 parent ba105a5 commit 2fa7a21
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 23 deletions.
5 changes: 5 additions & 0 deletions .changeset/modern-socks-remember.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/styled': patch
---

Remove `StyleProps` type parameter from `CreateStyledComponent` - it's no longer needed.
21 changes: 2 additions & 19 deletions packages/styled/types/base.d.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// TypeScript Version: 3.2

/**
* @desc
* In following types,
* `InnerProps` is type parameter that represents props type of
* internal component (target of styling)
* `ExtraProps` is type parameter that represents extra props type of
* styled component.
* `StyleProps` is type parameter that represents props used in
* a style of that component.
*/

import * as React from 'react'
import { ComponentSelector, Interpolation } from '@emotion/serialize'
import { PropsOf, DistributiveOmit, Theme } from '@emotion/core'
Expand Down Expand Up @@ -59,12 +48,10 @@ export interface StyledComponent<
/**
* @typeparam ComponentProps Props which will be included when withComponent is called
* @typeparam SpecificComponentProps Props which will *not* be included when withComponent is called
* @typeparam StyleProps Params passed to styles but not exposed as React props. These are normally library provided props
*/
export interface CreateStyledComponent<
ComponentProps extends {},
SpecificComponentProps extends {} = {},
StyleProps extends {} = {}
SpecificComponentProps extends {} = {}
> {
/**
* @typeparam AdditionalProps Additional props to add to your styled component
Expand All @@ -74,17 +61,14 @@ export interface CreateStyledComponent<
Interpolation<
ComponentProps &
SpecificComponentProps &
StyleProps &
AdditionalProps & { theme: Theme }
>
>
): StyledComponent<ComponentProps & AdditionalProps, SpecificComponentProps>

(
template: TemplateStringsArray,
...styles: Array<
Interpolation<ComponentProps & SpecificComponentProps & StyleProps>
>
...styles: Array<Interpolation<ComponentProps & SpecificComponentProps>>
): StyledComponent<ComponentProps, SpecificComponentProps>

/**
Expand All @@ -96,7 +80,6 @@ export interface CreateStyledComponent<
Interpolation<
ComponentProps &
SpecificComponentProps &
StyleProps &
AdditionalProps & { theme: Theme }
>
>
Expand Down
8 changes: 4 additions & 4 deletions packages/styled/types/tests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import styled from '@emotion/styled'

// This file uses the same Theme declaration from tests-base.tsx

// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {}>
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>>
styled.a
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>, {}>
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<HTMLAttributes<HTMLBodyElement>, HTMLBodyElement>>
styled.body
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>>
styled.div
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, SVGProps<SVGSVGElement>, {}>
// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, SVGProps<SVGSVGElement>>
styled.svg

{
Expand Down

0 comments on commit 2fa7a21

Please sign in to comment.