From 207f90660384817f5a04d6d209e45711ac7c6398 Mon Sep 17 00:00:00 2001 From: Gregory Douglas Date: Thu, 16 Jan 2025 17:11:46 -0500 Subject: [PATCH] Update return types for Icon and SVGIconContainer Update types to preserve backward and forward compatibility with React 16/18 --- packages/core/src/components/icon/icon.tsx | 2 +- packages/icons/src/svgIconContainer.tsx | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/core/src/components/icon/icon.tsx b/packages/core/src/components/icon/icon.tsx index b0dd4f805a..974c2ef0e9 100644 --- a/packages/core/src/components/icon/icon.tsx +++ b/packages/core/src/components/icon/icon.tsx @@ -101,7 +101,7 @@ export interface DefaultIconProps extends IntentProps, Props, DefaultSVGIconProp * @see https://stackoverflow.com/a/73795494/7406866 */ export interface IconComponent extends React.FC> { - (props: IconProps): React.ReactNode | null; + (props: IconProps): ReturnType>> | null; } /** diff --git a/packages/icons/src/svgIconContainer.tsx b/packages/icons/src/svgIconContainer.tsx index 074a831a34..668f79d87d 100644 --- a/packages/icons/src/svgIconContainer.tsx +++ b/packages/icons/src/svgIconContainer.tsx @@ -42,7 +42,9 @@ export type SVGIconContainerProps = Omit, "ch * @see https://stackoverflow.com/a/73795494/7406866 */ export interface SVGIconContainerComponent extends React.FC> { - (props: SVGIconContainerProps): React.ReactNode | null; + ( + props: SVGIconContainerProps, + ): ReturnType>> | null; } // eslint-disable-next-line prefer-arrow-callback