From 3fed820f3f7fcd533730aa593204d6484ab4a32d Mon Sep 17 00:00:00 2001 From: Evan Rusackas Date: Mon, 19 Jan 2026 15:32:25 -0800 Subject: [PATCH] fix(types): simplify action types to fix build errors The previous BoundActions type failed because action modules export both action creators AND action type constants (e.g., UPDATE_FORM_DATA_BY_DATASOURCE = 'UPDATE_FORM_DATA_BY_DATASOURCE'). Simplified to Record which properly represents the mixed nature of these exports while maintaining type safety elsewhere. Co-Authored-By: Claude Opus 4.5 --- .../components/ExploreViewContainer/index.tsx | 30 +++++-------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/superset-frontend/src/explore/components/ExploreViewContainer/index.tsx b/superset-frontend/src/explore/components/ExploreViewContainer/index.tsx index 88f15855844..816718e36de 100644 --- a/superset-frontend/src/explore/components/ExploreViewContainer/index.tsx +++ b/superset-frontend/src/explore/components/ExploreViewContainer/index.tsx @@ -25,7 +25,7 @@ import { useMemo, useState, } from 'react'; -import { bindActionCreators, Dispatch, ActionCreatorsMapObject } from 'redux'; +import { bindActionCreators, Dispatch } from 'redux'; import { connect } from 'react-redux'; import { useChangeEffect, @@ -73,7 +73,6 @@ import { datasourcesActions } from 'src/explore/actions/datasourcesActions'; import { mountExploreUrl } from 'src/explore/exploreUtils'; import { getFormDataFromControls } from 'src/explore/controlUtils'; import * as exploreActions from 'src/explore/actions/exploreActions'; -import { ExploreActions } from 'src/explore/actions/exploreActions'; import * as saveModalActions from 'src/explore/actions/saveModalActions'; import { useTabId } from 'src/hooks/useTabId'; import withToasts from 'src/components/MessageToasts/withToasts'; @@ -357,22 +356,11 @@ interface StateProps { isSaveModalVisible: boolean; } -// Combined actions type representing all action creators used in Explore -type CombinedExploreActions = typeof exploreActions & - typeof datasourcesActions & - typeof saveModalActions & - typeof chartActions & - typeof logActions; - -// Bound action creators type (what mapDispatchToProps actually returns) -type BoundActions = { - [K in keyof T]: T[K] extends (...args: infer A) => infer R - ? (...args: A) => R extends (...args: unknown[]) => infer R2 ? R2 : R - : T[K]; -}; - +// Combined actions from all action modules used in Explore +// Note: These modules export both action creators AND action type constants, +// so we use Record to accommodate the mixed exports interface DispatchProps { - actions: BoundActions; + actions: Record; } type ExploreViewContainerProps = StateProps & DispatchProps & OwnProps; @@ -1205,7 +1193,7 @@ function mapStateToProps(state: ExploreRootState) { } function mapDispatchToProps(dispatch: Dispatch): DispatchProps { - const actions: CombinedExploreActions = { + const actions = { ...exploreActions, ...datasourcesActions, ...saveModalActions, @@ -1213,10 +1201,8 @@ function mapDispatchToProps(dispatch: Dispatch): DispatchProps { ...logActions, }; return { - actions: bindActionCreators( - actions as ActionCreatorsMapObject, - dispatch, - ) as BoundActions, + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Action modules export mixed types (creators + constants) + actions: bindActionCreators(actions as any, dispatch), }; }