From 82203f67d83485c311d041481c792523db774894 Mon Sep 17 00:00:00 2001 From: Pouzor Date: Mon, 11 May 2026 01:00:36 +0200 Subject: [PATCH] fix(alignment): use OnNodeDrag (NodeDragHandler doesn't exist in @xyflow/react) CI build failed with TS2305: NodeDragHandler is not exported. Local typecheck missed it because tsc-noEmit is more permissive than tsc -b. Use the exported OnNodeDrag type and alias it with our NodeData so the callback params are inferred (no implicit any). --- frontend/src/hooks/useAlignmentGuides.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/hooks/useAlignmentGuides.ts b/frontend/src/hooks/useAlignmentGuides.ts index e189429..cbcca08 100644 --- a/frontend/src/hooks/useAlignmentGuides.ts +++ b/frontend/src/hooks/useAlignmentGuides.ts @@ -1,5 +1,5 @@ import { useCallback, useEffect, useRef, useState } from 'react' -import { useReactFlow, type Node, type NodeDragHandler } from '@xyflow/react' +import { useReactFlow, type Node, type OnNodeDrag } from '@xyflow/react' import { computeSnap, unionBox, type Box, type Guide } from '@/utils/alignment' import { type AlignmentSettings, @@ -9,6 +9,8 @@ import { } from '@/utils/alignmentSettings' import type { NodeData } from '@/types' +type NodeDrag = OnNodeDrag> + function nodeBox(n: Node): Box | null { // Skip nodes with a parent — alignment between absolute & parent-relative // coordinates is misleading. Top-level nodes only for v1. @@ -46,7 +48,7 @@ export function useAlignmentGuides() { }) }, []) - const onNodeDrag: NodeDragHandler = useCallback((_event, dragNode, dragNodes) => { + const onNodeDrag: NodeDrag = useCallback((_event, dragNode, dragNodes) => { if (!settings.enabled || altDownRef.current) { if (guides.length > 0) setGuides([]) return @@ -77,7 +79,7 @@ export function useAlignmentGuides() { } }, [settings.enabled, settings.threshold, getNodes, setNodes, guides.length]) - const onNodeDragStop: NodeDragHandler = useCallback(() => { + const onNodeDragStop: NodeDrag = useCallback(() => { if (guides.length > 0) setGuides([]) }, [guides.length])