// Type definitions for react-with-styles 4.0 // Project: https://github.com/airbnb/react-with-styles#readme // Definitions by: Mohsen Azimi // Brie Bunge // Joe Lencioni // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from 'react'; import * as PropTypes from 'prop-types'; import { CSSProperties } from 'aphrodite'; interface Theme { [key: string]: any; } interface WithStylesProps { /** * This function takes styles that were processed by `withStyles()`, plain objects, or arrays * of these things. It returns an object with an opaque structure that must be spread into a * JSX element. */ css(...styles: any[]): object; styles: { [key: string]: object }; theme: T; } declare const withStylesPropTypes: PropTypes.ValidationMap; type Nullable = T | null | undefined; interface Styles { [key: string]: Nullable< CSSProperties & { [pseudoSelectorOrMediaQuery: string]: CSSProperties[keyof CSSProperties] | CSSProperties; } >; } interface WithStylesOptions { flushBefore?: boolean; pureComponent?: boolean; } type Omit = Pick>; type ComponentClassProps = C extends new (props: infer P, context?: any) => any ? P : never; type SFCProps = C extends (props: infer P & { children?: React.ReactNode }, context?: any) => any ? P : never; type ElementProps = C extends React.ComponentClass ? ComponentClassProps : C extends React.SFC ? SFCProps : any; type ElementConfig = JSX.LibraryManagedAttributes>; declare function withStyles( styleFn?: ((theme: T) => Styles) | null, options?: WithStylesOptions, ): >( component: C, ) => React.ComponentClass, keyof WithStylesProps>>; declare function css(...styles: any[]): object; export { css, withStyles, WithStylesProps, withStylesPropTypes, WithStylesOptions, Theme, Styles, CSSProperties, };