From 2fa7a213222fc2bb99ca0a01078148f1a1c6458d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Sat, 14 Dec 2019 13:37:40 +0100 Subject: [PATCH] Remove no longer needed StyleProps type parameter (#1685) --- .changeset/modern-socks-remember.md | 5 +++++ packages/styled/types/base.d.ts | 21 ++------------------- packages/styled/types/tests.tsx | 8 ++++---- 3 files changed, 11 insertions(+), 23 deletions(-) create mode 100644 .changeset/modern-socks-remember.md diff --git a/.changeset/modern-socks-remember.md b/.changeset/modern-socks-remember.md new file mode 100644 index 000000000..dc71ddede --- /dev/null +++ b/.changeset/modern-socks-remember.md @@ -0,0 +1,5 @@ +--- +'@emotion/styled': patch +--- + +Remove `StyleProps` type parameter from `CreateStyledComponent` - it's no longer needed. diff --git a/packages/styled/types/base.d.ts b/packages/styled/types/base.d.ts index 64574bdd9..5c377ffe8 100644 --- a/packages/styled/types/base.d.ts +++ b/packages/styled/types/base.d.ts @@ -1,17 +1,6 @@ // Definitions by: Junyoung Clare Jang // 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' @@ -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 @@ -74,7 +61,6 @@ export interface CreateStyledComponent< Interpolation< ComponentProps & SpecificComponentProps & - StyleProps & AdditionalProps & { theme: Theme } > > @@ -82,9 +68,7 @@ export interface CreateStyledComponent< ( template: TemplateStringsArray, - ...styles: Array< - Interpolation - > + ...styles: Array> ): StyledComponent /** @@ -96,7 +80,6 @@ export interface CreateStyledComponent< Interpolation< ComponentProps & SpecificComponentProps & - StyleProps & AdditionalProps & { theme: Theme } > > diff --git a/packages/styled/types/tests.tsx b/packages/styled/types/tests.tsx index 398f61531..1a10a715f 100644 --- a/packages/styled/types/tests.tsx +++ b/packages/styled/types/tests.tsx @@ -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, HTMLAnchorElement>, {}> +// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps, HTMLAnchorElement>> styled.a -// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps, HTMLBodyElement>, {}> +// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps, HTMLBodyElement>> styled.body -// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps, HTMLDivElement>, {}> +// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, DetailedHTMLProps, HTMLDivElement>> styled.div -// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, SVGProps, {}> +// $ExpectType CreateStyledComponent<{ theme?: Theme | undefined; }, SVGProps> styled.svg {