chore(superset-core): forward-compat fixes for TypeScript 6.0 - Phase C#39537
chore(superset-core): forward-compat fixes for TypeScript 6.0 - Phase C#39537
Conversation
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>
Code Review Agent Run #e6dc9bActionable Suggestions - 0Review 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
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:
|
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-coreonly. 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 thethemeandantdConfigfields. Both are assigned viasetConfig()in the constructor, but TS 6.0'sstrictPropertyInitializationcan't trace that call chain.!is cheaper than hoisting thesetConfiglogic inline, and the constructor is the only caller, so runtime safety is unchanged.types/external.d.ts: adddeclare module '@fontsource/*'for the CSS side-effect imports intheme/GlobalStyles.tsx. These are bundler-only artifacts and carry no runtime type information; the declaration silencesTS2882under TS 6.0's stricter module-resolution rules.Intentionally out of scope: the
TS5101deprecation warning that TS 6.0 emits againstcompilerOptions.baseUrl(inherited from the rootsuperset-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 withInvalid value for --ignoreDeprecations— only"5.0"is accepted there. A forward-compat fix therefore needs either a root-level migration offbaseUrlor 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).npm install typescript@6.0.3 --no-save) then runnpx 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).@fontsource/*imports andThemeclass still behave identically at runtime.ADDITIONAL INFORMATION
🤖 Generated with Claude Code