Fix some typescript issues (#32586)

Fixes around 30 or so typescript errors. No runtime changes.
This commit is contained in:
silverwind 2024-11-21 14:57:42 +01:00 committed by GitHub
parent 9bf821ae6c
commit 675c288811
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
24 changed files with 89 additions and 73 deletions

View file

@ -1,4 +1,5 @@
import $ from 'jquery';
import type {FomanticInitFunction} from '../../types.ts';
const fomanticModalFn = $.fn.modal;
@ -6,12 +7,12 @@ const fomanticModalFn = $.fn.modal;
export function initAriaModalPatch() {
if ($.fn.modal === ariaModalFn) throw new Error('initAriaModalPatch could only be called once');
$.fn.modal = ariaModalFn;
ariaModalFn.settings = fomanticModalFn.settings;
(ariaModalFn as FomanticInitFunction).settings = fomanticModalFn.settings;
}
// the patched `$.fn.modal` modal function
// * it does the one-time attaching on the first call
function ariaModalFn(...args) {
function ariaModalFn(...args: Parameters<FomanticInitFunction>) {
const ret = fomanticModalFn.apply(this, args);
if (args[0] === 'show' || args[0]?.autoShow) {
for (const el of this) {