This is an automated email from the ASF dual-hosted git repository.

michaelsmolina pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d117ffbb5 chore: fix `tsc` errors (#31965)
6d117ffbb5 is described below

commit 6d117ffbb564f611df21fcb9a19c15b9567f35d9
Author: Đỗ Trọng Hải <[email protected]>
AuthorDate: Thu Jan 23 18:54:40 2025 +0700

    chore: fix `tsc` errors (#31965)
    
    Signed-off-by: hainenber <[email protected]>
---
 .../packages/superset-ui-core/src/models/Registry.ts    |  4 ++--
 superset-frontend/src/components/ModalTrigger/index.tsx |  2 +-
 superset-frontend/src/components/Select/utils.tsx       | 17 ++++++++++++-----
 .../components/controls/VizTypeControl/index.tsx        | 10 +---------
 .../explore/components/controls/VizTypeControl/types.ts | 10 ++++++++++
 superset-frontend/src/views/routes.tsx                  |  6 +++---
 6 files changed, 29 insertions(+), 20 deletions(-)

diff --git a/superset-frontend/packages/superset-ui-core/src/models/Registry.ts 
b/superset-frontend/packages/superset-ui-core/src/models/Registry.ts
index 53aff08c4a..7488ab8245 100644
--- a/superset-frontend/packages/superset-ui-core/src/models/Registry.ts
+++ b/superset-frontend/packages/superset-ui-core/src/models/Registry.ts
@@ -22,11 +22,11 @@ export enum OverwritePolicy {
   Warn = 'WARN',
 }
 
-interface ItemWithValue<T> {
+export interface ItemWithValue<T> {
   value: T;
 }
 
-interface ItemWithLoader<T> {
+export interface ItemWithLoader<T> {
   loader: () => T;
 }
 
diff --git a/superset-frontend/src/components/ModalTrigger/index.tsx 
b/superset-frontend/src/components/ModalTrigger/index.tsx
index 58c19347e6..d0de9db1d7 100644
--- a/superset-frontend/src/components/ModalTrigger/index.tsx
+++ b/superset-frontend/src/components/ModalTrigger/index.tsx
@@ -21,7 +21,7 @@ import { forwardRef, useState, ReactNode, MouseEvent } from 
'react';
 import Modal from 'src/components/Modal';
 import Button from 'src/components/Button';
 
-interface ModalTriggerProps {
+export interface ModalTriggerProps {
   dialogClassName?: string;
   triggerNode: ReactNode;
   modalTitle?: string;
diff --git a/superset-frontend/src/components/Select/utils.tsx 
b/superset-frontend/src/components/Select/utils.tsx
index 5648336732..b4d77204b5 100644
--- a/superset-frontend/src/components/Select/utils.tsx
+++ b/superset-frontend/src/components/Select/utils.tsx
@@ -186,8 +186,10 @@ export const handleFilterOptionHelper = (
     const searchValue = search.trim().toLowerCase();
     if (optionFilterProps?.length) {
       return optionFilterProps.some(prop => {
-        const optionProp = option?.[prop]
-          ? String(option[prop]).trim().toLowerCase()
+        const optionProp = option?.[prop as keyof LabeledValue]
+          ? String(option[prop as keyof LabeledValue])
+              .trim()
+              .toLowerCase()
           : '';
         return optionProp.includes(searchValue);
       });
@@ -200,7 +202,9 @@ export const handleFilterOptionHelper = (
 export const hasCustomLabels = (options: SelectOptionsType) =>
   options?.some(opt => !!opt?.customLabel);
 
-export const renderSelectOptions = (options: SelectOptionsType) =>
+export const renderSelectOptions = (
+  options: SelectOptionsType,
+): JSX.Element[] =>
   options.map(opt => {
     const isOptObject = typeof opt === 'object';
     const label = isOptObject ? opt?.label || opt.value : opt;
@@ -213,7 +217,10 @@ export const renderSelectOptions = (options: 
SelectOptionsType) =>
     );
   });
 
-export const mapValues = (values: SelectOptionsType, labelInValue: boolean) =>
+export const mapValues = (
+  values: SelectOptionsType,
+  labelInValue: boolean,
+): (Record<string, any> | any)[] =>
   labelInValue
     ? values.map(opt => ({
         key: opt.value,
@@ -222,7 +229,7 @@ export const mapValues = (values: SelectOptionsType, 
labelInValue: boolean) =>
       }))
     : values.map(opt => opt.value);
 
-export const mapOptions = (values: SelectOptionsType) =>
+export const mapOptions = (values: SelectOptionsType): Record<string, any>[] =>
   values.map(opt => ({
     children: opt.label,
     key: opt.value,
diff --git 
a/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx 
b/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx
index 1adf60eee8..96754950ce 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/index.tsx
@@ -33,15 +33,7 @@ import VizTypeGallery, {
   MAX_ADVISABLE_VIZ_GALLERY_WIDTH,
 } from './VizTypeGallery';
 import { FastVizSwitcher } from './FastVizSwitcher';
-
-interface VizTypeControlProps {
-  description?: string;
-  label?: string;
-  name: string;
-  onChange: (vizType: string | null) => void;
-  value: string | null;
-  isModalOpenInit?: boolean;
-}
+import { VizTypeControlProps } from './types';
 
 const bootstrapData = getBootstrapData();
 const denyList: string[] = (
diff --git 
a/superset-frontend/src/explore/components/controls/VizTypeControl/types.ts 
b/superset-frontend/src/explore/components/controls/VizTypeControl/types.ts
index 2fe40ba633..7d38a4b5e3 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/types.ts
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/types.ts
@@ -27,9 +27,19 @@ export interface FastVizSwitcherProps {
   onChange: (vizName: string) => void;
   currentSelection: string | null;
 }
+
 export interface VizTileProps {
   vizMeta: VizMeta;
   isActive: boolean;
   isRendered: boolean;
   onTileClick: (vizType: string) => void;
 }
+
+export interface VizTypeControlProps {
+  description?: string;
+  label?: string;
+  name: string;
+  onChange: (vizType: string | null) => void;
+  value: string | null;
+  isModalOpenInit?: boolean;
+}
diff --git a/superset-frontend/src/views/routes.tsx 
b/superset-frontend/src/views/routes.tsx
index 7044e8940a..30ce65f069 100644
--- a/superset-frontend/src/views/routes.tsx
+++ b/superset-frontend/src/views/routes.tsx
@@ -238,7 +238,7 @@ if (isFeatureEnabled(FeatureFlag.TaggingSystem)) {
   });
 }
 
-const frontEndRoutes = routes
+const frontEndRoutes: Record<string, boolean> = routes
   .map(r => r.path)
   .reduce(
     (acc, curr) => ({
@@ -248,10 +248,10 @@ const frontEndRoutes = routes
     {},
   );
 
-export function isFrontendRoute(path?: string) {
+export const isFrontendRoute = (path?: string): boolean => {
   if (path) {
     const basePath = path.split(/[?#]/)[0]; // strip out query params and link 
bookmarks
     return !!frontEndRoutes[basePath];
   }
   return false;
-}
+};

Reply via email to