chore(frontend): TypeScript 6.0 readiness — declaration emit fixes (Phase A)#39530
chore(frontend): TypeScript 6.0 readiness — declaration emit fixes (Phase A)#39530
Conversation
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>
There was a problem hiding this comment.
Code Review Agent Run #2d4273
Actionable Suggestions - 1
-
superset-frontend/src/dashboard/reducers/dashboardInfo.ts - 1
- Interface Duplication · Line 60-60
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
| } | ||
|
|
||
| interface HydrateDashboardAction { | ||
| export interface HydrateDashboardAction { |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…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>
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Code Review Agent Run #22e1f9Actionable Suggestions - 0Additional Suggestions - 1
Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
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: trueblocking 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 Componentcasts tostyled()wrappers whose inferred return types reference third-party types (fromreact-ace,react-js-cron) through nestednode_modulespaths that TS 6.0's declaration emitter can't name.src/features/databases/DatabaseModal/styles.ts—StyledJsonEditorsrc/features/reports/ReportModal/styles.tsx—StyledCronPickerTS2882 (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.tsTS2564 (class property initialization) — Added definite-assignment assertions to class fields set via non-obvious init paths.
packages/superset-core/src/theme/Theme.tsxTS4023 / TS4082 (unexported types referenced in declaration emit) — Added
exportto 15 interfaces/types that are referenced by exported symbols sotsccan emit proper.d.tsfiles. 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 --buildsucceeds with no regressions vs masterpre-commit run --files <changed files>passes (prettier, oxlint, eslint custom rules, type-checking-frontend)Verified locally on TS 5.4.5 — both
tsc --buildand the full pre-commit suite pass on all 20 modified files.ADDITIONAL INFORMATION
Migration roadmap (for reviewers):
.js→.tsconversions and any remaining type-export touch-ups (if needed)baseUrlremoval andignoreDeprecations: "6.0"intsconfig.json(supersedes chore(deps-dev): bump typescript from 5.4.5 to 6.0.3 in /superset-frontend #39512)🤖 Generated with Claude Code