From ce0b70cc8685aa4d83c0c4ad0fb8f03fb7e28ede Mon Sep 17 00:00:00 2001 From: "JUST.in DO IT" Date: Wed, 6 Mar 2024 10:16:51 -0800 Subject: [PATCH] fix: typescript errors in 4.0 (#27402) --- .../packages/superset-ui-core/src/query/api/v1/makeApi.ts | 4 ++-- .../src/components/AlteredSliceTag/AlteredSliceTagMocks.ts | 2 +- superset-frontend/src/components/AlteredSliceTag/index.tsx | 6 +++--- superset-frontend/src/components/TelemetryPixel/index.tsx | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/superset-frontend/packages/superset-ui-core/src/query/api/v1/makeApi.ts b/superset-frontend/packages/superset-ui-core/src/query/api/v1/makeApi.ts index 900197fcb6b38..dc62b9094b290 100644 --- a/superset-frontend/packages/superset-ui-core/src/query/api/v1/makeApi.ts +++ b/superset-frontend/packages/superset-ui-core/src/query/api/v1/makeApi.ts @@ -115,11 +115,11 @@ export default function makeApi< jsonPayload: undefined as JsonObject | undefined, }; if (requestType === 'search') { - requestConfig.searchParams = payload as URLSearchParams; + requestConfig.searchParams = payload as unknown as URLSearchParams; } else if (requestType === 'rison') { requestConfig.endpoint = `${endpoint}?q=${rison.encode(payload)}`; } else if (requestType === 'form') { - requestConfig.postPayload = payload as FormData; + requestConfig.postPayload = payload as unknown as FormData; } else { requestConfig.jsonPayload = payload as JsonObject; } diff --git a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts index 233f519446d70..6428b503b85ad 100644 --- a/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts +++ b/superset-frontend/src/components/AlteredSliceTag/AlteredSliceTagMocks.ts @@ -17,7 +17,7 @@ * under the License. */ import { QueryFormData } from '@superset-ui/core'; -import { ControlPanelConfig } from 'packages/superset-ui-chart-controls/src/types'; +import { ControlPanelConfig } from '@superset-ui/chart-controls'; import { DiffType, RowType } from './index'; export const defaultProps: Record> = { diff --git a/superset-frontend/src/components/AlteredSliceTag/index.tsx b/superset-frontend/src/components/AlteredSliceTag/index.tsx index dfedc9f5b651f..28f47657b9717 100644 --- a/superset-frontend/src/components/AlteredSliceTag/index.tsx +++ b/superset-frontend/src/components/AlteredSliceTag/index.tsx @@ -179,7 +179,7 @@ class AlteredSliceTag extends React.Component< return '[]'; } return value - .map(v => { + .map((v: FilterItemType) => { const filterVal = v.comparator && v.comparator.constructor === Array ? `[${v.comparator.join(', ')}]` @@ -198,14 +198,14 @@ class AlteredSliceTag extends React.Component< return value.map(v => safeStringify(v)).join(', '); } if (controlsMap[key]?.type === 'MetricsControl' && Array.isArray(value)) { - const formattedValue = value.map(v => v?.label ?? v); + const formattedValue = value.map((v: FilterItemType) => v?.label ?? v); return formattedValue.length ? formattedValue.join(', ') : '[]'; } if (typeof value === 'boolean') { return value ? 'true' : 'false'; } if (Array.isArray(value)) { - const formattedValue = value.map(v => v?.label ?? v); + const formattedValue = value.map((v: FilterItemType) => v?.label ?? v); return formattedValue.length ? formattedValue.join(', ') : '[]'; } if (typeof value === 'string' || typeof value === 'number') { diff --git a/superset-frontend/src/components/TelemetryPixel/index.tsx b/superset-frontend/src/components/TelemetryPixel/index.tsx index 6c7ce106e6962..f0223ac70d39d 100644 --- a/superset-frontend/src/components/TelemetryPixel/index.tsx +++ b/superset-frontend/src/components/TelemetryPixel/index.tsx @@ -47,6 +47,7 @@ const TelemetryPixel = ({ const pixelPath = `https://apachesuperset.gateway.scarf.sh/pixel/${PIXEL_ID}/${version}/${sha}/${build}`; return process.env.SCARF_ANALYTICS === 'false' ? null : (