bito-code-review[bot] commented on code in PR #44962:
URL: https://github.com/apache/superset/pull/44962#discussion_r4176615819
##########
superset-frontend/src/explore/components/controls/MapViewControl/ExtentTag.tsx:
##########
@@ -34,13 +34,20 @@ export const ExtentTag: FC<ExtentTagProps> = ({
return (
<Tag onClick={onClick} className={className}>
- {zoomName}: {value.fixedZoom ? Math.round(value.fixedZoom) : unsetName}
+ {zoomName}:{' '}
+ {typeof value.fixedZoom === 'number'
+ ? Math.round(value.fixedZoom)
+ : unsetName}
{' | '}
{latName}:{' '}
- {value.fixedLatitude ? value.fixedLatitude.toFixed(6) : unsetName}
+ {typeof value.fixedLatitude === 'number'
+ ? value.fixedLatitude.toFixed(6)
+ : unsetName}
{' | '}
{lonName}:{' '}
- {value.fixedLongitude ? value.fixedLongitude.toFixed(6) : unsetName}
+ {typeof value.fixedLongitude === 'number'
+ ? value.fixedLongitude.toFixed(6)
+ : unsetName}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Type contract mismatch</b></div>
<div id="fix">
The new `typeof value.fixedZoom === 'number'` guards (and the test casting
`undefined`) imply these fields can be `undefined`, but `MapViewConfigs` in
`types.ts` declares them as required `number`. The type contract is inaccurate,
so TypeScript won't flag a missing field and the `unsetName` branch is
unreachable per the type. Consider typing them `number | undefined`.
</div>
</div>
<small><i>Code Review Run #4516ea</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]