From 14451715a0688d6fc6b1867821d1b035ee4e59ff Mon Sep 17 00:00:00 2001 From: Jonathan Neal Date: Mon, 19 Jul 2021 16:00:28 -0400 Subject: [PATCH] update typing / fix regression with polymorphism --- packages/core/types/styled-component.d.ts | 6 +++++- packages/react/types/styled-component.d.ts | 15 ++++++++++----- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/core/types/styled-component.d.ts b/packages/core/types/styled-component.d.ts index 53a9f722..aafeadbe 100644 --- a/packages/core/types/styled-component.d.ts +++ b/packages/core/types/styled-component.d.ts @@ -22,7 +22,11 @@ export interface CssComponent< & { [name in number | string]: any } - ): React.ReactElement | null + ): { + className: string + selector: string + props: object + } [$$StyledComponentType]: TagName [$$StyledComponentProps]: Props diff --git a/packages/react/types/styled-component.d.ts b/packages/react/types/styled-component.d.ts index 5374673b..fb202aa1 100644 --- a/packages/react/types/styled-component.d.ts +++ b/packages/react/types/styled-component.d.ts @@ -16,12 +16,10 @@ export interface StyledComponent< > extends ForwardRefExoticComponent { ( props: - As extends '' - ? { as: keyof JSX.IntrinsicElements, css?: CSS } + As extends keyof JSX.IntrinsicElements + ? Util.Assign & { as?: As, css?: CSS }> : As extends React.ComponentType ? Util.Assign & { as?: As, css?: CSS }> - : As extends keyof JSX.IntrinsicElements - ? Util.Assign : never ): React.ReactElement | null @@ -49,7 +47,14 @@ export interface CssComponent< & { [name in number | string]: any } - ): React.ReactElement | null + ): { + className: string + selector: string + props: object + } + + className: string + selector: string [$$StyledComponentType]: TagName [$$StyledComponentProps]: Props