From 0539417f63b4ef5fdd732e53f548e7276bef7d78 Mon Sep 17 00:00:00 2001 From: Nebual Date: Thu, 22 Dec 2016 12:32:19 -0800 Subject: [PATCH] [bootstrap-switch]: Update return types for non-JQuery methods --- bootstrap-switch/bootstrap-switch-tests.ts | 3 +++ bootstrap-switch/index.d.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/bootstrap-switch/bootstrap-switch-tests.ts b/bootstrap-switch/bootstrap-switch-tests.ts index 17bc0fd561..539399a78e 100644 --- a/bootstrap-switch/bootstrap-switch-tests.ts +++ b/bootstrap-switch/bootstrap-switch-tests.ts @@ -18,6 +18,9 @@ function test_cases() { $('#switch').bootstrapSwitch('state', true, true); + $('#switch').bootstrapSwitch('state') === true; + + $('#switch').bootstrapSwitch('onText') === 'test'; $('#switch').on('switchChange.bootstrapSwitch', (event) => { console.log($(event.target).val()); diff --git a/bootstrap-switch/index.d.ts b/bootstrap-switch/index.d.ts index 302e4f8735..670c50c73c 100644 --- a/bootstrap-switch/index.d.ts +++ b/bootstrap-switch/index.d.ts @@ -84,6 +84,8 @@ declare namespace BootstrapSwitch { interface JQuery { bootstrapSwitch(): JQuery; bootstrapSwitch(options: BootstrapSwitch.BootstrapSwitchOptions): JQuery; + bootstrapSwitch(method: 'state' | 'radioAllOff' | 'animate' | 'disabled' | 'readonly'): boolean; + bootstrapSwitch(method: 'size' | 'onColor' | 'offColor' | 'onText' | 'offText' | 'labelText' | 'baseClass' | 'wrapperClass'): string; bootstrapSwitch(method: string): JQuery; bootstrapSwitch(method: string, param: any): JQuery; bootstrapSwitch(method: string, param1: any, param2: any): JQuery;