From 332717cfb92dba943e426e1c9e367d796bf1069f Mon Sep 17 00:00:00 2001 From: Ismael Gorissen Date: Wed, 23 Aug 2017 10:29:05 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9E=20Fix=20issue=20with=20use=20of=20?= =?UTF-8?q?Function=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- types/owl.carousel/index.d.ts | 39 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/types/owl.carousel/index.d.ts b/types/owl.carousel/index.d.ts index 53217caa48..21a4dcee71 100644 --- a/types/owl.carousel/index.d.ts +++ b/types/owl.carousel/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/OwlCarousel2/OwlCarousel2 // Definitions by: Ismael Gorissen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// @@ -51,7 +52,7 @@ declare namespace OwlCarousel { animateOut?: string | boolean; animateIn?: string | boolean; fallbackEasing?: string; - info?: Function; + info?: HandlerCallback; nestedItemSelector?: string; itemElement?: string; stageElement?: string; @@ -74,24 +75,26 @@ declare namespace OwlCarousel { autoHeightClass?: string; responsiveClass?: string | boolean; // EVENTS - onInitialize?: Function; - onInitialized?: Function; - onResize?: Function; - onResized?: Function; - onRefresh?: Function; - onRefreshed?: Function; - onDrag?: Function; - onDragged?: Function; - onTranslate?: Function; - onTranslated?: Function; - onChange?: Function; - onChanged?: Function; - onLoadLazy?: Function; - onLoadedLazy?: Function; - onStopVideo?: Function; - onPlayVideo?: Function; + onInitialize?: HandlerCallback; + onInitialized?: HandlerCallback; + onResize?: HandlerCallback; + onResized?: HandlerCallback; + onRefresh?: HandlerCallback; + onRefreshed?: HandlerCallback; + onDrag?: HandlerCallback; + onDragged?: HandlerCallback; + onTranslate?: HandlerCallback; + onTranslated?: HandlerCallback; + onChange?: HandlerCallback; + onChanged?: HandlerCallback; + onLoadLazy?: HandlerCallback; + onLoadedLazy?: HandlerCallback; + onStopVideo?: HandlerCallback; + onPlayVideo?: HandlerCallback; } + type HandlerCallback = (...args: any[]) => void; + type OnEvent = 'initialize.owl.carousel' | 'initialized.owl.carousel' | 'resize.owl.carousel' @@ -124,7 +127,7 @@ declare namespace OwlCarousel { interface JQuery { owlCarousel(options?: OwlCarousel.Options | 'destroy'): JQuery; - on(event: OwlCarousel.OnEvent, handler: (...args: any[]) => void): JQuery; + on(event: OwlCarousel.OnEvent, handler: OwlCarousel.HandlerCallback): JQuery; trigger(event: OwlCarousel.TriggerEvent): JQuery; }