From 8b3ebb9c1fc0eaa4ec04a7f28a121674435f9182 Mon Sep 17 00:00:00 2001 From: Kevin Van Cott Date: Sun, 5 Jan 2025 20:17:45 -0600 Subject: [PATCH] simplify preact flex render types --- examples/preact/sorting/src/main.tsx | 2 +- packages/preact-table/src/FlexRender.tsx | 15 ++++----------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/examples/preact/sorting/src/main.tsx b/examples/preact/sorting/src/main.tsx index 470a1dc0b3..e39de3a7ad 100644 --- a/examples/preact/sorting/src/main.tsx +++ b/examples/preact/sorting/src/main.tsx @@ -64,7 +64,7 @@ function App() { { accessorKey: 'progress', header: 'Profile Progress', - // enableSorting: false, //disable sorting for this column + // enableSorting: false, // disable sorting for this column }, { accessorKey: 'rank', diff --git a/packages/preact-table/src/FlexRender.tsx b/packages/preact-table/src/FlexRender.tsx index e42e1de489..47b8bdda25 100644 --- a/packages/preact-table/src/FlexRender.tsx +++ b/packages/preact-table/src/FlexRender.tsx @@ -1,13 +1,6 @@ -import type { ComponentType, VNode } from 'preact' +import type { ComponentChild, ComponentType } from 'preact' -export type Renderable = - | VNode - | ComponentType - | undefined - | null - | string - | number - | boolean +export type Renderable = ComponentChild | ComponentType function isPreactComponent( component: unknown, @@ -46,11 +39,11 @@ function isExoticComponent(component: any) { export function flexRender( Comp: Renderable | null, props: TProps, -): VNode | Element | null { +): ComponentChild | Element | null { return !Comp ? null : isPreactComponent(Comp) ? ( ) : ( - (Comp as VNode | Element | null) + Comp ) }