tanmaylaud commented on a change in pull request #10426:
URL:
https://github.com/apache/incubator-superset/pull/10426#discussion_r460667805
##########
File path: superset-frontend/src/components/Menu/MenuObject.tsx
##########
@@ -51,22 +61,20 @@ export default function MenuObject({ label, icon, childs,
url, index }) {
eventKey={index}
title={navTitle}
>
- {childs.map((child, index1) =>
- child === '-' ? (
+ {childs?.map((child: MenuObjectChildProps | string, index1: number) =>
+ typeof child === 'string' && child === '-' ? (
<MenuItem key={`$${index1}`} divider />
) : (
<MenuItem
- key={`${child.label}`}
- href={child.url}
+ key={`${(child as MenuObjectChildProps).label}`}
+ href={(child as MenuObjectChildProps).url}
eventKey={parseFloat(`${index}.${index1}`)}
>
- <i className={`fa ${child.icon}`} />
- {child.label}
+ <i className={`fa ${(child as MenuObjectChildProps).icon}`} />
+ {(child as MenuObjectChildProps).label}
Review comment:
Done. removed the type casting and replaced it with type check
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]