tanmaylaud commented on a change in pull request #10426:
URL:
https://github.com/apache/incubator-superset/pull/10426#discussion_r460673744
##########
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:
The above condition gives linting errors:
65:9 error Expected an assignment or function call and instead saw an
expression no-unused-expressions
65:9 error Do not nest ternary expressions
no-nested-ternary
----------------------------------------------------------------
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]