Skip to content

chore(frontend): TypeScript 6.0 readiness — declaration emit fixes (Phase A)#39530

Open
rusackas wants to merge 2 commits intomasterfrom
ts6-migration/phase-a-readiness
Open

chore(frontend): TypeScript 6.0 readiness — declaration emit fixes (Phase A)#39530
rusackas wants to merge 2 commits intomasterfrom
ts6-migration/phase-a-readiness

Conversation

@rusackas
Copy link
Copy Markdown
Member

SUMMARY

Phase A of the TypeScript 6.0 migration — a set of forward-compatible fixes that compile cleanly on TS 5.4 today and prepare the codebase for TS 6.0's stricter declaration-emit rules. Lands independently of the actual TS bump, shrinking the surface area of #39512.

Context: the initial TS 6.0 bump PR (#39512) surfaced a headline 9,474 compile errors, which was alarming enough to stall the migration. A Phase 0 diagnostic (see this comment on #39512) showed that 5,712 of those were cascading TS6305 artifacts from noEmitOnError: true blocking upstream emission — the real TS 6.0 migration is only ~36 files of mechanical fixes. This PR handles the subset that can land today without touching the TS version.

Changes by error class:

  • TS2883 (styled-component named references) — Added as typeof Component casts to styled() wrappers whose inferred return types reference third-party types (from react-ace, react-js-cron) through nested node_modules paths that TS 6.0's declaration emitter can't name.

    • src/features/databases/DatabaseModal/styles.tsStyledJsonEditor
    • src/features/reports/ReportModal/styles.tsxStyledCronPicker
  • TS2882 (CSS side-effect imports) — Added a module declaration for @fontsource/* packages whose CSS files are imported for side effects.

    • packages/superset-core/types/external.d.ts
  • TS2564 (class property initialization) — Added definite-assignment assertions to class fields set via non-obvious init paths.

    • packages/superset-core/src/theme/Theme.tsx
  • TS4023 / TS4082 (unexported types referenced in declaration emit) — Added export to 15 interfaces/types that are referenced by exported symbols so tsc can emit proper .d.ts files. No public-API change — these types were already reachable; they just weren't named.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — no user-visible changes.

TESTING INSTRUCTIONS

  • cd superset-frontend && npx tsc --build succeeds with no regressions vs master
  • pre-commit run --files <changed files> passes (prettier, oxlint, eslint custom rules, type-checking-frontend)
  • CI passes

Verified locally on TS 5.4.5 — both tsc --build and the full pre-commit suite pass on all 20 modified files.

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

Migration roadmap (for reviewers):

🤖 Generated with Claude Code

Phase A of the TS 6.0 migration (see #39512). These are forward-compatible
changes that both compile cleanly on TS 5.4 today and prepare the codebase
for TS 6.0's stricter declaration-emit rules.

Changes by category:

- TS2883 (styled-component named references): Added `as typeof Component`
  casts to styled() wrappers whose inferred return types reference
  third-party types through nested node_modules paths that TS 6.0's
  declaration emitter can't name.
  * src/features/databases/DatabaseModal/styles.ts (StyledJsonEditor)
  * src/features/reports/ReportModal/styles.tsx (StyledCronPicker)

- TS2882 (CSS side-effect imports): Added a module declaration for
  `@fontsource/*` packages whose CSS files are imported for side effects.
  * packages/superset-core/types/external.d.ts

- TS2564 (class property initialization): Added definite-assignment
  assertions to class fields set via non-obvious initialization paths.
  * packages/superset-core/src/theme/Theme.tsx

- TS4023/TS4082 (unexported type references in declaration emit): Added
  `export` to interfaces and types referenced by exported symbols so TS
  can emit proper .d.ts files. 15 files touched across dashboard/,
  explore/, SqlLab/, dataMask/.

Verified:
- `tsc --build` completes cleanly on TS 5.4.5 with no regressions
- Full pre-commit suite passes on all 20 modified files

Context: Phase 0 diagnostic analysis showed TS 6.0 really only requires
~36 files of mechanical fixes, despite headline error counts suggesting
thousands. See the Phase 0 comment on #39512 for the breakdown.

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

@bito-code-review bito-code-review Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Agent Run #2d4273

Actionable Suggestions - 1
  • superset-frontend/src/dashboard/reducers/dashboardInfo.ts - 1
Review Details
  • Files reviewed - 20 · Commit Range: f4ab36c..f4ab36c
    • superset-frontend/packages/superset-core/src/theme/Theme.tsx
    • superset-frontend/packages/superset-core/types/external.d.ts
    • superset-frontend/src/SqlLab/actions/sqlLab.ts
    • superset-frontend/src/dashboard/components/Dashboard.tsx
    • superset-frontend/src/dashboard/components/DashboardGrid.tsx
    • superset-frontend/src/dashboard/components/filterscope/FilterScopeSelector.tsx
    • superset-frontend/src/dashboard/components/gridComponents/ChartHolder/ChartHolder.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Column/Column.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Markdown/Markdown.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Tab/Tab.tsx
    • superset-frontend/src/dashboard/components/gridComponents/Tabs/Tabs.tsx
    • superset-frontend/src/dashboard/reducers/dashboardFilters.ts
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/dataMask/reducer.ts
    • superset-frontend/src/explore/components/controls/CollectionControl/index.tsx
    • superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx
    • superset-frontend/src/explore/components/controls/FilterControl/AdhocFilterControl/index.tsx
    • superset-frontend/src/explore/components/controls/MetricControl/MetricsControl.tsx
    • superset-frontend/src/features/databases/DatabaseModal/styles.ts
    • superset-frontend/src/features/reports/ReportModal/styles.tsx
  • 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

}

interface HydrateDashboardAction {
export interface HydrateDashboardAction {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface Duplication

The HydrateDashboardAction interface is defined with different data shapes in both dashboardInfo.ts and dataMask/reducer.ts. Exporting this one increases the risk of confusion and potential type errors. Consider renaming or consolidating these interfaces.

Code Review Run #2d4273


Should Bito avoid suggestions like this for future reviews? (Manage Rules)

  • Yes, avoid them

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in c2084e6. The two interfaces are genuinely different shapes (each reducer narrows the HYDRATE_DASHBOARD payload to the slice it consumes), so I renamed them rather than consolidating: HydrateDashboardInfoAction in dashboardInfo.ts and HydrateDataMaskAction in dataMask/reducer.ts. Neither was imported externally, so the rename stayed local to each module.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.54%. Comparing base (05fc5bb) to head (f4ab36c).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #39530   +/-   ##
=======================================
  Coverage   64.54%   64.54%           
=======================================
  Files        2559     2559           
  Lines      133496   133496           
  Branches    31028    31028           
=======================================
  Hits        86168    86168           
  Misses      45836    45836           
  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.

…ucer shapes

Both dashboard/reducers/dashboardInfo.ts and dataMask/reducer.ts had a
locally-declared interface named HydrateDashboardAction with different
data shapes. Phase A added `export` to both for declaration emit, which
made the duplicate-name risk surface in review.

Renaming to HydrateDashboardInfoAction and HydrateDataMaskAction makes
each interface's purpose explicit. Neither interface was imported
externally, so the change is local to each module.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 22, 2026

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit c2084e6
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/69e93978610e160008d53536
😎 Deploy Preview https://deploy-preview-39530--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@bito-code-review
Copy link
Copy Markdown
Contributor

bito-code-review Bot commented Apr 22, 2026

Code Review Agent Run #22e1f9

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset-frontend/src/dataMask/reducer.ts - 1
    • Naming Inconsistency · Line 216-216
      The variable name 'hydrateDashboardAction' no longer matches its type 'HydrateDataMaskAction' after the interface rename, creating naming inconsistency that could confuse maintainers.
Review Details
  • Files reviewed - 2 · Commit Range: f4ab36c..c2084e6
    • superset-frontend/src/dashboard/reducers/dashboardInfo.ts
    • superset-frontend/src/dataMask/reducer.ts
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • Eslint (Linter) - ✔︎ 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

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