bito-code-review[bot] commented on code in PR #36760:
URL: https://github.com/apache/superset/pull/36760#discussion_r2636612069
##########
superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.tsx:
##########
@@ -331,16 +391,16 @@ class AdhocFilterControl extends Component {
return null;
}
- addNewFilterPopoverTrigger(trigger) {
+ addNewFilterPopoverTrigger(trigger: ReactNode): JSX.Element {
return (
<AdhocFilterPopoverTrigger
- operators={this.props.operators}
+ operators={this.props.operators as Operators[] | undefined}
sections={this.props.sections}
adhocFilter={new AdhocFilter({})}
- datasource={this.props.datasource}
+ datasource={this.props.datasource as Record<string, unknown> || {}}
options={this.state.options}
- onFilterEdit={this.onNewFilter}
- partitionColumn={this.state.partitionColumn}
+ onFilterEdit={this.onNewFilter as unknown as (editedFilter:
AdhocFilter) => void}
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Unsafe Type Assertion Bypass</b></div>
<div id="fix">
The double type assertion 'as unknown as (editedFilter: AdhocFilter) =>
void' bypasses TypeScript's type safety, violating standards that require
proper TypeScript types. This can mask type errors and lead to runtime issues.
Update onNewFilter to handle both FilterOption and AdhocFilter types for safe
assignment.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/c470121/.cursor/rules/dev-standard.mdc#L16">dev-standard.mdc:16</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/c470121/AGENTS.md#L57">AGENTS.md:57</a>
</li>
</ul>
</details>
<small><i>Code Review Run #732e18</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]