This repository has been archived on 2024-10-26. You can view files and clone it, but cannot push or open issues or pull requests.
staxman-old/static/vendor/domutil/makeDOM.d.ts

10 lines
600 B
TypeScript
Raw Normal View History

2023-11-30 00:57:45 +00:00
type ElementProperties<T extends keyof HTMLElementTagNameMap> = {
[key in keyof HTMLElementTagNameMap[T]]: HTMLElementTagNameMap[T][key];
} & {
[key in keyof HTMLElementEventMap as `@${key}`]: (this: HTMLElement, ev: HTMLElementEventMap[key]) => void;
};
type DOMElem = Node | string;
type WithClassOrId<T extends keyof HTMLElementTagNameMap> = `${T}#${string}` | `${T}.${string}`;
export declare function $el<T extends keyof HTMLElementTagNameMap>(name: T | WithClassOrId<T>, ...desc: [Partial<ElementProperties<T>>, ...DOMElem[]] | DOMElem[]): HTMLElementTagNameMap[T];
export default $el;