import { ComponentClass, ComponentType, ReactChild } from 'react';
import { Diff } from '../types';
/**
* @private
*/
declare type FunctionComponent
= ((props: P) => React.ReactNode);
/**
* @private
*/
declare type NestedArray = T | T[];
/**
* A React children array can be a single value or an array nested to any level.
* It is designed to be used with the React.Children API.
*
* @example
*
* ```
*/
export declare type ChildrenArray = NestedArray | NestedArray[];
/**
* Gets Component/PureComponent state type
*
* @example
*
* ```tsx
* class MyComponent extends React.Component<{},{foo: number}> {
* state = {foo: 42};
* render() {
* return this.props.foo;
* }
* }
*
* // $ExpectType {foo: number}
* type State = ElementState
* ```
*/
export declare type ElementState = T extends ComponentClass ? S : never;
/**
* Gets the props for a React element type, without preserving the optionality of defaultProps.
* Type could be a React class component or a stateless functional component.
* This type is used for the props property on React.Element.
*
* Like React.Element, Type must be the type of a React component,
* so you need to use typeof as in React.ElementProps.
*
* **NOTE:**
* Because ElementProps does not preserve the optionality of defaultProps, ElementConfig (which does) is more often the right choice, especially for simple props pass-through as with higher-order components.
*
* @example
*
* ```tsx
* import React from 'react'
* class MyComponent extends React.Component<{foo: number}> {
* render() {
* return this.props.foo;
* }
* }
*
* ({foo: 42} as ElementProps)
* ```
*/
export declare type ElementProps = T extends ComponentType | FunctionComponent ? P : never;
/**
* Like ElementProps this utility gets the type of a component’s props but preserves the optionality of defaultProps!
*
* Like React.Element, Type must be the type of a React component so you need to use typeof as in React.ElementProps.
*
* @example
*
* ```tsx
* import React from 'react'
* class MyComponent extends React.Component<{foo: number}> {
* static defaultProps = {foo: 42};
* render() {
* return this.props.foo;
* }
* }
*
* // `ElementProps<>` requires `foo` even though it has a `defaultProp`.
* ({foo: 42} as ElementProps)
*
* // `ElementConfig<>` does not require `foo` since it has a `defaultProp`.
* ({} as ElementConfig)
* ```
*/
export declare type ElementConfig = T extends ({
defaultProps?: infer D;
} & ComponentType) | FunctionComponent ? Partial & Diff : T extends ComponentType | FunctionComponent ? Props : never;
export {};
//# sourceMappingURL=types.d.ts.map