import * as React from 'react'; /** * Get the component. */ export function getElement( Component?: | React.ComponentType | React.ReactElement | null | undefined, ComponentProps?: Props ) { if (Component === undefined || Component === null) { return null; } const isValid = React.isValidElement(Component); if (isValid) { return Component as React.ReactElement; } else if (typeof Component === 'function' || typeof Component === 'object') { const C = Component as React.ComponentType; if (ComponentProps === undefined || ComponentProps === null) { return () as React.ReactElement; } return () as React.ReactElement; } return null; }