From 825dfd2e0835e35526043462e7e80d7da2057825 Mon Sep 17 00:00:00 2001 From: Sagie Maoz Date: Wed, 27 Feb 2019 17:05:29 -0500 Subject: [PATCH] fix(@types/select2): Add missing $.fn.select2 typing As per bottom of docs at http://select2.github.io/select2/ --- types/select2/v3/index.d.ts | 8 ++++++++ types/select2/v3/select2-tests.ts | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index f4a0c01efb..a74c294906 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -168,6 +168,14 @@ interface Select2Plugin { (method: 'search'): JQuery; (options: Select2Options): JQuery; + + /** + * Select2 exposes its default options via the $.fn.select2.defaults + * object. Properties changed in this object (same properties configurable + * through the constructor) will take effect for every instance created + * after the change. + */ + defaults: Partial; } interface JQuery { diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 4a0a496e13..af2bdfd583 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -1,3 +1,8 @@ +$.extend($.fn.select2.defaults, { + width: 'copy', + minimumInputLength: 12 +}); + $("#e9").select2(); $("#e2").select2({ placeholder: "Select a State",