Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 45x 14x 45x 14x 14x | import { JSXElementConstructor, ReactElement, ReactNode } from "react"; type ElementProps = { children?: ReactNode; } & Record<string, unknown>; const isElementProps = (props: unknown): props is ElementProps => { return typeof props === "object" && props !== null; }; export const getElementProps = ( child: ReactElement<unknown, string | JSXElementConstructor<any>> ): ElementProps => { Iif (!isElementProps(child.props)) { return { children: undefined }; } return child.props; }; |