Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update return types for Icon and SVGIconContainer
Browse files Browse the repository at this point in the history
Update types to preserve backward and forward compatibility with React 16/18
ggdouglas committed Jan 16, 2025

Unverified

This user has not yet uploaded their public signing key.
1 parent 89ce662 commit 207f906
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/icon/icon.tsx
Original file line number Diff line number Diff line change
@@ -101,7 +101,7 @@ export interface DefaultIconProps extends IntentProps, Props, DefaultSVGIconProp
* @see https://stackoverflow.com/a/73795494/7406866
*/
export interface IconComponent extends React.FC<IconProps<Element>> {
<T extends Element = Element>(props: IconProps<T>): React.ReactNode | null;
<T extends Element = Element>(props: IconProps<T>): ReturnType<React.FC<IconProps<Element>>> | null;
}

/**
4 changes: 3 additions & 1 deletion packages/icons/src/svgIconContainer.tsx
Original file line number Diff line number Diff line change
@@ -42,7 +42,9 @@ export type SVGIconContainerProps<T extends Element> = Omit<SVGIconProps<T>, "ch
* @see https://stackoverflow.com/a/73795494/7406866
*/
export interface SVGIconContainerComponent extends React.FC<SVGIconContainerProps<Element>> {
<T extends Element = Element>(props: SVGIconContainerProps<T>): React.ReactNode | null;
<T extends Element = Element>(
props: SVGIconContainerProps<T>,
): ReturnType<React.FC<SVGIconContainerProps<Element>>> | null;
}

// eslint-disable-next-line prefer-arrow-callback

0 comments on commit 207f906

Please sign in to comment.