Skip to content

Commit

Permalink
fix: simplify legacy ts readme
Browse files Browse the repository at this point in the history
  • Loading branch information
faris-imi committed Feb 15, 2024
1 parent 113b9a2 commit 314b35c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,10 @@ hCaptchaLoader().then(function(hcaptcha) {

```
### TypeScript
To ensure compatibility with TypeScript environments, it is necessary to either override the type (`(window as any).hCaptchaLoader()`) or declare an interface:
To ensure compatibility with TypeScript environments, use indexer access:
```ts
declare global {
interface Window {
hCaptchaLoader: any;
}
}

window.hCaptchaLoader().then(function(hcaptcha) {
window['hCaptchaLoader']().then(function(hcaptcha) {
var element = document.createElement('div');
// hCaptcha API is ready
hcaptcha.render(element, {
Expand Down

0 comments on commit 314b35c

Please sign in to comment.