From 33b3ea03211f65185eaa9fcb4264861ce172fd93 Mon Sep 17 00:00:00 2001 From: Steven Roussey Date: Wed, 21 Feb 2024 09:51:37 -0800 Subject: [PATCH] fix: better slot type (#45) --- lib/components/NodeCheckboxField.tsx | 2 +- lib/node-builder.tsx | 2 +- lib/types/slots.ts | 6 ++---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/components/NodeCheckboxField.tsx b/lib/components/NodeCheckboxField.tsx index ffaf580..add9da1 100644 --- a/lib/components/NodeCheckboxField.tsx +++ b/lib/components/NodeCheckboxField.tsx @@ -11,7 +11,7 @@ export const NodeCheckboxField = memo( const [value, setValue] = useNodeFieldValue(props.id, props.defaultValue) const handleChange = useCallback( - (e) => setValue(e.target.checked), + (e: React.ChangeEvent) => setValue(e.target.checked), [setValue], ) diff --git a/lib/node-builder.tsx b/lib/node-builder.tsx index b996e88..8bd5f15 100644 --- a/lib/node-builder.tsx +++ b/lib/node-builder.tsx @@ -81,7 +81,7 @@ export function NodeBody({ export function NodeWrapper({ children, }: NodeFocusState & { children: ReactNode }) { - return <>{children} + return <>{children!} } /** diff --git a/lib/types/slots.ts b/lib/types/slots.ts index b7bb6e0..a861b74 100644 --- a/lib/types/slots.ts +++ b/lib/types/slots.ts @@ -1,4 +1,4 @@ -import { ComponentType, ReactElement } from 'react' +import { ComponentType, ReactNode } from 'react' import { NodeHeader, NodeHeaderProps } from '../components/NodeHeader.tsx' import { NodeBody, @@ -10,9 +10,7 @@ import { export type GraphSlots = { header: ComponentType body: ComponentType - wrapper: ComponentType< - NodeFocusState & { children: ReactElement | ReactElement[] } - > + wrapper: ComponentType bodyTop?: ComponentType bodyBottom?: ComponentType }