Repository navigation
chore(superset-ui-core): forward-compat fixes for TypeScript 6.0 (Phase B) - #39535
Conversation
Code Review Agent Run #e1dd2cActionable 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 |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #39535 +/- ##
=======================================
Coverage 64.33% 64.33%
=======================================
Files 2651 2651
Lines 144766 144778 +12
Branches 33401 33409 +8
=======================================
+ Hits 93131 93141 +10
- Misses 49965 49967 +2
Partials 1670 1670
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9b5d89b to
a2fc6cf
Compare
There was a problem hiding this comment.
Code Review Agent Run #1665a5
Actionable Suggestions - 2
-
superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx - 1
- Incorrect ref type annotation · Line 102-102
-
superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx - 1
- Incomplete ref handling · Line 93-95
Review Details
-
Files reviewed - 15 · Commit Range:
a2fc6cf..a2fc6cf- superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
- superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/DropdownContainer.tsx
- superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
- superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/utils/InteractiveTableUtils.ts
- superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
- superset-frontend/packages/superset-ui-core/src/connection/types.ts
- superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts
- superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts
- superset-frontend/packages/superset-ui-core/types/assets.d.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 [email protected].
Documentation & Help
a2fc6cf to
c733d58
Compare
There was a problem hiding this comment.
Code Review Agent Run #e35dab
Actionable Suggestions - 1
-
superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx - 1
- Direct antd import violation · Line 29-29
Review Details
-
Files reviewed - 15 · Commit Range:
c733d58..c733d58- superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
- superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/DropdownContainer.tsx
- superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
- superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/utils/InteractiveTableUtils.ts
- superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
- superset-frontend/packages/superset-ui-core/src/connection/types.ts
- superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts
- superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts
- superset-frontend/packages/superset-ui-core/types/assets.d.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 [email protected].
Documentation & Help
Per @Bito's review on #39535: - TimezoneSelector: replace direct `antd/es/select` LabeledValue import with the re-export from `@superset-ui/core/components` (per CLAUDE.md rule against direct Ant Design imports). - ModalTrigger: handle callback refs in addition to object refs. The previous `if (ref && typeof ref !== 'function')` branch silently no-op'd whenever a parent passed a function ref, so they couldn't access close/open/showModal. Not applying the AsyncEsmComponent ref-type suggestion: the existing `@ts-expect-error` directive above the call site is the deliberate workaround for the PropsWithoutRef incompatibility, and changing the ref type would make that directive unused and warn.
c733d58 to
49dbed2
Compare
Code Review Agent Run #63b5adActionable Suggestions - 0Additional Suggestions - 1
Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
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 |
Per @Bito's review on #39535: - TimezoneSelector: replace direct `antd/es/select` LabeledValue import with the re-export from `@superset-ui/core/components` (per CLAUDE.md rule against direct Ant Design imports). - ModalTrigger: handle callback refs in addition to object refs. The previous `if (ref && typeof ref !== 'function')` branch silently no-op'd whenever a parent passed a function ref, so they couldn't access close/open/showModal. Not applying the AsyncEsmComponent ref-type suggestion: the existing `@ts-expect-error` directive above the call site is the deliberate workaround for the PropsWithoutRef incompatibility, and changing the ref type would make that directive unused and warn.
49dbed2 to
4388c65
Compare
There was a problem hiding this comment.
Code Review Agent Run #d7878b
Actionable Suggestions - 1
-
superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts - 1
- Dead code guard introduced · Line 60-63
Additional Suggestions - 3
-
superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx - 1
-
Unclear destructured placeholder name · Line 335-335The name `_ignoredComponent` is ambiguous — it does not convey that this destructuring is intentional to block a conflicting `component` prop from passing through. The underscore prefix alone does not communicate the purpose. Renaming to reflect its blocking role would improve maintainability.
Code suggestion
--- superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx (line 335) 335:- component: _ignoredComponent, 335:+ component: _componentFromProps,
-
-
superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts - 1
-
Variable name reuse in catch block · Line 109-109The catch block reuses the variable name `response` (line 109) after it was already used for the successful HTTP response (line 82). While the scopes don't overlap, using `caught` consistently maintains clearer semantics and avoids potential confusion during code review or debugging. The original code's bug (accessing `response.statusText` before `await getClientErrorObject`) is correctly fixed by the new logic ordering.
Code suggestion
--- a/superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts +++ b/superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts @@ -106,11 +106,10 @@ export const fetchTimeRange = async ( } catch (caught) { // Forward-compat: TS 6.0 types caught values as `unknown`; cast to the // shape getClientErrorObject accepts and narrow for statusText access. - const response = caught as Parameters<typeof getClientErrorObject>[0]; - const clientError = await getClientErrorObject(response); + const clientError = await getClientErrorObject( + caught as Parameters<typeof getClientErrorObject>[0], + ); return { error: clientError.message || clientError.error || - (response as { statusText?: string }).statusText, + (caught as { statusText?: string }).statusText, }; } };
-
-
superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx - 1
-
Incomplete eslint-disable directive · Line 100-100The eslint-disable-line comment on line 100 lacks specificity. It should specify the exact rule(s) being suppressed (e.g., `@typescript-eslint/no-explicit-any`) rather than disabling all rules on the line. This prevents masking unrelated violations and improves maintainability.
-
Review Details
-
Files reviewed - 15 · Commit Range:
f566ca1..4388c65- superset-frontend/packages/superset-ui-core/src/chart/components/StatefulChart.tsx
- superset-frontend/packages/superset-ui-core/src/components/AsyncEsmComponent/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/DropdownContainer/DropdownContainer.tsx
- superset-frontend/packages/superset-ui-core/src/components/Icons/AntdEnhanced.tsx
- superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/AsyncSelect.tsx
- superset-frontend/packages/superset-ui-core/src/components/Select/Select.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/VirtualTable.tsx
- superset-frontend/packages/superset-ui-core/src/components/Table/utils/InteractiveTableUtils.ts
- superset-frontend/packages/superset-ui-core/src/components/TableCollection/index.tsx
- superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/index.tsx
- superset-frontend/packages/superset-ui-core/src/connection/types.ts
- superset-frontend/packages/superset-ui-core/src/time-comparison/fetchTimeRange.ts
- superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts
- superset-frontend/packages/superset-ui-core/types/assets.d.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 [email protected].
Documentation & Help
Per @Bito's review on #39535: - TimezoneSelector: replace direct `antd/es/select` LabeledValue import with the re-export from `@superset-ui/core/components` (per CLAUDE.md rule against direct Ant Design imports). - ModalTrigger: handle callback refs in addition to object refs. The previous `if (ref && typeof ref !== 'function')` branch silently no-op'd whenever a parent passed a function ref, so they couldn't access close/open/showModal. Not applying the AsyncEsmComponent ref-type suggestion: the existing `@ts-expect-error` directive above the call site is the deliberate workaround for the PropsWithoutRef incompatibility, and changing the ref type would make that directive unused and warn.
4388c65 to
cab7179
Compare
Code Review Agent Run #3a9877Actionable Suggestions - 0Additional Suggestions - 4
|
Per @Bito's review on #39535: - TimezoneSelector: replace direct `antd/es/select` LabeledValue import with the re-export from `@superset-ui/core/components` (per CLAUDE.md rule against direct Ant Design imports). - ModalTrigger: handle callback refs in addition to object refs. The previous `if (ref && typeof ref !== 'function')` branch silently no-op'd whenever a parent passed a function ref, so they couldn't access close/open/showModal. Not applying the AsyncEsmComponent ref-type suggestion: the existing `@ts-expect-error` directive above the call site is the deliberate workaround for the PropsWithoutRef incompatibility, and changing the ref type would make that directive unused and warn.
cab7179 to
f89965e
Compare
Code Review Agent Run #f7bb7bActionable Suggestions - 0Additional Suggestions - 3
|
aminghadersohi
left a comment
There was a problem hiding this comment.
connection/types.ts:32 (error: Error | null) — The widening of `FetchRetryOptions` callbacks from `Error` to `Error | null` and `Response` to `Response | null` correctly matches `fetch-retry`'s actual call-site signature, but it is a TypeScript-breaking change for downstream consumers.
Parameter types are contravariant: a consumer who wrote:
```ts
const myDelay = (attempt: number, error: Error, response: Response) => 1000;
```
and assigned it to `FetchRetryOptions['retryDelay']` will now get a TS compile error, because `(error: Error) => ...` is not assignable to `(error: Error | null) => ...`.
Since `FetchRetryOptions` is a public export of `superset-ui-core`, this should be noted in `UPDATING.md`.
Scoped to packages/superset-ui-core. All changes compile cleanly on
TypeScript 5.4.5 (current CI) and eliminate TS 6.0 errors in this package.
Key fixes:
- forwardRef callbacks use ForwardedRef<T> instead of RefObject<T>
(AsyncEsmComponent, DropdownContainer, ModalTrigger). ModalTrigger
also narrows object-ref access with a typeof-function guard.
- StatefulChart: cast onRenderFailure to the shared HandlerFunction type
so the stricter 6.0 inference matches the SuperChart prop.
- AntdEnhanced: drop the wider IconType.component from the spread so
{...rest} can no longer override the explicit <BaseIconComponent
component={...}> binding under 6.0's stricter JSX attribute checking.
- Select / AsyncSelect: widen antd sorter/filter/handler call-sites with
targeted `as unknown as ...` casts against antd's BaseOptionType /
DefaultOptionType / SelectHandler shapes. Behaviour unchanged; only
the type boundary moves.
- VirtualTable: accept width?: number from react-resize-detector's 6.0
callback signature, defaulting missing width to 0.
- TableCollection: cast columns / rowClassName / onChange to antd's
generic ColumnsType<object> and TableProps<object> variants.
- TimezoneSelector: cast our comparator to antd's LabeledValue-based
sorter signature; our comparator only reads fields that always exist
on TimezoneOption, so the broader shape is safe at runtime.
- connection/types: widen FetchRetryOptions retryDelay/retryOn to
accept `Error | null` / `Response | null`, matching fetch-retry.
- fetchTimeRange: rename catch variable and narrow it via the
getClientErrorObject parameter type, handling TS 6.0's `unknown`
default for caught values.
- lruCache: guard Map iterator .value before Map#delete (TS 6.0 types
IteratorResult.value as `string | undefined`).
- InteractiveTableUtils: initialise columnRef to null for strict
property initialization.
- types/assets.d.ts: add `declare module '*.css'` for CSS side-effect
imports under 6.0's stricter module resolution.
Part of the TypeScript 5.4 -> 6.0 migration, split per-package to keep
reviews small. No runtime behaviour changes.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
Per @Bito's review on #39535: - TimezoneSelector: replace direct `antd/es/select` LabeledValue import with the re-export from `@superset-ui/core/components` (per CLAUDE.md rule against direct Ant Design imports). - ModalTrigger: handle callback refs in addition to object refs. The previous `if (ref && typeof ref !== 'function')` branch silently no-op'd whenever a parent passed a function ref, so they couldn't access close/open/showModal. Not applying the AsyncEsmComponent ref-type suggestion: the existing `@ts-expect-error` directive above the call site is the deliberate workaround for the PropsWithoutRef incompatibility, and changing the ref type would make that directive unused and warn.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
63acf3a to
bd26ca8
Compare
Code Review Agent Run #3b23acActionable Suggestions - 0Filtered by Review RulesBito filtered these suggestions based on rules created automatically for your feedback. Manage rules.
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 |
aminghadersohi
left a comment
There was a problem hiding this comment.
TS6 forward-compat fixes look correct throughout. The FetchRetryOptions breaking change is documented in UPDATING.md. All reviewer threads resolved.
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. This PR is scoped to
packages/superset-ui-coreonly. All changes compile cleanly on TypeScript 5.4.5 (current CI) and eliminate the TS 6.0 errors in that package, so future upgrade PRs will have strictly fewer errors to resolve.No runtime behaviour changes. Every fix is either a signature widening, a type-only cast at a boundary where our code is known-safe, or a stricter internal type.
What changed, and why:
forwardRefcallbacks useForwardedRef<T>instead ofRefObject<T>(AsyncEsmComponent,DropdownContainer,ModalTrigger). TS 6.0 narrowsRefObject's contract, soforwardRef's callback parameter no longer assigns to it.ForwardedRef<T>is the correct type and accepts both object refs and callback refs.ModalTriggeradditionally adds atypeof ref !== 'function'guard before mutatingref.current.StatefulChart: castonRenderFailureto the sharedHandlerFunctiontype so the stricter 6.0 inference matches theSuperChartprop shape.AntdEnhanced: drop the widerIconType.componentfrom the spread so{...rest}can no longer override the explicit<BaseIconComponent component={...}>binding. This surfaced under 6.0's stricter JSX attribute checking becauseIconType.componentisForwardRefExoticComponent<CustomIconComponentProps>(wider thanBaseIconProps['component']), and the spread was silently overwriting the explicit attribute.Select/AsyncSelect: targetedas unknown as ...casts for sorter / filter / deselect / select call sites against antd'sBaseOptionType | DefaultOptionTypeandSelectHandlershapes. Our handlers read properties that always exist on the narrowerAntdLabeledValue, so the wider antd shape is safe at runtime.VirtualTable: acceptwidth?: numberfromreact-resize-detector's 6.0 callback signature, defaulting missing width to0.TableCollection: castcolumns/rowClassName/onChangeto antd's genericColumnsType<object>andTableProps<object>variants at the JSX boundary.TimezoneSelector: cast our comparator to antd'sLabeledValue-based sorter signature; our comparator only readstimezoneName, which always exists onTimezoneOption.connection/types: widenFetchRetryOptions'retryDelay/retryOnto acceptError | null/Response | null, matching thefetch-retrylibrary.fetchTimeRange: rename the catch variable and narrow viaParameters<typeof getClientErrorObject>[0]+ an inline{ statusText?: string }cast, since TS 6.0 defaults caught values tounknown.lruCache: guard theMapiterator's.valuebeforeMap#delete, because TS 6.0 typesIteratorResult.valueasstring | undefineduntil it's narrowed.InteractiveTableUtils: initialisecolumnReftonullforstrictPropertyInitialization.types/assets.d.ts: adddeclare module '*.css'for side-effect CSS imports.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — type-level changes only.
TESTING INSTRUCTIONS
cd superset-frontend && npm run type— should pass on TS 5.4.5 (current CI).npm install [email protected] --no-save) then runnpx tsc --project packages/superset-ui-core/tsconfig.json --noEmit. Before this PR that reports 24+ errors in superset-ui-core; after this PR it reports 0.AntdEnhanced, andStatefulChart.ADDITIONAL INFORMATION
🤖 Generated with Claude Code