@@ -8,12 +8,12 @@ import React from "react";
88import Image from "next/image" ;
99import { TgphComponentProps } from "@telegraph/helpers" ;
1010
11- type IconComponent = ( ) => JSX . Element ;
11+ type IconComponent = ( ) => React . JSX . Element ;
1212type IconType = keyof typeof Icons | LucideIcon | IconComponent ;
1313
14- function getIcon ( icon ?: IconType ) : IconComponent | React . ReactNode {
14+ function getIcon ( icon ?: IconType ) : IconComponent | LucideIcon {
1515 if ( typeof icon === "function" ) {
16- return icon as IconComponent ;
16+ return icon as IconComponent | LucideIcon ;
1717 }
1818
1919 if ( typeof icon === "string" ) {
@@ -22,7 +22,7 @@ function getIcon(icon?: IconType): IconComponent | React.ReactNode {
2222 // can't be properly type checked.
2323 const lowercasedIcon = icon . toLowerCase ( ) ;
2424 if ( Icons [ lowercasedIcon as keyof typeof Icons ] ) {
25- return Icons [ lowercasedIcon as keyof typeof Icons ] as ( ) => JSX . Element ;
25+ return Icons [ lowercasedIcon as keyof typeof Icons ] as IconComponent ;
2626 }
2727
2828 // We throw an error here so that a build can't complete if there is an icon that
@@ -32,7 +32,7 @@ function getIcon(icon?: IconType): IconComponent | React.ReactNode {
3232 ) ;
3333 }
3434
35- return icon as React . ReactNode ;
35+ return icon as unknown as LucideIcon ;
3636}
3737
3838export const Tool = ( {
@@ -66,7 +66,7 @@ export const Tool = ({
6666 >
6767 { typeof _icon === "function" ? (
6868 < Box w = "8" h = "8" bg = "black" color = "white" p = "2" borderRadius = "2" >
69- { _icon ( ) }
69+ { ( _icon as IconComponent ) ( ) }
7070 </ Box >
7171 ) : (
7272 < Icon
@@ -134,7 +134,7 @@ export const ContentCard = ({
134134 >
135135 { typeof _icon === "function" ? (
136136 < Box w = "10" h = "10" bg = "gray-2" p = "2" borderRadius = "2" >
137- { _icon ( ) }
137+ { ( _icon as IconComponent ) ( ) }
138138 </ Box >
139139 ) : (
140140 < Icon
0 commit comments