1 | import * as React from 'react';
|
2 | /**
|
3 | * Iterates through children that are typically specified as `props.children`,
|
4 | * but only maps over children that are "valid elements".
|
5 | *
|
6 | * The mapFunction provided index will be normalised to the components mapped,
|
7 | * so an invalid component would not increase the index.
|
8 | *
|
9 | */
|
10 | declare function map<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => any): any;
|
11 | /**
|
12 | * Iterates through children that are "valid elements".
|
13 | *
|
14 | * The provided forEachFunc(child, index) will be called for each
|
15 | * leaf child with the index reflecting the position relative to "valid components".
|
16 | */
|
17 | declare function forEach<P = any>(children: any, func: (el: React.ReactElement<P>, index: number) => void): void;
|
18 | /**
|
19 | * Finds whether a component's `children` prop includes a React element of the
|
20 | * specified type.
|
21 | */
|
22 | declare function hasChildOfType<P = any>(children: React.ReactNode, type: string | React.JSXElementConstructor<P>): boolean;
|
23 | export { map, forEach, hasChildOfType };
|