From f27002e2901cbb643cac55e81b77c73fa9dbf14a Mon Sep 17 00:00:00 2001 From: Ruslan Arkhipau Date: Mon, 8 Aug 2016 14:06:19 -0700 Subject: [PATCH] [grecaptcha] Added a missing `size` parameter; Added value constraints to `theme`, `type`, and `size` parameters --- grecaptcha/grecaptcha-tests.ts | 3 ++- grecaptcha/grecaptcha.d.ts | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/grecaptcha/grecaptcha-tests.ts b/grecaptcha/grecaptcha-tests.ts index cfc86e71b6..b252efb04d 100644 --- a/grecaptcha/grecaptcha-tests.ts +++ b/grecaptcha/grecaptcha-tests.ts @@ -2,8 +2,9 @@ var params: ReCaptchaV2.Parameters = { "sitekey": "mySuperSecretKey", - "theme": "black", // no type-checking here. + "theme": "light", "type": "image", + "size": "normal", "tabindex": 5, "callback": (response: string) => { }, "expired-callback": () => { }, diff --git a/grecaptcha/grecaptcha.d.ts b/grecaptcha/grecaptcha.d.ts index 8e3b744d53..c8f165a8f8 100644 --- a/grecaptcha/grecaptcha.d.ts +++ b/grecaptcha/grecaptcha.d.ts @@ -29,6 +29,10 @@ declare namespace ReCaptchaV2 getResponse(opt_widget_id?: number): string; } + type Theme = "light" | "dark"; + type Type = "image" | "audio"; + type Size = "normal" | "compact"; + interface Parameters { /** @@ -39,14 +43,23 @@ declare namespace ReCaptchaV2 * Optional. The color theme of the widget. * Accepted values: "light", "dark" * @default "light" + * @type {Theme} **/ - theme?: string; + theme?: Theme; /** * Optional. The type of CAPTCHA to serve. - * Accepted values: "audio ", "image" + * Accepted values: "audio", "image" * @default "image" + * @type {Type} **/ - type?: string; + type?: Type; + /** + * Optional. The size of the widget. + * Accepted values: "compact", "normal" + * @default "compact" + * @type {Size} + */ + size?: Size; /** * Optional. The tabindex of the widget and challenge. * If other elements in your page use tabindex, it should be set to make user navigation easier.