marsidev / react-turnstile

Cloudflare Turnstile integration for React.
https://www.npmjs.com/package/@marsidev/react-turnstile
MIT License
414 stars 25 forks source link

Error Code Type Mismatch in TurnstileProps.onError Callback #73

Closed PH-LEE closed 5 months ago

PH-LEE commented 5 months ago

Do you want to request a feature or report a bug? bug

What is the current behavior?

image

The error code type passed to the 'onError' callback in 'TurnstileProps' is not a number but a string.

Demo: https://stackblitz.com/edit/vitejs-vite-pcsmmv?file=src%2FApp.tsx In the example, you can see that if the onError callback is called, the type of the errorCode displays as a string, not a number.

What is the expected behavior? It should match the type, whether it's a number or a string; otherwise, it could cause some bugs when writing conditional statements.