From a493d56487830a9b4772598c73d5c327200a6c60 Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Wed, 18 Sep 2024 14:26:50 -0300 Subject: [PATCH] Add AnyComponentTypeWithChildren --- src/globals.d.ts | 3 ++- src/webpack/common/types/menu.d.ts | 26 ++++++++++++-------------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/globals.d.ts b/src/globals.d.ts index 70843b5b8..31c7ce38f 100644 --- a/src/globals.d.ts +++ b/src/globals.d.ts @@ -20,7 +20,8 @@ import { LoDashStatic } from "lodash"; declare global { type AnyRecord = Record; - type AnyComponentType

= React.ComponentType

& AnyRecord; + type AnyComponentType

= React.ComponentType

& AnyRecord; + type AnyComponentTypeWithChildren

= React.ComponentType & AnyRecord> & AnyRecord; /** * This exists only at build time, so references to it in patches should insert it diff --git a/src/webpack/common/types/menu.d.ts b/src/webpack/common/types/menu.d.ts index 405e4fbb4..8a12f6c1b 100644 --- a/src/webpack/common/types/menu.d.ts +++ b/src/webpack/common/types/menu.d.ts @@ -16,12 +16,10 @@ * along with this program. If not, see . */ -import type { ComponentType, CSSProperties, MouseEvent, PropsWithChildren, ReactNode, UIEvent } from "react"; - -type RC = ComponentType>; +import type { CSSProperties, MouseEvent, ReactNode, UIEvent } from "react"; export interface Menu { - Menu: RC<{ + Menu: AnyComponentTypeWithChildren<{ navId: string; onClose(): void; className?: string; @@ -29,31 +27,31 @@ export interface Menu { hideScroller?: boolean; onSelect?(): void; }>; - MenuSeparator: ComponentType; - MenuGroup: RC<{ + MenuSeparator: AnyComponentType; + MenuGroup: AnyComponentTypeWithChildren<{ label?: string; }>; - MenuItem: RC<{ + MenuItem: AnyComponentTypeWithChildren<{ id: string; label: ReactNode; action?(e: MouseEvent): void; - icon?: ComponentType; + icon?: AnyComponentType; color?: string; - render?: ComponentType; + render?: AnyComponentType; onChildrenScroll?: Function; childRowHeight?: number; listClassName?: string; disabled?: boolean; }>; - MenuCheckboxItem: RC<{ + MenuCheckboxItem: AnyComponentTypeWithChildren<{ id: string; label: string; checked: boolean; action?(e: MouseEvent): void; disabled?: boolean; }>; - MenuRadioItem: RC<{ + MenuRadioItem: AnyComponentTypeWithChildren<{ id: string; group: string; label: string; @@ -61,18 +59,18 @@ export interface Menu { action?(e: MouseEvent): void; disabled?: boolean; }>; - MenuControlItem: RC<{ + MenuControlItem: AnyComponentTypeWithChildren<{ id: string; interactive?: boolean; }>; - MenuSliderControl: RC<{ + MenuSliderControl: AnyComponentTypeWithChildren<{ minValue: number, maxValue: number, value: number, onChange(value: number): void, renderValue?(value: number): string, }>; - MenuSearchControl: RC<{ + MenuSearchControl: AnyComponentTypeWithChildren<{ query: string; onChange(query: string): void; placeholder?: string;