import { ReactNode } from 'react'; import { AnyFunction } from '../types'; export declare const isEmptyChildren: (children: ReactNode) => boolean; /** * Checks if children is a function only ( useful for children as a function pattern ) * Similarly to Children.only it will throw an error if it's not a function * * @example * * ```ts * type Props = { * userId: string * children: (props:{data: UserModel}) => ReactElement * } * * type State = { data: UserModel | null } * * class UserRenderer extends Component { * render(){ * const {data} = this.state * // Will throw on runtime if children is not a function * // $ExpectType (props: {data: UserModel}) => ReactElement * const childrenFn = ChildrenAsFunction(children) * * return data ? children(data) : 'Loading...' * } * * componentDidMount(){ * fetch(`api/users/${this.props.userId}`).json().then(data=>this.setState({data})) * } * } * * const App = () => * { ({data}) =>
name: {data.name}}
} *
* ``` */ export declare const ChildrenAsFunction: (children: T) => T; //# sourceMappingURL=children.d.ts.map