From 65cfebd889e9b75e84533e30af48269dc53da7fd Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Thu, 5 Feb 2026 17:17:31 -0800 Subject: [PATCH] fix: remove unused StringConstructor from return type Address review feedback from @michael-s-molina: Since the function no longer returns String, remove StringConstructor from the return type and update the misleading test description. Co-Authored-By: Claude Opus 4.5 --- .../plugins/plugin-chart-echarts/src/utils/formatters.ts | 2 +- .../plugin-chart-echarts/test/utils/formatters.test.ts | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts b/superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts index 2c53abf3839..579a621abb3 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/src/utils/formatters.ts @@ -88,7 +88,7 @@ export function getTooltipTimeFormatter( export function getXAxisFormatter( format?: string, -): TimeFormatter | StringConstructor | undefined { +): TimeFormatter | undefined { if (format === SMART_DATE_ID) { return getSmartDateFormatter(); } diff --git a/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts b/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts index fb47deafa0b..df3ac5ddd28 100644 --- a/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts +++ b/superset-frontend/plugins/plugin-chart-echarts/test/utils/formatters.test.ts @@ -74,9 +74,7 @@ describe('getXAxisFormatter', () => { expect(formatter).toEqual(expectedFormatter); }); - it('should return String constructor as fallback', () => { - // This test verifies that the String constructor is returned - // Note: the current logic may not reach this case, but keeping for completeness + it('should return undefined for falsy values', () => { const formatter = getXAxisFormatter(null as any); expect(formatter).toBeUndefined(); });