import * as React from 'react' import { StatelessComponent, Component as ReactComponent, ComponentClass, PureComponent, ReactElement, RefObject, } from 'react' export interface ThemeProps { theme: T } export type ThemedStyledProps = P & ThemeProps export type StyledProps

= ThemedStyledProps export type ThemedOuterStyledProps = P & { theme?: T innerRef?: | ((instance: any) => void) | RefObject } export type OuterStyledProps

= ThemedOuterStyledProps export type FalseyValue = undefined | null | false export type Interpolation

= | FlattenInterpolation

| ReadonlyArray< FlattenInterpolation

| ReadonlyArray> > export type FlattenInterpolation

= | InterpolationValue | InterpolationFunction

export type InterpolationValue = | string | number | Styles | FalseyValue | StyledComponentClass export type SimpleInterpolation = | InterpolationValue | ReadonlyArray> export interface Styles { [ruleOrSelector: string]: string | number | Styles } export interface InterpolationFunction

{ (props: P): Interpolation

} type Attrs, T> = { [K in keyof A]: ((props: ThemedStyledProps) => A[K]) | A[K] } export interface StyledComponentClass extends ComponentClass> { extend: ThemedStyledFunction withComponent( tag: K ): StyledComponentClass< JSX.IntrinsicElements[K], T, JSX.IntrinsicElements[K] & O > withComponent( element: React.ComponentType ): StyledComponentClass } export interface ThemedStyledFunction { ( strings: TemplateStringsArray, ...interpolations: Interpolation>[] ): StyledComponentClass ( strings: TemplateStringsArray, ...interpolations: Interpolation>[] ): StyledComponentClass

attrs = {}>( attrs: Attrs

): ThemedStyledFunction, T, DiffBetween> } export type StyledFunction

= ThemedStyledFunction type ThemedStyledComponentFactories = { [TTag in keyof JSX.IntrinsicElements]: ThemedStyledFunction< JSX.IntrinsicElements[TTag], T > } export interface ThemedBaseStyledInterface extends ThemedStyledComponentFactories { ( tag: TTag ): ThemedStyledFunction (component: StyledComponentClass): ThemedStyledFunction< P, T, O >

( component: React.ComponentType

): ThemedStyledFunction> } export type BaseStyledInterface = ThemedBaseStyledInterface export type ThemedStyledInterface = ThemedBaseStyledInterface export type StyledInterface = ThemedStyledInterface export interface ThemeProviderProps { theme?: T | ((theme: T) => T) } export type ThemeProviderComponent = ComponentClass> export interface ThemedCssFunction { ( strings: TemplateStringsArray, ...interpolations: SimpleInterpolation[] ): InterpolationValue[]

( strings: TemplateStringsArray, ...interpolations: Interpolation>[] ): FlattenInterpolation>[] } // Helper type operators type KeyofBase = keyof any type Diff = ({ [P in T]: P } & { [P in U]: never })[T] type Omit = Pick> type DiffBetween = Pick> & Pick> type WithOptionalTheme

= Omit & { theme?: T } export interface ThemedStyledComponentsModule { default: ThemedStyledInterface css: ThemedCssFunction keyframes( strings: TemplateStringsArray, ...interpolations: SimpleInterpolation[] ): string injectGlobal( strings: TemplateStringsArray, ...interpolations: SimpleInterpolation[] ): void withTheme

( component: React.ComponentType

): ComponentClass> ThemeProvider: ThemeProviderComponent } declare const styled: StyledInterface export const css: ThemedCssFunction export function withTheme

( component: React.ComponentType

): ComponentClass> export function keyframes( strings: TemplateStringsArray, ...interpolations: SimpleInterpolation[] ): string export function injectGlobal( strings: TemplateStringsArray, ...interpolations: SimpleInterpolation[] ): void export function consolidateStreamedStyles(): void export function isStyledComponent(target: any): target is StyledComponentClass<{}, {}> export const ThemeProvider: ThemeProviderComponent interface StylesheetComponentProps { sheet: ServerStyleSheet } interface StyleSheetManagerProps { sheet?: StyleSheet target?: Node } export class StyleSheetManager extends React.Component< StyleSheetManagerProps, {} > {} export class ServerStyleSheet { collectStyles(tree: React.ReactNode): ReactElement getStyleTags(): string getStyleElement(): ReactElement<{}>[] interleaveWithNodeStream( readableStream: NodeJS.ReadableStream ): NodeJS.ReadableStream instance: StyleSheet } export default styled