rusackas commented on code in PR #36760:
URL: https://github.com/apache/superset/pull/36760#discussion_r2642204861
##########
superset-frontend/src/explore/components/controls/MetricControl/AdhocMetricOption.tsx:
##########
@@ -18,12 +18,32 @@
*/
import { PureComponent } from 'react';
import PropTypes from 'prop-types';
+import { Metric } from '@superset-ui/core';
import { OptionControlLabel } from
'src/explore/components/controls/OptionControls';
import { DndItemType } from 'src/explore/components/DndItemType';
+import { Datasource } from 'src/explore/types';
+import { ISaveableDatasource } from 'src/SqlLab/components/SaveDatasetModal';
import columnType from './columnType';
import AdhocMetric from './AdhocMetric';
import savedMetricType from './savedMetricType';
import AdhocMetricPopoverTrigger from './AdhocMetricPopoverTrigger';
+import { savedMetricType as SavedMetricTypeDef } from './types';
+
+interface AdhocMetricOptionProps {
+ adhocMetric: AdhocMetric;
+ onMetricEdit: (newMetric: Metric, oldMetric: Metric) => void;
+ onRemoveMetric?: (index: number) => void;
+ columns?: { column_name: string; type: string }[];
+ savedMetricsOptions?: SavedMetricTypeDef[];
+ savedMetric?: SavedMetricTypeDef | Record<string, never>;
Review Comment:
The `Record<string, never>` type is intentional - it matches the existing
JavaScript behavior where `savedMetric` defaults to an empty object `{}`. Using
`never` accurately represents that when no saved metric is provided, the object
has no properties.
##########
superset-frontend/src/explore/components/controls/MetricControl/MetricsControl.tsx:
##########
@@ -57,13 +57,14 @@ const defaultProps = {
columns: [],
};
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
function getOptionsForSavedMetrics(
- savedMetrics,
- currentMetricValues,
- currentMetric,
+ savedMetrics: any,
+ currentMetricValues: any,
+ currentMetric: any,
) {
Review Comment:
These `any` types are **documented technical debt** with `eslint-disable`
comments. This is a JS→TS migration that converts ~40 JavaScript files - proper
typing for these complex Redux/form state interactions would require
significant refactoring beyond the migration scope. The `eslint-disable`
pattern follows codebase guidelines for documenting unavoidable debt.
--
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]