From c5dddbcb9775f9a8363c385a90b56e06b0343a00 Mon Sep 17 00:00:00 2001 From: Phil Nova Date: Mon, 19 Mar 2018 18:37:54 -0700 Subject: [PATCH] Add typings for onDragUpdate While mentioned in the docs, attempting to use onDragUpdate will cause a type error. This PR introduces typings for onDragUpdate that are consistent with the docs: `type DragUpdate = {| ...DragStart, // may not have any destination (drag to nowhere) destination: ?DraggableLocation, |}` --- types/react-beautiful-dnd/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index 085ad4e8b7..063fc43a0c 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -28,6 +28,10 @@ export interface DragStart { source: DraggableLocation; } +export interface DragUpdate extends DragStart { + destination?: DraggableLocation; +} + export interface DropResult { draggableId: DraggableId; type: TypeId; @@ -37,6 +41,7 @@ export interface DropResult { export interface DragDropContextProps { onDragStart?(initial: DragStart): void; + onDragUpdate?(initial: DragUpdate): void; onDragEnd(result: DropResult): void; }