@vnmfify/core
Version:
```shell npm i @vnmfify/core -S ```
10 lines (9 loc) • 582 B
TypeScript
import { ReactNode } from "react";
declare function forEachChildren<C>(children: C | C[], fn: (child: C, index: number) => void): void;
declare function mapChildren<T, C>(children: C | C[], fn: (child: C, index: number) => T): C extends null | undefined ? C : Array<Exclude<T, boolean | null | undefined>>;
declare const Children: {
toArray: (children: ReactNode | ReactNode[]) => (import("react").ReactChild | import("react").ReactFragment | import("react").ReactPortal)[];
forEach: typeof forEachChildren;
map: typeof mapChildren;
};
export default Children;