From 84260cddc6b43de0fab40d7fc3f60561a89032f2 Mon Sep 17 00:00:00 2001 From: JuFeng Zhang Date: Thu, 15 Jul 2021 22:00:07 +0800 Subject: [PATCH] chore(types): fix the types of sensors --- index.d.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/index.d.ts b/index.d.ts index 22458541..0c615633 100644 --- a/index.d.ts +++ b/index.d.ts @@ -10,6 +10,16 @@ declare module '@shopify/draggable/lib/es5/draggable.bundle.legacy' { export * from '@shopify/draggable'; } +declare module '@shopify/draggable/esm/Draggable/Sensors' { + export { + Sensor, + DragSensor, + ForceTouchSensor, + MouseSensor, + TouchSensor, + } from '@shopify/draggable'; +} + declare module '@shopify/draggable' { abstract class AbstractEvent { constructor(data: DataT); @@ -181,7 +191,7 @@ declare module '@shopify/draggable' { handle?: string | NodeList | HTMLElement[] | HTMLElement | ((currentElement: HTMLElement) => HTMLElement); delay?: number | DelayOptions; plugins?: Array; - sensors?: Sensor[]; + sensors?: Array; classes?: { [key in DraggableClassNames]: string | string[] }; announcements?: AnnouncementOptions; collidables?: Collidables; @@ -338,6 +348,8 @@ declare module '@shopify/draggable' { delay?: number | DelayOptions; } + export * as Sensors from '@shopify/draggable/esm/Draggable/Sensors' + export class Sensor { constructor(containers: HTMLElement | HTMLElement[] | NodeList, options?: SensorOptions); attach(): this; @@ -347,10 +359,6 @@ declare module '@shopify/draggable' { trigger(element: HTMLElement, sensorEvent: SensorEvent): SensorEvent; } - export interface Sensors { - DragSensor: typeof DragSensor; - } - export class DragSensor extends Sensor { } export class ForceTouchSensor extends Sensor { }