import React from 'react'; import { UiElementData } from 'resolvableElements/elements/UiElement'; /** * An utility type that allows a component to accept props with or without a 'section' property. */ export type OptionalSection
= P | (Omit
& { section?: undefined; }); /** * Higher-Order Component that takes a section based component as an argument and returns a new component * that checks if the 'section' prop is defined before rendering the SectionComponent. * If the 'section' prop is undefined, it returns an empty element. * * @template P - Props of the original SectionComponent * @param {React.FC
} SectionComponent - The original component that will be wrapped * @returns {React.FC
& { section?: undefined })>} - The wrapped component * @example * const CheckedComponent = SectionChecker(({section, ...props}) => { * return
(SectionComponent: React.FC
) => (props: OptionalSection
) => JSX.Element;