rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2760135697


##########
superset-frontend/src/filters/components/TimeColumn/TimeColumnFilterPlugin.tsx:
##########
@@ -111,7 +111,7 @@ export default function PluginFilterTimeColumn(
           allowClear
           value={value}
           placeholder={placeholderText}
-          // @ts-ignore
+          // @ts-expect-error

Review Comment:
   This is pre-existing code that was migrated as-is. The Select component's 
mode and value handling matches the original JavaScript implementation. Type 
improvements should be addressed in a follow-up PR.



##########
superset-frontend/plugins/plugin-chart-echarts/src/BigNumber/BigNumberViz.tsx:
##########
@@ -192,7 +192,7 @@ function BigNumberVis({
 
   const renderHeader = (maxHeight: number) => {
     const { bigNumber, width, colorThresholdFormatters, onContextMenu } = 
props;
-    // @ts-ignore
+    // @ts-expect-error
     const text = bigNumber === null ? t('No data') : 
headerFormatter(bigNumber);

Review Comment:
   The @ts-expect-error is necessary because the BigNumber component needs to 
handle various data types at runtime. The headerFormatter handles the type 
coercion internally. Removing this would require a larger refactor of the 
BigNumber type system.



##########
superset-frontend/plugins/legacy-plugin-chart-calendar/src/Calendar.ts:
##########
@@ -95,11 +97,20 @@ function Calendar(element, props) {
       calContainer.text(`${METRIC_TEXT}: ${verboseMap[metric] || metric}`);
     }
     const timestamps = metricsData[metric];
-    const extents = d3Extent(Object.keys(timestamps), key => timestamps[key]);
-    const step = (extents[1] - extents[0]) / (steps - 1);
-    const colorScale = getSequentialSchemeRegistry()
-      .get(linearColorScheme)
-      .createLinearScale(extents);
+    const rawExtents = d3Extent(
+      Object.keys(timestamps),
+      key => timestamps[key],
+    );
+    // Guard against undefined extents (empty data)
+    const extents: [number, number] =
+      rawExtents[0] != null && rawExtents[1] != null
+        ? [rawExtents[0], rawExtents[1]]
+        : [0, 1];
+    const step = (extents[1] - extents[0]) / (steps - 1) || 0;
+    const colorScheme = getSequentialSchemeRegistry().get(linearColorScheme);
+    const colorScale = colorScheme
+      ? colorScheme.createLinearScale(extents)
+      : (v: number) => '#ccc'; // fallback if scheme not found
 
     const legend = d3Range(steps).map(i => extents[0] + step * i);

Review Comment:
   This is a direct TypeScript migration of existing legacy plugin code. The 
suggestion identifies a pre-existing edge case that should be addressed in a 
separate bug fix PR, not in a migration PR.



-- 
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]

Reply via email to