diff --git a/src/components/flex/flex_group.tsx b/src/components/flex/flex_group.tsx index 575918ab5ff..c7bb866486b 100644 --- a/src/components/flex/flex_group.tsx +++ b/src/components/flex/flex_group.tsx @@ -12,7 +12,6 @@ import React, { ElementType, ForwardedRef, forwardRef, - FunctionComponent, PropsWithChildren, Ref, } from 'react'; @@ -121,14 +120,13 @@ const EuiFlexGroupInternal = ( // Cast forwardRef return type to work with the generic TComponent type // and not fallback to implicit any typing -export const EuiFlexGroup = forwardRef(EuiFlexGroupInternal) as < - TComponent extends ComponentPropType, +export const EuiFlexGroup = forwardRef(EuiFlexGroupInternal) as (< + TComponent extends ComponentPropType = 'div', TComponentRef = ReturnType >( props: EuiFlexGroupProps & { ref?: Ref; } -) => ReturnType; +) => ReturnType) & { displayName?: string }; -// Cast is required here because of the cast above -(EuiFlexGroup as FunctionComponent).displayName = 'EuiFlexGroup'; +EuiFlexGroup.displayName = 'EuiFlexGroup'; diff --git a/src/components/flex/flex_item.tsx b/src/components/flex/flex_item.tsx index b4687054cf9..2b29aeacf48 100644 --- a/src/components/flex/flex_item.tsx +++ b/src/components/flex/flex_item.tsx @@ -14,7 +14,6 @@ import React, { ComponentType, ForwardedRef, forwardRef, - FunctionComponent, Ref, } from 'react'; import classNames from 'classnames'; @@ -110,14 +109,13 @@ const EuiFlexItemInternal = ( // Cast forwardRef return type to work with the generic TComponent type // and not fallback to implicit any typing -export const EuiFlexItem = forwardRef(EuiFlexItemInternal) as < +export const EuiFlexItem = forwardRef(EuiFlexItemInternal) as (< TComponent extends ComponentPropType, TComponentRef = ReturnType >( props: EuiFlexItemProps & { ref?: Ref; } -) => ReturnType; +) => ReturnType) & { displayName?: string }; -// Cast is required here because of the cast above -(EuiFlexItem as FunctionComponent).displayName = 'EuiFlexItem'; +EuiFlexItem.displayName = 'EuiFlexItem';