EnxDev commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2767909797


##########
superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx:
##########
@@ -271,7 +273,10 @@ export const useHeaderActionsMenu = ({
     // Only add divider if there are items after it
     const hasItemsAfterDivider =
       (!editMode && reportMenuItem) ||
-      (editMode && !isEmpty(dashboardInfo?.metadata?.filter_scopes));
+      (editMode &&
+        !isEmpty(
+          (dashboardInfo?.metadata as Record<string, unknown>)?.filter_scopes,
+        ));

Review Comment:
   Would it make sense to define metadata more precisely in the DashboardInfo 
interface? That would help avoid repeated casts when accessing it



##########
superset-frontend/src/dashboard/components/gridComponents/Tab/Tab.tsx:
##########
@@ -116,23 +123,55 @@ const TitleDropIndicator = styled.div`
   }
 `;
 
-const renderDraggableContent = dropProps =>
-  dropProps.dropIndicatorProps && <div {...dropProps.dropIndicatorProps} />;
-
-const Tab = props => {
+interface DropIndicatorChildProps {
+  dropIndicatorProps?: {
+    className: string;
+  } | null;
+}
+
+const renderDraggableContent = (
+  dropProps: DropIndicatorChildProps,
+): ReactElement | null =>
+  dropProps.dropIndicatorProps ? (
+    <div {...dropProps.dropIndicatorProps} />
+  ) : null;
+
+interface DragDropChildProps {
+  dropIndicatorProps?: {
+    className: string;
+  } | null;
+  dragSourceRef?: Ref<HTMLDivElement>;
+  draggingTabOnTab?: boolean;
+}
+
+const Tab = (props: TabProps): ReactElement => {
   const dispatch = useDispatch();
-  const canEdit = useSelector(state => state.dashboardInfo.dash_edit_perm);
-  const dashboardLayout = useSelector(state => state.dashboardLayout.present);
+  const canEdit = useSelector(
+    (state: RootState) => state.dashboardInfo.dash_edit_perm,
+  );
+  const dashboardLayout = useSelector(
+    (state: RootState) => state.dashboardLayout.present,
+  );
   const lastRefreshTime = useSelector(
-    state => state.dashboardState.lastRefreshTime,
+    (state: RootState) =>
+      (
+        state.dashboardState as RootState['dashboardState'] & {
+          lastRefreshTime?: number;
+        }
+      ).lastRefreshTime,
   );
   const tabActivationTime = useSelector(
-    state => state.dashboardState.tabActivationTimes?.[props.id] || 0,
+    (state: RootState) =>
+      (
+        state.dashboardState as RootState['dashboardState'] & {
+          tabActivationTimes?: Record<string, number>;
+        }
+      ).tabActivationTimes?.[props.id] || 0,

Review Comment:
   Would it make sense to add `tabActivationTimes` to `DashboardState` rather 
than extending the type inline? That would help avoid repeating this cast in 
multiple places



##########
superset-frontend/src/dashboard/reducers/dashboardInfo.ts:
##########
@@ -0,0 +1,320 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  ChartCustomization,
+  ChartCustomizationDivider,
+  ColumnOption,
+  JsonObject,
+} from '@superset-ui/core';
+import {
+  DASHBOARD_INFO_UPDATED,
+  SET_FILTER_BAR_ORIENTATION,
+  SET_CROSS_FILTERS_ENABLED,
+  DASHBOARD_INFO_FILTERS_CHANGED,
+} from '../actions/dashboardInfo';
+import {
+  SAVE_CHART_CUSTOMIZATION_COMPLETE,
+  SET_CHART_CUSTOMIZATION_DATA_LOADING,
+  SET_CHART_CUSTOMIZATION_DATA,
+  SET_PENDING_CHART_CUSTOMIZATION,
+  CLEAR_PENDING_CHART_CUSTOMIZATION,
+  CLEAR_ALL_PENDING_CHART_CUSTOMIZATIONS,
+  CLEAR_ALL_CHART_CUSTOMIZATIONS,
+} from '../actions/chartCustomizationActions';
+import { HYDRATE_DASHBOARD } from '../actions/hydrate';
+import { DashboardInfo, FilterBarOrientation } from '../types';
+
+interface FilterConfigItem extends JsonObject {
+  id: string;
+  chartsInScope?: number[];
+  tabsInScope?: string[];
+  type?: string;
+  targets?: { datasetId?: number; [key: string]: unknown }[];
+}
+
+interface DashboardInfoAction {
+  type: string;
+  newInfo?: Partial<DashboardInfo> & {
+    theme_id?: number | null;
+  };
+  filterBarOrientation?: FilterBarOrientation;
+  crossFiltersEnabled?: boolean;
+  chartCustomization?: (ChartCustomization | ChartCustomizationDivider)[];
+  itemId?: string;
+  isLoading?: boolean;
+  data?: ColumnOption[];
+  pendingCustomization?: ChartCustomization;
+  [key: string]: unknown;
+}
+
+interface HydrateDashboardAction {
+  type: typeof HYDRATE_DASHBOARD;
+  data: {
+    dashboardInfo: DashboardInfo;
+    [key: string]: unknown;
+  };
+}
+
+type DashboardInfoReducerAction = DashboardInfoAction | HydrateDashboardAction;
+
+type DashboardInfoState = Partial<DashboardInfo> & {
+  last_modified_time?: number;
+  [key: string]: unknown;
+};
+
+function isHydrateAction(
+  action: DashboardInfoReducerAction,
+): action is HydrateDashboardAction {
+  return action.type === HYDRATE_DASHBOARD;
+}
+
+function preserveScopes(
+  existingConfig: FilterConfigItem[] | undefined,
+  incomingConfig: FilterConfigItem[] | undefined,
+): FilterConfigItem[] {
+  const existingScopesMap = (existingConfig || []).reduce<
+    Record<string, { chartsInScope?: number[]; tabsInScope?: string[] }>
+  >((acc, item) => {
+    if (item.chartsInScope != null || item.tabsInScope != null) {
+      acc[item.id] = {
+        chartsInScope: item.chartsInScope,
+        tabsInScope: item.tabsInScope,
+      };
+    }
+    return acc;
+  }, {});
+
+  return (incomingConfig || []).map(item => {
+    const existingScopes = existingScopesMap[item.id];
+    if (item.chartsInScope == null && existingScopes) {
+      return {
+        ...item,
+        chartsInScope: existingScopes.chartsInScope,
+        tabsInScope: existingScopes.tabsInScope,
+      };
+    }
+    return item;
+  });
+}
+
+export default function dashboardInfoReducer(
+  state: DashboardInfoState = {},
+  action: DashboardInfoReducerAction,
+): DashboardInfoState {
+  switch (action.type) {
+    case DASHBOARD_INFO_UPDATED: {
+      const dashAction = action as DashboardInfoAction;
+      const newInfo = dashAction.newInfo || {};
+      const { theme_id: themeId, ...otherInfo } = newInfo;
+      const updatedState: DashboardInfoState = {
+        ...state,
+        ...otherInfo,
+        last_modified_time: Math.round(new Date().getTime() / 1000),
+      };
+
+      if (themeId !== undefined) {
+        if (themeId === null) {
+          updatedState.theme = null;
+        } else {
+          updatedState.theme = { id: themeId, name: `Theme ${themeId}` };
+        }
+      }
+
+      return updatedState;
+    }
+    case DASHBOARD_INFO_FILTERS_CHANGED: {
+      const dashAction = action as DashboardInfoAction;
+      const existingConfig =
+        (state.metadata?.native_filter_configuration as FilterConfigItem[]) ||
+        [];
+      const existingScopesMap = existingConfig.reduce<
+        Record<string, { chartsInScope?: number[]; tabsInScope?: string[] }>
+      >((acc, filter) => {
+        if (filter.chartsInScope != null || filter.tabsInScope != null) {
+          acc[filter.id] = {
+            chartsInScope: filter.chartsInScope,
+            tabsInScope: filter.tabsInScope,
+          };
+        }
+        return acc;
+      }, {});
+
+      const newConfigWithScopes = (
+        (dashAction.newInfo as FilterConfigItem[]) || []
+      ).map((filter: FilterConfigItem) => {
+        const existingScopes = existingScopesMap[filter.id];
+        if (filter.chartsInScope == null && existingScopes) {
+          return {
+            ...filter,
+            chartsInScope: existingScopes.chartsInScope,
+            tabsInScope: existingScopes.tabsInScope,
+          };
+        }
+        return filter;
+      });
+
+      return {
+        ...state,
+        metadata: {
+          ...state.metadata,
+          native_filter_configuration: newConfigWithScopes,
+        } as DashboardInfo['metadata'],
+        last_modified_time: Math.round(new Date().getTime() / 1000),
+      };
+    }
+    case HYDRATE_DASHBOARD: {
+      if (!isHydrateAction(action)) return state;
+      const incomingMetadata = action.data.dashboardInfo.metadata || {};
+
+      const mergedFilterConfig = preserveScopes(
+        state.metadata?.native_filter_configuration as
+          | FilterConfigItem[]
+          | undefined,
+        incomingMetadata.native_filter_configuration as
+          | FilterConfigItem[]
+          | undefined,
+      );
+
+      const mergedCustomizationConfig = preserveScopes(
+        state.metadata?.chart_customization_config as
+          | FilterConfigItem[]
+          | undefined,
+        incomingMetadata.chart_customization_config as
+          | FilterConfigItem[]
+          | undefined,
+      );

Review Comment:
   I’ve noticed this is the fourth occurrence of manual casts on metadata 
properties. Would defining a DashboardMetadata interface help reduce these 
casts across the codebase?



##########
superset-frontend/src/dashboard/reducers/dashboardInfo.ts:
##########
@@ -0,0 +1,320 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import {
+  ChartCustomization,
+  ChartCustomizationDivider,
+  ColumnOption,
+  JsonObject,
+} from '@superset-ui/core';
+import {
+  DASHBOARD_INFO_UPDATED,
+  SET_FILTER_BAR_ORIENTATION,
+  SET_CROSS_FILTERS_ENABLED,
+  DASHBOARD_INFO_FILTERS_CHANGED,
+} from '../actions/dashboardInfo';
+import {
+  SAVE_CHART_CUSTOMIZATION_COMPLETE,
+  SET_CHART_CUSTOMIZATION_DATA_LOADING,
+  SET_CHART_CUSTOMIZATION_DATA,
+  SET_PENDING_CHART_CUSTOMIZATION,
+  CLEAR_PENDING_CHART_CUSTOMIZATION,
+  CLEAR_ALL_PENDING_CHART_CUSTOMIZATIONS,
+  CLEAR_ALL_CHART_CUSTOMIZATIONS,
+} from '../actions/chartCustomizationActions';
+import { HYDRATE_DASHBOARD } from '../actions/hydrate';
+import { DashboardInfo, FilterBarOrientation } from '../types';
+
+interface FilterConfigItem extends JsonObject {
+  id: string;
+  chartsInScope?: number[];
+  tabsInScope?: string[];
+  type?: string;
+  targets?: { datasetId?: number; [key: string]: unknown }[];
+}
+
+interface DashboardInfoAction {
+  type: string;
+  newInfo?: Partial<DashboardInfo> & {
+    theme_id?: number | null;
+  };
+  filterBarOrientation?: FilterBarOrientation;
+  crossFiltersEnabled?: boolean;
+  chartCustomization?: (ChartCustomization | ChartCustomizationDivider)[];
+  itemId?: string;
+  isLoading?: boolean;
+  data?: ColumnOption[];
+  pendingCustomization?: ChartCustomization;
+  [key: string]: unknown;
+}
+
+interface HydrateDashboardAction {
+  type: typeof HYDRATE_DASHBOARD;
+  data: {
+    dashboardInfo: DashboardInfo;
+    [key: string]: unknown;
+  };
+}
+
+type DashboardInfoReducerAction = DashboardInfoAction | HydrateDashboardAction;
+
+type DashboardInfoState = Partial<DashboardInfo> & {
+  last_modified_time?: number;
+  [key: string]: unknown;
+};
+
+function isHydrateAction(
+  action: DashboardInfoReducerAction,
+): action is HydrateDashboardAction {
+  return action.type === HYDRATE_DASHBOARD;
+}
+
+function preserveScopes(
+  existingConfig: FilterConfigItem[] | undefined,
+  incomingConfig: FilterConfigItem[] | undefined,
+): FilterConfigItem[] {
+  const existingScopesMap = (existingConfig || []).reduce<
+    Record<string, { chartsInScope?: number[]; tabsInScope?: string[] }>
+  >((acc, item) => {
+    if (item.chartsInScope != null || item.tabsInScope != null) {
+      acc[item.id] = {
+        chartsInScope: item.chartsInScope,
+        tabsInScope: item.tabsInScope,
+      };
+    }
+    return acc;
+  }, {});
+
+  return (incomingConfig || []).map(item => {
+    const existingScopes = existingScopesMap[item.id];
+    if (item.chartsInScope == null && existingScopes) {
+      return {
+        ...item,
+        chartsInScope: existingScopes.chartsInScope,
+        tabsInScope: existingScopes.tabsInScope,
+      };
+    }
+    return item;
+  });
+}
+
+export default function dashboardInfoReducer(
+  state: DashboardInfoState = {},
+  action: DashboardInfoReducerAction,
+): DashboardInfoState {
+  switch (action.type) {
+    case DASHBOARD_INFO_UPDATED: {
+      const dashAction = action as DashboardInfoAction;
+      const newInfo = dashAction.newInfo || {};
+      const { theme_id: themeId, ...otherInfo } = newInfo;
+      const updatedState: DashboardInfoState = {
+        ...state,
+        ...otherInfo,
+        last_modified_time: Math.round(new Date().getTime() / 1000),
+      };
+
+      if (themeId !== undefined) {
+        if (themeId === null) {
+          updatedState.theme = null;
+        } else {
+          updatedState.theme = { id: themeId, name: `Theme ${themeId}` };
+        }
+      }
+
+      return updatedState;
+    }
+    case DASHBOARD_INFO_FILTERS_CHANGED: {
+      const dashAction = action as DashboardInfoAction;
+      const existingConfig =
+        (state.metadata?.native_filter_configuration as FilterConfigItem[]) ||
+        [];
+      const existingScopesMap = existingConfig.reduce<
+        Record<string, { chartsInScope?: number[]; tabsInScope?: string[] }>
+      >((acc, filter) => {
+        if (filter.chartsInScope != null || filter.tabsInScope != null) {
+          acc[filter.id] = {
+            chartsInScope: filter.chartsInScope,
+            tabsInScope: filter.tabsInScope,
+          };
+        }
+        return acc;
+      }, {});
+
+      const newConfigWithScopes = (
+        (dashAction.newInfo as FilterConfigItem[]) || []
+      ).map((filter: FilterConfigItem) => {
+        const existingScopes = existingScopesMap[filter.id];
+        if (filter.chartsInScope == null && existingScopes) {
+          return {
+            ...filter,
+            chartsInScope: existingScopes.chartsInScope,
+            tabsInScope: existingScopes.tabsInScope,
+          };
+        }
+        return filter;
+      });
+
+      return {
+        ...state,
+        metadata: {
+          ...state.metadata,
+          native_filter_configuration: newConfigWithScopes,
+        } as DashboardInfo['metadata'],
+        last_modified_time: Math.round(new Date().getTime() / 1000),
+      };
+    }
+    case HYDRATE_DASHBOARD: {
+      if (!isHydrateAction(action)) return state;
+      const incomingMetadata = action.data.dashboardInfo.metadata || {};
+
+      const mergedFilterConfig = preserveScopes(
+        state.metadata?.native_filter_configuration as
+          | FilterConfigItem[]
+          | undefined,
+        incomingMetadata.native_filter_configuration as
+          | FilterConfigItem[]
+          | undefined,
+      );
+
+      const mergedCustomizationConfig = preserveScopes(
+        state.metadata?.chart_customization_config as
+          | FilterConfigItem[]
+          | undefined,
+        incomingMetadata.chart_customization_config as
+          | FilterConfigItem[]
+          | undefined,
+      );
+
+      return {
+        ...state,
+        ...action.data.dashboardInfo,
+        metadata: {
+          ...incomingMetadata,
+          native_filter_configuration: mergedFilterConfig,
+          chart_customization_config: mergedCustomizationConfig,
+        } as unknown as DashboardInfo['metadata'],

Review Comment:
   here as well



##########
superset-frontend/src/explore/actions/exploreActions.test.ts:
##########
@@ -199,8 +199,8 @@ describe('reducers', () => {
     ];
 
     const newState = exploreReducer(
-      mockedState,
-      actions.setControlValue('metrics', updatedMetrics, []),
+      mockedState as any,
+      actions.setControlValue('metrics', updatedMetrics, []) as any,

Review Comment:
   here as well, check the entire file



##########
superset-frontend/src/dashboard/reducers/dashboardState.test.ts:
##########
@@ -117,10 +137,10 @@ describe('DashboardState reducer', () => {
         }),
       );
       request = setActiveTab('TAB-2', 'TAB-1');
-      thunkAction = request(store.dispatch, () => ({
+      thunkAction = request(store.dispatch, (() => ({
         ...(store.getState() as object),
-        dashboardState: result,
-      }));
+        dashboardState: result as DashboardState,
+      })) as any);
       result = typedDashboardStateReducer(result, thunkAction);

Review Comment:
   here as well



##########
superset-frontend/src/SqlLab/actions/sqlLab.test.ts:
##########
@@ -281,7 +299,11 @@ describe('async actions', () => {
       };
       const store = mockStore(state);
 
-      store.dispatch(actions.formatQuery(queryEditorWithTemplateString));
+      store.dispatch(
+        actions.formatQuery(
+          queryEditorWithTemplateString as unknown as QueryEditor,
+        ),
+      );

Review Comment:
   here as well



##########
superset-frontend/src/dashboard/reducers/dashboardLayout.ts:
##########
@@ -176,7 +219,7 @@ const actionHandlers = {
       newRow.children = [destinationChildren[destination.index]];
       newRow.parents = (destinationEntity.parents || 
[]).concat(destination.id);
       destinationChildren[destination.index] = newRow.id;
-      nextEntities[newRow.id] = newRow;
+      nextEntities[newRow.id] = newRow as unknown as DashboardLayout[string];

Review Comment:
   Do you think we could avoid the double cast into Redux state by aligning 
`newComponentFactory’s` return type with `DashboardLayout[string]`? That might 
be safer for downstream consumers



##########
superset-frontend/src/dashboard/reducers/dashboardState.test.ts:
##########
@@ -63,7 +83,7 @@ describe('DashboardState reducer', () => {
         dashboardLayout: { present: { tab1: { parents: [] } } },
       });
       const request = setActiveTab('tab1');
-      const thunkAction = request(store.dispatch, store.getState);
+      const thunkAction = request(store.dispatch, store.getState as any);

Review Comment:
   Could we cast to () => RootState instead of any? That way TypeScript still 
validates if the thunk's expected state type changes



##########
superset-frontend/src/explore/components/controls/ViewQueryModal.tsx:
##########
@@ -60,7 +60,7 @@ const ViewQueryModal: FC<Props> = ({ latestQueryFormData }) 
=> {
       resultType,
     })
       .then(({ json }) => {
-        setResult(ensureIsArray(json.result));
+        setResult(ensureIsArray(json.result) as Result[]);

Review Comment:
   here as well



##########
superset-frontend/src/dashboard/components/Header/useHeaderActionsDropdownMenu.tsx:
##########
@@ -283,7 +288,12 @@ export const useHeaderActionsMenu = ({
     }
 
     // Set filter mapping
-    if (editMode && !isEmpty(dashboardInfo?.metadata?.filter_scopes)) {
+    if (
+      editMode &&
+      !isEmpty(
+        (dashboardInfo?.metadata as Record<string, unknown>)?.filter_scopes,

Review Comment:
   here as well



##########
superset-frontend/src/explore/components/ExploreViewContainer/index.tsx:
##########
@@ -840,14 +980,15 @@ function ExploreViewContainer(props) {
               />
             </span>
           </div>
+          {/* eslint-disable @typescript-eslint/no-explicit-any -- 
DataSourcePanel uses narrower types that are compatible at runtime */}
           <DataSourcePanel
             formData={props.form_data}
-            datasource={props.datasource}
-            controls={props.controls}
-            actions={props.actions}
+            datasource={props.datasource as any}
+            controls={props.controls as any}
+            actions={props.actions as any}

Review Comment:
   here as well



##########
superset-frontend/src/explore/components/ExploreViewContainer/index.tsx:
##########
@@ -717,7 +829,10 @@ function ExploreViewContainer(props) {
           .filter(control => control.validationErrors?.includes(message))
           .map(control =>
             typeof control.label === 'function'
-              ? control.label(props.exploreState)
+              ? control.label(
+                  props.exploreState as unknown as ControlPanelState,
+                  control,
+                )

Review Comment:
   I’m wondering if exploreState is intended to be a ControlPanelState. If yes, 
we could type it directly; if not, relying on this cast may introduce runtime 
risks for the label function



##########
superset-frontend/src/SqlLab/actions/sqlLab.test.ts:
##########
@@ -633,7 +665,7 @@ describe('async actions', () => {
 
       return makeRequest().then(() => {
         const call = fetchMock.callHistory.calls(stopQueryEndpoint)[0];
-        const body = JSON.parse(call.options.body);
+        const body = JSON.parse(call.options.body as string);

Review Comment:
   and there



##########
superset-frontend/src/explore/components/ExploreChartHeader/ExploreChartHeader.test.tsx:
##########
@@ -56,90 +55,99 @@ const mockExportCurrentViewBehavior = () => {
   } as any);
 };
 
-const createProps = (additionalProps = {}) => ({
-  chart: {
-    id: 1,
-    latestQueryFormData: {
-      viz_type: VizType.Histogram,
-      datasource: '49__table',
-      slice_id: 318,
-      url_params: {},
-      granularity_sqla: 'time_start',
-      time_range: 'No filter',
-      all_columns_x: ['age'],
-      adhoc_filters: [],
-      row_limit: 10000,
-      groupby: null,
-      color_scheme: 'supersetColors',
-      label_colors: {},
-      link_length: '25',
-      x_axis_label: 'age',
-      y_axis_label: 'count',
-      server_pagination: false as any,
+const createProps = (additionalProps = {}) =>
+  ({
+    chart: {
+      id: 1,
+      latestQueryFormData: {
+        viz_type: VizType.Histogram,
+        datasource: '49__table',
+        slice_id: 318,
+        url_params: {},
+        granularity_sqla: 'time_start',
+        time_range: 'No filter',
+        all_columns_x: ['age'],
+        adhoc_filters: [],
+        row_limit: 10000,
+        groupby: null,
+        color_scheme: 'supersetColors',
+        label_colors: {},
+        link_length: '25',
+        x_axis_label: 'age',
+        y_axis_label: 'count',
+        server_pagination: false,
+      },
+      chartStatus: 'rendered' as const,
+      chartAlert: null,
+      chartUpdateEndTime: null,
+      chartUpdateStartTime: 0,
+      lastRendered: 0,
+      sliceFormData: null,
+      queryController: null,
+      queriesResponse: null,
+      triggerQuery: false,
     },
-    chartStatus: 'rendered',
-  },
-  slice: {
-    cache_timeout: null,
-    changed_on: '2021-03-19T16:30:56.750230',
-    changed_on_humanized: '7 days ago',
-    datasource: 'FCC 2018 Survey',
-    description: 'Simple description',
-    description_markeddown: '',
-    edit_url: '/chart/edit/318',
-    form_data: {
-      adhoc_filters: [],
-      all_columns_x: ['age'],
-      color_scheme: 'supersetColors',
-      datasource: '49__table',
-      granularity_sqla: 'time_start',
-      groupby: null,
-      label_colors: {},
-      link_length: '25',
-      queryFields: { groupby: 'groupby' },
-      row_limit: 10000,
+    slice: {
+      cache_timeout: null,
+      changed_on: '2021-03-19T16:30:56.750230',
+      changed_on_humanized: '7 days ago',
+      datasource: 'FCC 2018 Survey',
+      description: 'Simple description',
+      description_markeddown: '',
+      edit_url: '/chart/edit/318',
+      form_data: {
+        adhoc_filters: [],
+        all_columns_x: ['age'],
+        color_scheme: 'supersetColors',
+        datasource: '49__table',
+        granularity_sqla: 'time_start',
+        groupby: null,
+        label_colors: {},
+        link_length: '25',
+        queryFields: { groupby: 'groupby' },
+        row_limit: 10000,
+        slice_id: 318,
+        time_range: 'No filter',
+        url_params: {},
+        viz_type: VizType.Histogram,
+        x_axis_label: 'age',
+        y_axis_label: 'count',
+      },
+      modified: '<span class="no-wrap">7 days ago</span>',
+      owners: [
+        {
+          text: 'Superset Admin',
+          value: 1,
+        },
+      ],
       slice_id: 318,
-      time_range: 'No filter',
-      url_params: {},
-      viz_type: VizType.Histogram,
-      x_axis_label: 'age',
-      y_axis_label: 'count',
+      slice_name: 'Age distribution of respondents',
+      slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20318%7D',
     },
-    modified: '<span class="no-wrap">7 days ago</span>',
-    owners: [
-      {
-        text: 'Superset Admin',
-        value: 1,
-      },
-    ],
-    slice_id: 318,
-    slice_name: 'Age distribution of respondents',
-    slice_url: '/explore/?form_data=%7B%22slice_id%22%3A%20318%7D',
-  },
-  slice_name: 'Age distribution of respondents',
-  actions: {
-    postChartFormData: jest.fn(),
-    updateChartTitle: jest.fn(),
-    fetchFaveStar: jest.fn(),
-    saveFaveStar: jest.fn(),
-    redirectSQLLab: jest.fn(),
-  },
-  user: {
-    userId: 1,
-  },
-  metadata: {
-    created_on_humanized: 'a week ago',
-    changed_on_humanized: '2 days ago',
-    owners: ['John Doe'],
-    created_by: 'John Doe',
-    changed_by: 'John Doe',
-    dashboards: [{ id: 1, dashboard_title: 'Test' }],
-  },
-  canOverwrite: false,
-  canDownload: false,
-  isStarred: false,
-  ...additionalProps,
-});
+    sliceName: 'Age distribution of respondents',
+    actions: {
+      postChartFormData: jest.fn(),
+      updateChartTitle: jest.fn(),
+      fetchFaveStar: jest.fn(),
+      saveFaveStar: jest.fn(),
+      redirectSQLLab: jest.fn(),
+    },
+    user: {
+      userId: 1,
+    },
+    metadata: {
+      created_on_humanized: 'a week ago',
+      changed_on_humanized: '2 days ago',
+      owners: ['John Doe'],
+      created_by: 'John Doe',
+      changed_by: 'John Doe',
+      dashboards: [{ id: 1, dashboard_title: 'Test' }],
+    },
+    canOverwrite: false,
+    canDownload: false,
+    isStarred: false,
+    ...additionalProps,
+  }) as unknown as ExploreChartHeaderProps;

Review Comment:
   here as well



##########
superset-frontend/src/SqlLab/actions/sqlLab.test.ts:
##########
@@ -390,7 +416,7 @@ describe('async actions', () => {
       );
 
       const call = fetchMock.callHistory.calls(formatQueryEndpoint)[0];
-      const body = JSON.parse(call.options.body);
+      const body = JSON.parse(call.options.body as string);

Review Comment:
   same here



##########
superset-frontend/src/explore/components/ExploreChartHeader/index.tsx:
##########
@@ -155,23 +176,23 @@ export const ExploreChartHeader = ({
   };
 
   const updateSlice = useCallback(
-    slice => {
-      dispatch(sliceUpdated(slice));
+    (updatedSlice: Slice) => {
+      dispatch(sliceUpdated(updatedSlice));
     },
     [dispatch],
   );
 
-  const handleReportDelete = async report => {
-    await dispatch(deleteActiveReport(report));
+  const handleReportDelete = async (report: AlertObject) => {
+    await dispatch(deleteActiveReport(report as unknown as ReportObject));

Review Comment:
   here as well



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to