Skip to content

Commit 944cfbd

Browse files
committed
fix(util): correct function child detection and rendering logic
1 parent 30ca1fd commit 944cfbd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/node.util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ export class NodeUtil {
510510
* @param node The node to check.
511511
* @returns True if the node is a function-as-a-child, false otherwise.
512512
*/
513-
public static isFunctionChild<E extends NodeInstance | ReactNode>(node: NodeElement): node is NodeFunction<E> {
513+
public static isFunctionChild<E extends NodeElementType>(node: NodeElement): node is NodeFunction<E> {
514514
if (typeof node !== 'function' || isReactClassComponent(node) || isMemo(node) || isForwardRef(node)) return false
515515
try {
516516
return !(node.prototype && typeof node.prototype.render === 'function')
@@ -534,7 +534,7 @@ export class NodeUtil {
534534
* @param disableEmotion Inherited flag to disable Emotion styling for children.
535535
* @returns The processed and rendered output of the render function, or null if an error occurs.
536536
*/
537-
public static functionRenderer<E extends ReactNode | NodeInstance>({ render, disableEmotion }: FunctionRendererProps<E>): ReactNode | null | undefined {
537+
public static functionRenderer<E extends NodeElementType>({ render, disableEmotion }: FunctionRendererProps<E>): ReactNode | null | undefined {
538538
let result: NodeElement
539539
try {
540540
// Execute the render prop function to get its output.

0 commit comments

Comments
 (0)