@@ -91,7 +91,7 @@ export const DragHandleOverlay = () => {
9191 if ( isDragging || pending ) return sourceNodeRef . current ;
9292 const shape = editor . getOnlySelectedShape ( ) ;
9393 if ( shape && isDiscourseNodeShape ( editor , shape ) ) {
94- return shape as DiscourseNodeShape ;
94+ return shape ;
9595 }
9696 return null ;
9797 } ,
@@ -117,7 +117,7 @@ export const DragHandleOverlay = () => {
117117 ) ;
118118
119119 const handlePointerDown = useCallback (
120- ( e : React . PointerEvent , _anchor : { x : number ; y : number } ) => {
120+ ( e : React . PointerEvent ) => {
121121 if ( ! selectedNode ) return ;
122122 e . preventDefault ( ) ;
123123 e . stopPropagation ( ) ;
@@ -315,9 +315,15 @@ export const DragHandleOverlay = () => {
315315 const util = editor . getShapeUtil ( newArrow ) ;
316316 if (
317317 util instanceof BaseDiscourseRelationUtil &&
318- typeof ( util as any ) . handleCreateRelationsInRoam === "function"
318+ " handleCreateRelationsInRoam" in util
319319 ) {
320- void ( util as any ) . handleCreateRelationsInRoam ( {
320+ type UtilWithRoamPersistence = BaseDiscourseRelationUtil & {
321+ handleCreateRelationsInRoam : ( args : {
322+ arrow : DiscourseRelationShape ;
323+ targetId : TLShapeId ;
324+ } ) => Promise < void > ;
325+ } ;
326+ void ( util as UtilWithRoamPersistence ) . handleCreateRelationsInRoam ( {
321327 arrow : editor . getShape < DiscourseRelationShape > ( arrowId ) ?? newArrow ,
322328 targetId : pending . targetId ,
323329 } ) ;
@@ -347,7 +353,7 @@ export const DragHandleOverlay = () => {
347353 handlePositions . map ( ( pos , i ) => (
348354 < div
349355 key = { i }
350- onPointerDown = { ( e ) => handlePointerDown ( e , pos . anchor ) }
356+ onPointerDown = { handlePointerDown }
351357 style = { {
352358 position : "absolute" ,
353359 left : `${ pos . left } px` ,
0 commit comments