From 90852c1dd134deb17e44dc5ea3ba90141deefb5d Mon Sep 17 00:00:00 2001 From: Leonard Thieu Date: Thu, 1 Jun 2017 15:03:00 -0400 Subject: [PATCH] Fix and collapse tooltipster overloads. (#16763) --- types/jquery.tooltipster/index.d.ts | 53 ++++++++++++++++------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/types/jquery.tooltipster/index.d.ts b/types/jquery.tooltipster/index.d.ts index 3534730ec4..5ef4debed4 100644 --- a/types/jquery.tooltipster/index.d.ts +++ b/types/jquery.tooltipster/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jQuery Tooltipster 3.3.0 // Project: https://github.com/iamceege/tooltipster -// Definitions by: Patrick Magee , Dmitry Pesterev +// Definitions by: Patrick Magee , Dmitry Pesterev , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -164,25 +164,6 @@ interface JQueryTooltipsterOptions { interface JQuery { - /** - * Initiate the Tooltipster plugin - */ - tooltipster(): JQuery; - - /** - * Creates a new tooltip with the specified, or default, options. - * @param options The options - * @example - * $('.tooltip').tooltipster({ - * animation: 'fade', - * delay: 200, - * theme: 'tooltipster-default', - * touchDevices: false, - * trigger: 'hover' - * }); - */ - tooltipster(options?: JQueryTooltipsterOptions): JQuery; - /** * Show a tooltip (the 'callback' argument is optional) * @param methodName show @@ -262,11 +243,35 @@ interface JQuery { */ tooltipster(methodName: "elementIcon"): JQuery; + /** + * Change default options for all future instances + * @param methodName setDefaults + * @param {object} options The options that should be made defaults + */ + tooltipster(methodName: 'setDefaults', options: JQueryTooltipsterOptions): JQuery; + /** * Generics */ - tooltipster(methodName: string, optionName: string, optionValue: string): JQuery; - tooltipster(methodName: string, param: string): JQuery; - tooltipster(methodName: string): JQuery; - tooltipster(methodName: string): string; + tooltipster(methodName: string, optionName: string, optionValue?: string): JQuery; + tooltipster(methodName: string): JQuery | string; + + /** + * Creates a new tooltip with the specified, or default, options. + * @param options The options + * @example + * $('.tooltip').tooltipster({ + * animation: 'fade', + * delay: 200, + * theme: 'tooltipster-default', + * touchDevices: false, + * trigger: 'hover' + * }); + */ + tooltipster(options?: JQueryTooltipsterOptions): JQuery; + + /** + * Initiate the Tooltipster plugin + */ + tooltipster(): JQuery; }