Compare commits

...

1 Commits

Author SHA1 Message Date
Joe Li
cba539b91d fix(TimeTable): resolve TypeScript OOM by simplifying sparkline series type
Fixes heap out of memory error during TypeScript compilation caused by complex
SeriesProps generic type forcing exponential type resolution.

Changed chartSeriesMap type annotation from explicit SeriesProps<AxisScale, AxisScale, object>
to type inference with precise union constraint. Uses 'as const satisfies' pattern to validate
structure without triggering expensive type resolution.

- Remove SeriesProps and AxisScale imports (no longer needed)
- Add SparklineSeriesComponent union type (typeof LineSeries | BarSeries | AreaSeries)
- Replace explicit type annotation with inferred type + satisfies constraint
- Preserves type safety while avoiding exponential type checking complexity
- Follows "NO any types" modernization guideline

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 21:06:11 -07:00

View File

@@ -28,8 +28,6 @@ import {
Tooltip,
XYChart,
buildChartTheme,
type SeriesProps,
AxisScale,
} from '@visx/xychart';
import { extendedDayjs } from '@superset-ui/core/utils/dates';
import {
@@ -134,14 +132,16 @@ const SparklineCell = ({
const xAccessor = (d: { x: number; y: number }) => d.x;
const yAccessor = (d: { x: number; y: number }) => d.y;
const chartSeriesMap: Record<
SparkType,
(props: SeriesProps<AxisScale, AxisScale, object>) => JSX.Element
> = {
type SparklineSeriesComponent =
| typeof LineSeries
| typeof BarSeries
| typeof AreaSeries;
const chartSeriesMap = {
line: LineSeries,
bar: BarSeries,
area: AreaSeries,
};
} as const satisfies Record<SparkType, SparklineSeriesComponent>;
const SeriesComponent = chartSeriesMap[sparkType] || LineSeries;