Skip to content

chore(superset-core): forward-compat fixes for TypeScript 6.0 - Phase C#39537

Open
rusackas wants to merge 1 commit intomasterfrom
ts6-migration/phase-c-superset-core
Open

chore(superset-core): forward-compat fixes for TypeScript 6.0 - Phase C#39537
rusackas wants to merge 1 commit intomasterfrom
ts6-migration/phase-c-superset-core

Conversation

@rusackas
Copy link
Copy Markdown
Member

@rusackas rusackas commented Apr 22, 2026

Part of #39539 (TypeScript 5.4 → 6.0 migration tracking issue).

SUMMARY

Part of the TypeScript 5.4.5 → 6.0 migration, split per-package so reviews stay small. Scoped to packages/superset-core only. Follows #39535 (Phase B: packages/superset-ui-core).

Compiles cleanly on TypeScript 5.4.5 (current CI) and eliminates all TS 6.0 source errors in this package — specifically 7× TS2882 (unresolvable side-effect CSS imports) and 2× TS2564 (strict property initialization).

Fixes:

  • src/theme/Theme.tsx: add definite-assignment assertions (!) on the theme and antdConfig fields. Both are assigned via setConfig() in the constructor, but TS 6.0's strictPropertyInitialization can't trace that call chain. ! is cheaper than hoisting the setConfig logic inline, and the constructor is the only caller, so runtime safety is unchanged.
  • types/external.d.ts: add declare module '@fontsource/*' for the CSS side-effect imports in theme/GlobalStyles.tsx. These are bundler-only artifacts and carry no runtime type information; the declaration silences TS2882 under TS 6.0's stricter module-resolution rules.

Intentionally out of scope: the TS5101 deprecation warning that TS 6.0 emits against compilerOptions.baseUrl (inherited from the root superset-frontend/tsconfig.json). That fix belongs in a separate root-config cleanup PR because (a) it affects every package identically and should be solved once, and (b) silencing it locally requires "ignoreDeprecations": "6.0", which TS 5.4.5 rejects with Invalid value for --ignoreDeprecations — only "5.0" is accepted there. A forward-compat fix therefore needs either a root-level migration off baseUrl or a coordinated tsconfig update, neither of which belongs in this package-scoped PR.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — type-level changes only.

TESTING INSTRUCTIONS

  • cd superset-frontend && npm run type — passes on TS 5.4.5 (current CI).
  • Forward-compat check: install TypeScript 6.0.3 locally (npm install typescript@6.0.3 --no-save) then run npx tsc --project packages/superset-core/tsconfig.json --noEmit. Before this PR that reports 9 source errors (7× TS2882, 2× TS2564) plus 1 TS5101 config warning; after this PR it reports only the 1 TS5101 (out-of-scope; see above).
  • Smoke-test: load any page that pulls in the Superset theme (dashboard/chart/login). Verify fonts load and theme tokens apply — the @fontsource/* imports and Theme class still behave identically at runtime.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Generated with Claude Code

Scoped to packages/superset-core. Compiles cleanly on TypeScript 5.4.5
(current CI) and eliminates the TS 6.0 source errors in this package
(7x TS2882 + 2x TS2564).

- Theme.tsx: add definite-assignment assertions (`!`) on `theme` and
  `antdConfig`. Both fields are assigned via `setConfig()` in the
  constructor, but TS 6.0's strictPropertyInitialization can't trace
  that call chain. Definite-assignment is cheaper than hoisting the
  setConfig logic inline, and the constructor is the only caller, so
  runtime safety is unchanged.
- types/external.d.ts: add `declare module '@fontsource/*'` for the CSS
  side-effect imports in theme/GlobalStyles.tsx. These are bundler-only
  artifacts and carry no runtime type information; the declaration
  silences TS2882 under TS 6.0's stricter module-resolution rules.

Out of scope: the TS5101 baseUrl deprecation warning that TS 6.0 emits
against `compilerOptions.baseUrl` inherited from superset-frontend's
root tsconfig. That fix belongs in a separate root-config cleanup PR
because it affects every package identically; silencing it per-package
requires `"ignoreDeprecations": "6.0"`, which TS 5.4 rejects
(`Invalid value for --ignoreDeprecations` — only "5.0" is accepted).

Part of the TypeScript 5.4 -> 6.0 migration, split per-package so
reviews stay small. No runtime behaviour changes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 22, 2026

Code Review Agent Run #e6dc9b

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: 1829b4f..1829b4f
    • superset-frontend/packages/superset-core/src/theme/Theme.tsx
    • superset-frontend/packages/superset-core/types/external.d.ts
  • Files skipped - 0
  • Tools
    • Eslint (Linter) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas changed the title chore(superset-core): forward-compat fixes for TypeScript 6.0 chore(superset-core): forward-compat fixes for TypeScript 6.0 - Phase C Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.57%. Comparing base (e1ed500) to head (1829b4f).
⚠️ Report is 19 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39537   +/-   ##
=======================================
  Coverage   64.57%   64.57%           
=======================================
  Files        2561     2561           
  Lines      133470   133470           
  Branches    31015    31015           
=======================================
  Hits        86182    86182           
  Misses      45796    45796           
  Partials     1492     1492           
Flag Coverage Δ
javascript 66.52% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant