chore(chart-controls): improve typing for mapStateToProps (#1171)

This commit is contained in:
Kamil Gabryjelski
2021-07-24 11:06:27 +02:00
committed by Yongjie Zhao
parent 72ac9ab0ef
commit 11a52ea0fc
2 changed files with 1 additions and 2 deletions

View File

@@ -190,7 +190,7 @@ export interface BaseControlConfig<
*/
mapStateToProps?: (
state: ControlPanelState,
controlState: this & ExtraControlProps,
controlState: ControlState,
// TODO: add strict `chartState` typing (see superset-frontend/src/explore/types)
chartState?: AnyDict,
) => ExtraControlProps;

View File

@@ -184,7 +184,6 @@ const config: ControlPanelConfig = {
mapStateToProps: (state: ControlPanelState, controlState: ControlState) => {
const { controls } = state;
const originalMapStateToProps = sharedControls?.groupby?.mapStateToProps;
// @ts-ignore
const newState = originalMapStateToProps?.(state, controlState) ?? {};
newState.externalValidationErrors = validateAggControlValues(controls, [
controls.metrics?.value,