Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions types/cloudflare-turnstile/cloudflare-turnstile-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const renderParams: Turnstile.RenderParameters = {
cData: "<YOUR_CUSTOMER_DATA>",
callback: (token: string) => {},
"expired-callback": () => {},
"error-callback": () => {},
"error-callback": (error: string) => {},
theme: "auto",
tabindex: 5,
};
Expand All @@ -19,7 +19,6 @@ const themeDark: Turnstile.Theme = "dark";

const widgetSizeNormal: Turnstile.WidgetSize = "normal";
const widgetSizeCompact: Turnstile.WidgetSize = "compact";
const widgetSizeInvisible: Turnstile.WidgetSize = "invisible";

const failureRetryModeNever: Turnstile.FailureRetryMode = "never";
const failureRetryModeAuto: Turnstile.FailureRetryMode = "auto";
Expand Down
11 changes: 6 additions & 5 deletions types/cloudflare-turnstile/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ declare namespace Turnstile {
type Theme = "auto" | "light" | "dark";

/**
* The size of the Turnstile widget.
* The default is "normal", which is the default widget look. This can be set to "compact" to make the widget less large. The "invisible" option is only for invisible mode.
* The widget size.
* Can take the following values: normal, compact.
*/
type WidgetSize = "normal" | "compact" | "invisible";
type WidgetSize = "normal" | "compact";

/**
* How to retry on widget failure.
Expand Down Expand Up @@ -118,9 +118,10 @@ declare namespace Turnstile {
"expired-callback"?: (token: string) => void;

/**
* Optional. A JavaScript callback that is invoked when an error occurs with the widget.
* Optional. A JavaScript callback invoked when there is an error (e.g. network error or the challenge failed).
* Refer to [Client-side errors](https://developers.cloudflare.com/turnstile/troubleshooting/client-side-errors/).
*/
"error-callback"?: VoidFunction | undefined;
"error-callback"?: ((error: string) => void) | undefined;

/**
* Optional. A JavaScript callback that is invoked when the Turnstile widget times out.
Expand Down
2 changes: 1 addition & 1 deletion types/cloudflare-turnstile/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@types/cloudflare-turnstile",
"version": "0.1.9999",
"version": "0.2.9999",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why .9999? 0.2.0 sgtm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a requirement of the DefinitelyTyped repo

Note that the version in package.json should only contain major.minor version (e.g. 10.12) followed by .9999

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL

"nonNpm": true,
"nonNpmDescription": "Cloudflare Turnstile",
"projects": [
Expand Down