diff --git a/types/styled-components/index.d.ts b/types/styled-components/index.d.ts index b1d07db6f0..fa5ade6ffe 100644 --- a/types/styled-components/index.d.ts +++ b/types/styled-components/index.d.ts @@ -7,6 +7,7 @@ // Jason Killian // Sebastian Silbermann // David Ruisinger +// Matthew Wagerfield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -21,17 +22,14 @@ declare global { import * as CSS from "csstype"; import * as React from "react"; -export type CSSObject = CSS.Properties & - // Index type to allow selector nesting - // This is "[key in string]" and not "[key: string]" to allow CSSObject to be self-referential - { - // we need the CSS.Properties in here too to ensure the index signature doesn't create impossible values - [key in string]: - | CSS.Properties[keyof CSS.Properties< - string | number - >] - | CSSObject - }; +export type CSSProperties = CSS.Properties; + +export type CSSPseudos = { [K in CSS.Pseudos]?: CSSObject }; + +export interface CSSObject extends CSSProperties, CSSPseudos { + [key: string]: CSSObject | string | number | undefined; +} + export type CSSKeyframes = object & { [key: string]: CSSObject }; export interface ThemeProps {