import * as React from "react" export function mapChild(children, f: (child: T) => X) { const childNodes = React.Children.map(children, (c: any) => c) || []; const nonNull = childNodes.filter(c => !!c).map(c => c.props as T); return nonNull.map(f) as X[]; } export function getChildrenProps(children: React.ReactNode): T[] { return React.Children.map(children, child => (child as any).props as T) || []; }