createTypeMatchValidator
createTypeMatchValidator(
options?): (source,target,info) =>boolean
Defined in: src/components/editor/NodeGraph/createTypeMatchValidator.ts:47
Build an isValidConnection validator for the common “connect ports of
matching dataType, in an allowed direction” rule — the logic most node
editors hand-write. Drop the result straight onto <NodeGraph>:
const isValidConnection = useMemo(() => createTypeMatchValidator(), []);<NodeGraph isValidConnection={isValidConnection} />The default match accepts a connection when either port is untyped, the
two dataTypes are equal, or one side is the anyType token. Override
match for richer rules (subtype graphs, numeric coercion, etc.).
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”(source, target, info) => boolean