Skip to content

Commit

Permalink
fix: cast element props type instead of passing `ReactElement<CommonP…
Browse files Browse the repository at this point in the history
…rops>` to `React.Children.map`
  • Loading branch information
tkajtoch committed Nov 3, 2023
1 parent 16867a6 commit 1f6983c
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/table/table_row_cell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,13 @@ export const EuiTableRowCell: FunctionComponent<Props> = ({
if (textOnly === true) {
modifiedChildren = <span className={childClasses}>{children}</span>;
} else if (React.isValidElement(children)) {
modifiedChildren = React.Children.map(
children,
(child: ReactElement<CommonProps>) =>
React.cloneElement(child, {
className: classNames(child.props.className, childClasses),
})
modifiedChildren = React.Children.map(children, (child: ReactElement) =>
React.cloneElement(child, {
className: classNames(
(child.props as CommonProps).className,
childClasses
),
})
);
}
if (isObject(truncateText) && truncateText.lines) {
Expand Down

0 comments on commit 1f6983c

Please sign in to comment.