From 4f4625019f1f02b91a0ee6e15914a4b14fdc0599 Mon Sep 17 00:00:00 2001 From: Yusuf Musleh Date: Tue, 9 Jul 2024 12:24:43 +0200 Subject: [PATCH] fix: Remove wrong types to fix typing --- src/generic/block-type-utils/constants.ts | 4 ++-- src/generic/block-type-utils/index.tsx | 3 +-- src/search-manager/SearchFilterWidget.tsx | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/generic/block-type-utils/constants.ts b/src/generic/block-type-utils/constants.ts index 4b9596c3db..d0859c1fd9 100644 --- a/src/generic/block-type-utils/constants.ts +++ b/src/generic/block-type-utils/constants.ts @@ -36,7 +36,7 @@ export const TYPE_ICONS_MAP: Record = { lock: LockIcon, }; -export const COMPONENT_TYPE_ICON_MAP: Record = { +export const COMPONENT_TYPE_ICON_MAP = { [COMPONENT_TYPES.advanced]: ScienceIcon, [COMPONENT_TYPES.discussion]: QuestionAnswerOutlineIcon, [COMPONENT_TYPES.library]: LibraryIcon, @@ -47,7 +47,7 @@ export const COMPONENT_TYPE_ICON_MAP: Record = { [COMPONENT_TYPES.dragAndDrop]: BackHandIcon, }; -export const STRUCTURAL_TYPE_ICONS: Record = { +export const STRUCTURAL_TYPE_ICONS = { vertical: TYPE_ICONS_MAP.vertical, sequential: Folder, chapter: Folder, diff --git a/src/generic/block-type-utils/index.tsx b/src/generic/block-type-utils/index.tsx index 9354bcdd91..76ee224c84 100644 --- a/src/generic/block-type-utils/index.tsx +++ b/src/generic/block-type-utils/index.tsx @@ -1,4 +1,3 @@ -import React from 'react'; import { Article } from '@openedx/paragon/icons'; import { COMPONENT_TYPE_ICON_MAP, @@ -6,7 +5,7 @@ import { COMPONENT_TYPE_COLOR_MAP, } from './constants'; -export function getItemIcon(blockType: string): React.ReactElement { +export function getItemIcon(blockType: string) { return STRUCTURAL_TYPE_ICONS[blockType] ?? COMPONENT_TYPE_ICON_MAP[blockType] ?? Article; } diff --git a/src/search-manager/SearchFilterWidget.tsx b/src/search-manager/SearchFilterWidget.tsx index 51ed93ca12..3c42edde0d 100644 --- a/src/search-manager/SearchFilterWidget.tsx +++ b/src/search-manager/SearchFilterWidget.tsx @@ -26,7 +26,7 @@ const SearchFilterWidget: React.FC<{ label: React.ReactNode; children: React.ReactNode; clearFilter: () => void, - icon?: React.ReactNode; // eslint-disable-line react/require-default-props + icon?: React.ComponentType<{}> | undefined; // eslint-disable-line react/require-default-props }> = ({ appliedFilters, ...props }) => { const intl = useIntl(); const [isOpen, open, close] = useToggle(false);