import { Children, ReactElement } from 'react'; // If `text` is a Text / Link component, we need to override any text colors within to ensure they all match const isComponentNode = ({ text, components, }: { text: string | ReactElement; components: ReadonlyArray; }): boolean => typeof text !== 'string' && // @ts-expect-error - TS2339 components.includes(Children.only(text).type.displayName); export default isComponentNode;