function createEl<K extends keyof HTMLElementTagNameMap>(tag: K, options?: string | DomElementInfo, callback?: ((el: HTMLElementTagNameMap[K]) => void)): HTMLElementTagNameMap[K] {
                const el = document.createElement(tag);
                if (typeof options === "string") options = { cls: options };
                options = options || {};

                if (options.cls) (Array.isArray(options.cls) ? el.className = options.cls.join(" ") : el.className = options.cls);
                if (options.text) el.setText(options.text);
                if (options.attr) el.setAttrs(options.attr);
                if (options.title !== undefined) el.title = options.title;
                if (options.value !== undefined && 
                    (el instanceof HTMLInputElement || el instanceof HTMLSelectElement || el instanceof HTMLOptionElement)) {
                    el.value = options.value;
                }
                if (options.type && el instanceof HTMLInputElement) el.type = options.type;
                if (options.type && el instanceof HTMLStyleElement) el.setAttribute("type", options.type);
                if (options.placeholder && el instanceof HTMLInputElement) el.placeholder = options.placeholder;
                if (options.href && (el instanceof HTMLAnchorElement || el instanceof HTMLLinkElement || el instanceof HTMLBaseElement)) el.href = options.href;
                cb?.(el);
                if (options.parent) {
                    if (options.prepend) options.parent.insertBefore(el, options.parent.firstChild);
                    else options.parent.appendChild(el);
                }
                // add event listeners (e.g. { onclick: () => {} })
                for (const key in options) {
                    if (options.hasOwnProperty(key) && key.startsWith("on")) {
                        const value = options[key];
                        if (typeof value === "function") el.addEventListener(key.substring(2), value);
                    }
                }
                return el
            }