import * as React from 'react'; /** * Gets first child by specified type * * @since v1.0.0 (modified v2.0.0) * @template T * @template TC * @param {T} children - JSX children * @param {TC | TC[]} types - Types of children to match * @param {GetChildByTypeConfig} [config={ customTypeKey: '__TYPE', prioritized: false }] - The configuration params * @returns {T} - The first matching child * @example * // Finds the first occurrence of either a ToDo (custom component w/defined type as prop), a div, or a React Fragment * getChildByType(children, ['ToDo', 'div', 'react.fragment']); * * // Finds the first occurrence of either a MyComponent (custom component - full component passed in), a div, or a React Fragment * import MyComponent from './MyComponent'; * getChildByType(children, [MyComponent, 'div', 'react.fragment']); * * // Finds the first occurrence of either a ToDo, a div, or a React Fragment with a preference for that order. If ToDo exists, it will return that first. If not, then div, etc. * getChildByType(children, ['ToDo', 'div', 'react.fragment'], { prioritized: true }); */ export declare const getChildByType: (children: T, types: TC | TC[], { customTypeKey, prioritized }?: GetChildByTypeConfig) => T; /** * Gets first child by specified type (deep search) * * @since v1.0.0 (modified v2.0.0) * @template T * @template TC * @param {T} children - JSX children * @param {TC | TC[]} types - Types of children to match * @param {GetChildByTypeConfig} [{ customTypeKey: '__TYPE', prioritized: false }] - The configuration params * @returns {T} - The first matching child * @example * // Finds the first occurrence of either a ToDo (custom component w/defined type as prop), a div, or a React Fragment * getChildByTypeDeep(children, ['ToDo', 'div', 'react.fragment']); * * // Finds the first occurrence of either a MyComponent (custom component - full component passed in), a div, or a React Fragment * import MyComponent from './MyComponent'; * getChildByTypeDeep(children, [MyComponent, 'div', 'react.fragment']); * * // Finds the first occurrence of either a ToDo, a div, or a React Fragment with a preference for that order. If ToDo exists, it will return that first. If not, then div, etc. * getChildByTypeDeep(children, ['ToDo', 'div', 'react.fragment'], { prioritized: true }); */ export declare const getChildByTypeDeep: (children: T, types: TC | TC[], { customTypeKey, prioritized }?: GetChildByTypeConfig) => T; export declare type GetChildByTypeConfig = { customTypeKey?: string; prioritized?: boolean; };