Skip to content

Commit

Permalink
fix: better slot type (#45)
Browse files Browse the repository at this point in the history
sroussey authored Feb 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 145ab1f commit 33b3ea0
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/components/NodeCheckboxField.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLInputElement>) => setValue(e.target.checked),
[setValue],
)

2 changes: 1 addition & 1 deletion lib/node-builder.tsx
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ export function NodeBody({
export function NodeWrapper({
children,
}: NodeFocusState & { children: ReactNode }) {
return <>{children}</>
return <>{children!}</>
}

/**
6 changes: 2 additions & 4 deletions lib/types/slots.ts
Original file line number Diff line number Diff line change
@@ -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<NodeHeaderProps>
body: ComponentType<NodeBodyProps>
wrapper: ComponentType<
NodeFocusState & { children: ReactElement | ReactElement[] }
>
wrapper: ComponentType<NodeFocusState & { children: ReactNode }>
bodyTop?: ComponentType<NodeFocusState>
bodyBottom?: ComponentType<NodeFocusState>
}

0 comments on commit 33b3ea0

Please sign in to comment.