From c52cd0af5fefeafa35916fa28ea0bde7fe2dd644 Mon Sep 17 00:00:00 2001 From: Enzo Martellucci Date: Fri, 28 Aug 2026 17:51:04 +0200 Subject: [PATCH] fix(frontend): remove root's implicit reliance on d3-format's hoisted types setupFormatters.ts and bootstrapTypes.ts still imported FormatLocaleDefinition directly from d3-format, so root type-checking depended on @types/d3-format being hoisted from @superset-ui/core's devDependencies rather than an explicit root dependency. Re-export the type from core (alongside the existing formatSpecifier re-export) and import it from there instead, removing the last direct root usages of d3-format. Co-Authored-By: Claude Sonnet 5 --- .../packages/superset-ui-core/src/number-format/index.ts | 1 + superset-frontend/src/setup/setupFormatters.ts | 2 +- superset-frontend/src/types/bootstrapTypes.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/superset-frontend/packages/superset-ui-core/src/number-format/index.ts b/superset-frontend/packages/superset-ui-core/src/number-format/index.ts index 1baf25248ac..87b6633feb0 100644 --- a/superset-frontend/packages/superset-ui-core/src/number-format/index.ts +++ b/superset-frontend/packages/superset-ui-core/src/number-format/index.ts @@ -20,6 +20,7 @@ export { default as NumberFormats } from './NumberFormats'; export { default as NumberFormatter, PREVIEW_VALUE } from './NumberFormatter'; export { formatSpecifier } from 'd3-format'; +export type { FormatLocaleDefinition } from 'd3-format'; export { DEFAULT_D3_FORMAT } from './D3FormatConfig'; export { diff --git a/superset-frontend/src/setup/setupFormatters.ts b/superset-frontend/src/setup/setupFormatters.ts index a96074f71a8..d041913a3bb 100644 --- a/superset-frontend/src/setup/setupFormatters.ts +++ b/superset-frontend/src/setup/setupFormatters.ts @@ -32,8 +32,8 @@ import { setCurrencyLocale, createLengthFormatter, createThroughputFormatter, + FormatLocaleDefinition, } from '@superset-ui/core'; -import { FormatLocaleDefinition } from 'd3-format'; import { TimeLocaleDefinition } from 'd3-time-format'; export default function setupFormatters( diff --git a/superset-frontend/src/types/bootstrapTypes.ts b/superset-frontend/src/types/bootstrapTypes.ts index 9a10e88d684..9c341034f38 100644 --- a/superset-frontend/src/types/bootstrapTypes.ts +++ b/superset-frontend/src/types/bootstrapTypes.ts @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -import { FormatLocaleDefinition } from 'd3-format'; import { TimeLocaleDefinition } from 'd3-time-format'; import { isPlainObject } from 'lodash-es'; import { Languages } from 'src/features/home/LanguagePicker'; @@ -28,6 +27,7 @@ import { import type { ColorSchemeConfig, FeatureFlagMap, + FormatLocaleDefinition, JsonObject, SequentialSchemeConfig, } from '@superset-ui/core';