diff options
author | silverwind <me@silverwind.io> | 2024-08-28 18:32:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-28 18:32:38 +0200 |
commit | 7207d93f01f0cd796e1b9e0156798990846d894b (patch) | |
tree | 3e3ffb93688c907975d36da1486dbcc3b46034a0 /web_src/js/htmx.ts | |
parent | 39d2fdefaf0dd42aa5e3ee8d3ea0a84b40c005f5 (diff) | |
download | gitea-7207d93f01f0cd796e1b9e0156798990846d894b.tar.gz gitea-7207d93f01f0cd796e1b9e0156798990846d894b.zip |
Fix a number of Typescript issues (#31877)
Typescript error count is reduced from 633 to 540 with this. No runtime
changes except in test code.
Diffstat (limited to 'web_src/js/htmx.ts')
-rw-r--r-- | web_src/js/htmx.ts | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/web_src/js/htmx.ts b/web_src/js/htmx.ts index bfc2147736..d4f317ee5a 100644 --- a/web_src/js/htmx.ts +++ b/web_src/js/htmx.ts @@ -1,20 +1,21 @@ import {showErrorToast} from './modules/toast.ts'; +import 'idiomorph/dist/idiomorph-ext.js'; // https://github.com/bigskysoftware/idiomorph#htmx +import type {HtmxResponseInfo} from 'htmx.org'; -// https://github.com/bigskysoftware/idiomorph#htmx -import 'idiomorph/dist/idiomorph-ext.js'; +type HtmxEvent = Event & {detail: HtmxResponseInfo}; // https://htmx.org/reference/#config window.htmx.config.requestClass = 'is-loading'; window.htmx.config.scrollIntoViewOnBoost = false; // https://htmx.org/events/#htmx:sendError -document.body.addEventListener('htmx:sendError', (event) => { +document.body.addEventListener('htmx:sendError', (event: HtmxEvent) => { // TODO: add translations showErrorToast(`Network error when calling ${event.detail.requestConfig.path}`); }); // https://htmx.org/events/#htmx:responseError -document.body.addEventListener('htmx:responseError', (event) => { +document.body.addEventListener('htmx:responseError', (event: HtmxEvent) => { // TODO: add translations showErrorToast(`Error ${event.detail.xhr.status} when calling ${event.detail.requestConfig.path}`); }); |