marsidev / react-turnstile

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

`window` pollution in types.d.ts #12

Closed Dergash closed 1 year ago

Dergash commented 1 year ago

I've encountered a typescript error which seems to be caused by types.d.ts redeclaring types for global Window object

https://github.com/marsidev/react-turnstile/blob/a3892da65c2724dfce2ab1a16ab0cad6bad2d52d/src/types.d.ts#L1-L9

The behaviour I observe is that this forces () => void type for any non-standard Window property, because each new property falls under [key: string]: () => void declaration.

My understanding this library should only declare types for window.turnstile.

Reproducible example:

Tested with version 0.0.7 but from 0.0.8 declarations I can see this typing is still there

window-global