From 43b17712ece42a935deb1c6cc9b036366d88f7ae Mon Sep 17 00:00:00 2001 From: Troy McKinnon Date: Fri, 10 Mar 2017 18:21:12 -0600 Subject: [PATCH] Bootbox: improve typing with string union types (#14561) --- bootbox/bootbox-tests.ts | 2 +- bootbox/index.d.ts | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bootbox/bootbox-tests.ts b/bootbox/bootbox-tests.ts index 92a079f456..b5f32931ae 100644 --- a/bootbox/bootbox-tests.ts +++ b/bootbox/bootbox-tests.ts @@ -6,7 +6,7 @@ bootbox.alert("Are we ok with callback?", function () { console.log("Callback called!"); }); bootbox.alert({ - size: "medium", + size: "small", message: "Are we ok with callback and custom button?", callback: function () { console.log("Callback called!"); diff --git a/bootbox/index.d.ts b/bootbox/index.d.ts index 40494d5ca5..d5ceb5ef62 100644 --- a/bootbox/index.d.ts +++ b/bootbox/index.d.ts @@ -15,7 +15,8 @@ interface BootboxBaseOptions { closeButton?: boolean; animate?: boolean; className?: string; - size?: string; + /** All other values result in medium */ + size?: "small" | "large"; buttons?: BootboxButtonMap; // complex object where each key is of type BootboxButton } @@ -40,7 +41,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions { interface BootboxPromptOptions extends BootboxBaseOptions { title: string; value?: string; - inputType?: string; + inputType?: "text" | "textarea" | "email" | "select" | "checkbox" | "date" | "time" | "number" | "password"; callback: (result: string) => any; buttons?: BootboxConfirmPromptButtonMap; }